Skip to content

Commit

Permalink
Fix render when i18n hook is disabled
Browse files Browse the repository at this point in the history
  • Loading branch information
Mordred committed May 24, 2016
1 parent cee2e64 commit a7f65c7
Showing 1 changed file with 14 additions and 10 deletions.
24 changes: 14 additions & 10 deletions lib/hooks/views/render.js
Original file line number Diff line number Diff line change
Expand Up @@ -91,16 +91,20 @@ module.exports = function render(relPathToView, _options, cb_view) {
headers: {}
};

// Initialize i18n
require('i18n').init(req, options, function() {

// Set the locale if necessary
if (options.locale) {
req.locale = options.locale;
}

// Render the view
// Initialize i18n if hook is enabled
if (sails.hooks.i18n) {
require('i18n').init(req, options, function() {

// Set the locale if necessary
if (options.locale) {
req.locale = options.locale;
}

// Render the view
sails.config.views.engine.fn(absPathToView, options, cb_view);
});
} else {
sails.config.views.engine.fn(absPathToView, options, cb_view);
});
}

};

0 comments on commit a7f65c7

Please sign in to comment.