twee
Version:
Twee Framework - the most powerful, elegant and extensive framework for Node.js based on Express.js
15 lines (14 loc) • 358 B
JavaScript
/**
* Switching language
*
* @param request
* @param response
* @param next
*/
module.exports.switchLanguage = function(request, response, next) {
if (request.query.lang) {
response.cookie('locale', request.query.lang, { maxAge: 9999999999999, path: '*.' });
request.setLocale(request.query.lang);
}
next();
}