i18next-express-middleware
Advanced tools
Comparing version 0.0.16 to 0.0.17
@@ -46,2 +46,5 @@ 'use strict'; | ||
options = options || {}; | ||
if (typeof options !== 'object' && i18next.options.overloadTranslationOptionHandler && typeof i18next.options.overloadTranslationOptionHandler === 'function') { | ||
options = i18next.options.overloadTranslationOptionHandler(arguments); | ||
} | ||
options.lng = options.lng || req.lng; | ||
@@ -76,2 +79,3 @@ return i18next.t(key, options); | ||
res.locals.language = lng; | ||
res.locals.languageDir = i18next.dir(lng); | ||
} | ||
@@ -78,0 +82,0 @@ |
@@ -14,2 +14,6 @@ 'use strict'; | ||
var parts = req.originalUrl.split('/'); | ||
if (parts[0] === '') { | ||
// Handle paths that start with a slash, i.e., '/foo' -> ['', 'foo'] | ||
parts.shift(); | ||
} | ||
@@ -16,0 +20,0 @@ if (parts.length > options.lookupFromPathIndex) { |
{ | ||
"name": "i18next-express-middleware", | ||
"version": "0.0.16", | ||
"version": "0.0.17", | ||
"description": "express middleware for i18next", | ||
@@ -5,0 +5,0 @@ "main": "./lib/index.js", |
@@ -105,3 +105,3 @@ # Introduction | ||
i18next | ||
.use(middleware.LngDetector) | ||
.use(middleware.LanguageDetector) | ||
.init({ | ||
@@ -116,3 +116,3 @@ detection: options | ||
var middleware = require('i18next-express-middleware'); | ||
var lngDetector = new middleware.LngDetector(null, options); | ||
var lngDetector = new middleware.LanguageDetector(null, options); | ||
``` | ||
@@ -125,3 +125,3 @@ | ||
var lngDetector = new middleware.LngDetector(); | ||
var lngDetector = new middleware.LanguageDetector(); | ||
lngDetector.init(options); | ||
@@ -159,3 +159,3 @@ ``` | ||
var lngDetector = new middleware.LngDetector(); | ||
var lngDetector = new middleware.LanguageDetector(); | ||
lngDetector.addDetector(myDetector); | ||
@@ -162,0 +162,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
21519
397