next-i18next 13.0.2 → 13.0.3
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.
|
@@ -33,6 +33,7 @@ require("core-js/modules/es.regexp.exec.js");
|
|
|
33
33
|
require("core-js/modules/es.string.replace.js");
|
|
34
34
|
require("core-js/modules/es.array.join.js");
|
|
35
35
|
require("core-js/modules/es.array.map.js");
|
|
36
|
+
require("core-js/modules/es.array.index-of.js");
|
|
36
37
|
require("core-js/modules/es.array.for-each.js");
|
|
37
38
|
var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
|
|
38
39
|
var _typeof2 = _interopRequireDefault(require("@babel/runtime/helpers/typeof"));
|
|
@@ -190,6 +191,7 @@ var createConfig = function createConfig(userConfig) {
|
|
|
190
191
|
// Set server side preload (namespaces)
|
|
191
192
|
//
|
|
192
193
|
if (!combinedConfig.ns && typeof lng !== 'undefined') {
|
|
194
|
+
var _userConfig$interpola5, _userConfig$interpola6, _userConfig$interpola7, _userConfig$interpola8;
|
|
193
195
|
if (typeof localePath === 'function') {
|
|
194
196
|
throw new Error('Must provide all namespaces in ns option if using a function as localePath');
|
|
195
197
|
}
|
|
@@ -228,6 +230,11 @@ var createConfig = function createConfig(userConfig) {
|
|
|
228
230
|
}
|
|
229
231
|
return (0, _utils.unique)(allNamespaces);
|
|
230
232
|
};
|
|
233
|
+
var _prefix = (_userConfig$interpola5 = userConfig === null || userConfig === void 0 ? void 0 : (_userConfig$interpola6 = userConfig.interpolation) === null || _userConfig$interpola6 === void 0 ? void 0 : _userConfig$interpola6.prefix) !== null && _userConfig$interpola5 !== void 0 ? _userConfig$interpola5 : '{{';
|
|
234
|
+
var _suffix = (_userConfig$interpola7 = userConfig === null || userConfig === void 0 ? void 0 : (_userConfig$interpola8 = userConfig.interpolation) === null || _userConfig$interpola8 === void 0 ? void 0 : _userConfig$interpola8.suffix) !== null && _userConfig$interpola7 !== void 0 ? _userConfig$interpola7 : '}}';
|
|
235
|
+
if (localeStructure.indexOf("".concat(_prefix, "lng").concat(_suffix)) > localeStructure.indexOf("".concat(_prefix, "ns").concat(_suffix))) {
|
|
236
|
+
throw new Error('Must provide all namespaces in ns option if using a localeStructure that is not namespace-listable like lng/ns');
|
|
237
|
+
}
|
|
231
238
|
combinedConfig.ns = getNamespaces((0, _utils.unique)([lng].concat((0, _toConsumableArray2["default"])((0, _utils.getFallbackForLng)(lng, combinedConfig.fallbackLng)))));
|
|
232
239
|
}
|
|
233
240
|
}
|
|
@@ -158,6 +158,11 @@ export const createConfig = userConfig => {
|
|
|
158
158
|
}
|
|
159
159
|
return unique(allNamespaces);
|
|
160
160
|
};
|
|
161
|
+
const prefix = userConfig?.interpolation?.prefix ?? '{{';
|
|
162
|
+
const suffix = userConfig?.interpolation?.suffix ?? '}}';
|
|
163
|
+
if (localeStructure.indexOf(`${prefix}lng${suffix}`) > localeStructure.indexOf(`${prefix}ns${suffix}`)) {
|
|
164
|
+
throw new Error('Must provide all namespaces in ns option if using a localeStructure that is not namespace-listable like lng/ns');
|
|
165
|
+
}
|
|
161
166
|
combinedConfig.ns = getNamespaces(unique([lng, ...getFallbackForLng(lng, combinedConfig.fallbackLng)]));
|
|
162
167
|
}
|
|
163
168
|
}
|
|
@@ -154,6 +154,7 @@ export var createConfig = function createConfig(userConfig) {
|
|
|
154
154
|
// Set server side preload (namespaces)
|
|
155
155
|
//
|
|
156
156
|
if (!combinedConfig.ns && typeof lng !== 'undefined') {
|
|
157
|
+
var _userConfig$interpola5, _userConfig$interpola6, _userConfig$interpola7, _userConfig$interpola8;
|
|
157
158
|
if (typeof localePath === 'function') {
|
|
158
159
|
throw new Error('Must provide all namespaces in ns option if using a function as localePath');
|
|
159
160
|
}
|
|
@@ -192,6 +193,11 @@ export var createConfig = function createConfig(userConfig) {
|
|
|
192
193
|
}
|
|
193
194
|
return unique(allNamespaces);
|
|
194
195
|
};
|
|
196
|
+
var _prefix = (_userConfig$interpola5 = userConfig === null || userConfig === void 0 ? void 0 : (_userConfig$interpola6 = userConfig.interpolation) === null || _userConfig$interpola6 === void 0 ? void 0 : _userConfig$interpola6.prefix) !== null && _userConfig$interpola5 !== void 0 ? _userConfig$interpola5 : '{{';
|
|
197
|
+
var _suffix = (_userConfig$interpola7 = userConfig === null || userConfig === void 0 ? void 0 : (_userConfig$interpola8 = userConfig.interpolation) === null || _userConfig$interpola8 === void 0 ? void 0 : _userConfig$interpola8.suffix) !== null && _userConfig$interpola7 !== void 0 ? _userConfig$interpola7 : '}}';
|
|
198
|
+
if (localeStructure.indexOf("".concat(_prefix, "lng").concat(_suffix)) > localeStructure.indexOf("".concat(_prefix, "ns").concat(_suffix))) {
|
|
199
|
+
throw new Error('Must provide all namespaces in ns option if using a localeStructure that is not namespace-listable like lng/ns');
|
|
200
|
+
}
|
|
195
201
|
combinedConfig.ns = getNamespaces(unique([lng].concat(_toConsumableArray(getFallbackForLng(lng, combinedConfig.fallbackLng)))));
|
|
196
202
|
}
|
|
197
203
|
}
|