i18next-http-middleware 2.1.1 → 2.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +3 -0
- package/cjs/LanguageDetector.js +2 -2
- package/lib/LanguageDetector.js +2 -2
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
## [v2.1.2](https://github.com/i18next/i18next-http-middleware/compare/v2.1.1...v2.1.2)
|
|
2
|
+
- fix: get whitelist from correct property
|
|
3
|
+
|
|
1
4
|
## [v2.1.1](https://github.com/i18next/i18next-http-middleware/compare/v2.1.0...v2.1.1)
|
|
2
5
|
- extend httpFunctions getQuery to handle some edge cases
|
|
3
6
|
|
package/cjs/LanguageDetector.js
CHANGED
|
@@ -154,7 +154,7 @@ var LanguageDetector = /*#__PURE__*/function () {
|
|
|
154
154
|
value: function getSimilarInWhitelist(cleanedLng) {
|
|
155
155
|
var _this3 = this;
|
|
156
156
|
|
|
157
|
-
if (!this.
|
|
157
|
+
if (!this.allOptions.whitelist) return;
|
|
158
158
|
|
|
159
159
|
if (cleanedLng.includes('-')) {
|
|
160
160
|
// i.e. es-MX should check if es is in whitelist
|
|
@@ -166,7 +166,7 @@ var LanguageDetector = /*#__PURE__*/function () {
|
|
|
166
166
|
} // i.e. 'pt' should return 'pt-BR'. If multiple in whitelist with 'pt-', then use first one in whitelist
|
|
167
167
|
|
|
168
168
|
|
|
169
|
-
var similar = this.
|
|
169
|
+
var similar = this.allOptions.whitelist.find(function (whitelistLng) {
|
|
170
170
|
var cleanedWhitelistLng = _this3.services.languageUtils.formatLanguageCode(whitelistLng);
|
|
171
171
|
|
|
172
172
|
if (cleanedWhitelistLng.startsWith(cleanedLng)) return cleanedWhitelistLng;
|
package/lib/LanguageDetector.js
CHANGED
|
@@ -107,7 +107,7 @@ class LanguageDetector {
|
|
|
107
107
|
}
|
|
108
108
|
|
|
109
109
|
getSimilarInWhitelist (cleanedLng) {
|
|
110
|
-
if (!this.
|
|
110
|
+
if (!this.allOptions.whitelist) return
|
|
111
111
|
|
|
112
112
|
if (cleanedLng.includes('-')) {
|
|
113
113
|
// i.e. es-MX should check if es is in whitelist
|
|
@@ -122,7 +122,7 @@ class LanguageDetector {
|
|
|
122
122
|
}
|
|
123
123
|
|
|
124
124
|
// i.e. 'pt' should return 'pt-BR'. If multiple in whitelist with 'pt-', then use first one in whitelist
|
|
125
|
-
const similar = this.
|
|
125
|
+
const similar = this.allOptions.whitelist.find((whitelistLng) => {
|
|
126
126
|
const cleanedWhitelistLng = this.services.languageUtils.formatLanguageCode(whitelistLng)
|
|
127
127
|
if (cleanedWhitelistLng.startsWith(cleanedLng)) return cleanedWhitelistLng
|
|
128
128
|
})
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "i18next-http-middleware",
|
|
3
|
-
"version": "2.1.
|
|
3
|
+
"version": "2.1.2",
|
|
4
4
|
"private": false,
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./cjs/index.js",
|
|
@@ -32,7 +32,7 @@
|
|
|
32
32
|
"express": "4.17.1",
|
|
33
33
|
"fastify": "3.0.0-rc.1",
|
|
34
34
|
"i18next": "19.4.5",
|
|
35
|
-
"mocha": "
|
|
35
|
+
"mocha": "8.0.1",
|
|
36
36
|
"supertest": "4.0.2",
|
|
37
37
|
"uglify-js": "3.9.4"
|
|
38
38
|
},
|