i18next-express-middleware
Advanced tools
Comparing version 0.0.7 to 0.0.8
@@ -10,2 +10,4 @@ 'use strict'; | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } | ||
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj['default'] = obj; return newObj; } } | ||
@@ -17,5 +19,13 @@ | ||
function handle(i18next, options) { | ||
options = options || {}; | ||
var _LanguageDetector = require('./LanguageDetector'); | ||
var _LanguageDetector2 = _interopRequireDefault(_LanguageDetector); | ||
var LanguageDetector = _LanguageDetector2['default']; | ||
exports.LanguageDetector = LanguageDetector; | ||
function handle(i18next) { | ||
var options = arguments.length <= 1 || arguments[1] === undefined ? {} : arguments[1]; | ||
return function (req, res, next) { | ||
@@ -28,3 +38,3 @@ var ignores = options.ignoreRoutes || []; | ||
var lng = req.lng; | ||
if (req.lng && i18next.services.languageDetector) lng = i18next.services.languageDetector.detect(); | ||
if (req.lng && i18next.services.languageDetector) lng = i18next.services.languageDetector.detect(req, res); | ||
@@ -69,3 +79,3 @@ // set locale | ||
if (i18next.services.languageDetector) i18next.services.languageDetector.cacheUserLanguage(lng); | ||
if (i18next.services.languageDetector) i18next.services.languageDetector.cacheUserLanguage(req, res, lng); | ||
next(); | ||
@@ -72,0 +82,0 @@ }; |
{ | ||
"name": "i18next-express-middleware", | ||
"version": "0.0.7", | ||
"version": "0.0.8", | ||
"description": "express middleware for i18next", | ||
@@ -15,2 +15,3 @@ "main": "./lib/index.js", | ||
"dependencies": { | ||
"cookies": "0.5.1", | ||
"json5": "0.4.0" | ||
@@ -17,0 +18,0 @@ }, |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
16437
11
355
2
+ Addedcookies@0.5.1
+ Addedcookies@0.5.1(transitive)
+ Addedkeygrip@1.0.3(transitive)