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