@fkui/i18next-translate 6.46.0 → 6.47.0
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/dist/cjs/index.js +8 -3
- package/dist/cjs/index.js.map +1 -1
- package/dist/esm/index.js +8 -3
- package/dist/esm/index.js.map +1 -1
- package/package.json +4 -4
package/dist/cjs/index.js
CHANGED
|
@@ -2528,11 +2528,15 @@ function keysFromSelector(selector, opts) {
|
|
|
2528
2528
|
} = selector(createProxy());
|
|
2529
2529
|
const keySeparator = opts?.keySeparator ?? '.';
|
|
2530
2530
|
const nsSeparator = opts?.nsSeparator ?? ':';
|
|
2531
|
+
const strict = opts?.enableSelector === 'strict';
|
|
2531
2532
|
if (path.length > 1 && nsSeparator) {
|
|
2532
2533
|
const ns = opts?.ns;
|
|
2533
|
-
const
|
|
2534
|
-
if (
|
|
2535
|
-
|
|
2534
|
+
const nsList = strict ? Array.isArray(ns) ? ns : ns ? [ns] : null : Array.isArray(ns) ? ns : null;
|
|
2535
|
+
if (nsList) {
|
|
2536
|
+
const candidates = strict ? nsList : nsList.length > 1 ? nsList.slice(1) : [];
|
|
2537
|
+
if (candidates.includes(path[0])) {
|
|
2538
|
+
return `${path[0]}${nsSeparator}${path.slice(1).join(keySeparator)}`;
|
|
2539
|
+
}
|
|
2536
2540
|
}
|
|
2537
2541
|
}
|
|
2538
2542
|
return path.join(keySeparator);
|
|
@@ -3731,6 +3735,7 @@ const get = () => ({
|
|
|
3731
3735
|
nsSeparator: ':',
|
|
3732
3736
|
pluralSeparator: '_',
|
|
3733
3737
|
contextSeparator: '_',
|
|
3738
|
+
enableSelector: false,
|
|
3734
3739
|
partialBundledLanguages: false,
|
|
3735
3740
|
saveMissing: false,
|
|
3736
3741
|
updateMissing: false,
|