i18next-cli 1.51.1 → 1.51.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/dist/cjs/cli.js CHANGED
@@ -31,7 +31,7 @@ const program = new commander.Command();
31
31
  program
32
32
  .name('i18next-cli')
33
33
  .description('A unified, high-performance i18next CLI.')
34
- .version('1.51.1'); // This string is replaced with the actual version at build time by rollup
34
+ .version('1.51.2'); // This string is replaced with the actual version at build time by rollup
35
35
  // new: global config override option
36
36
  program.option('-c, --config <path>', 'Path to i18next-cli config file (overrides detection)');
37
37
  program
@@ -915,9 +915,12 @@ async function getTranslations(keys, objectKeys, config, { syncPrimaryWithDefaul
915
915
  }
916
916
  // When nsSeparator is false, keys resolved to the defaultNS (e.g. from
917
917
  // useTranslation() with no args) should be treated as top-level, not
918
- // wrapped under the namespace name.
918
+ // wrapped under the namespace name — but only when there are no other
919
+ // explicit namespaces. If multiple namespaces exist, we must keep the
920
+ // default namespace wrapper to avoid flattening it into the top level (#227).
919
921
  const defaultNs = String(config.extract.defaultNS ?? 'translation');
920
- const isTopLevel = (nsKey) => nsKey === NO_NS_TOKEN || (config.extract.nsSeparator === false && nsKey === defaultNs);
922
+ const hasOtherNamespaces = [...keysByNS.keys()].some(k => k !== NO_NS_TOKEN && k !== defaultNs);
923
+ const isTopLevel = (nsKey) => nsKey === NO_NS_TOKEN || (config.extract.nsSeparator === false && nsKey === defaultNs && !hasOtherNamespaces);
921
924
  for (const nsKey of namespacesToProcess) {
922
925
  const nsKeys = keysByNS.get(nsKey) || [];
923
926
  if (isTopLevel(nsKey)) {
package/dist/esm/cli.js CHANGED
@@ -29,7 +29,7 @@ const program = new Command();
29
29
  program
30
30
  .name('i18next-cli')
31
31
  .description('A unified, high-performance i18next CLI.')
32
- .version('1.51.1'); // This string is replaced with the actual version at build time by rollup
32
+ .version('1.51.2'); // This string is replaced with the actual version at build time by rollup
33
33
  // new: global config override option
34
34
  program.option('-c, --config <path>', 'Path to i18next-cli config file (overrides detection)');
35
35
  program
@@ -913,9 +913,12 @@ async function getTranslations(keys, objectKeys, config, { syncPrimaryWithDefaul
913
913
  }
914
914
  // When nsSeparator is false, keys resolved to the defaultNS (e.g. from
915
915
  // useTranslation() with no args) should be treated as top-level, not
916
- // wrapped under the namespace name.
916
+ // wrapped under the namespace name — but only when there are no other
917
+ // explicit namespaces. If multiple namespaces exist, we must keep the
918
+ // default namespace wrapper to avoid flattening it into the top level (#227).
917
919
  const defaultNs = String(config.extract.defaultNS ?? 'translation');
918
- const isTopLevel = (nsKey) => nsKey === NO_NS_TOKEN || (config.extract.nsSeparator === false && nsKey === defaultNs);
920
+ const hasOtherNamespaces = [...keysByNS.keys()].some(k => k !== NO_NS_TOKEN && k !== defaultNs);
921
+ const isTopLevel = (nsKey) => nsKey === NO_NS_TOKEN || (config.extract.nsSeparator === false && nsKey === defaultNs && !hasOtherNamespaces);
919
922
  for (const nsKey of namespacesToProcess) {
920
923
  const nsKeys = keysByNS.get(nsKey) || [];
921
924
  if (isTopLevel(nsKey)) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "i18next-cli",
3
- "version": "1.51.1",
3
+ "version": "1.51.2",
4
4
  "description": "A unified, high-performance i18next CLI.",
5
5
  "type": "module",
6
6
  "bin": {
@@ -1 +1 @@
1
- {"version":3,"file":"translation-manager.d.ts","sourceRoot":"","sources":["../../../src/extractor/core/translation-manager.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,YAAY,EAAE,oBAAoB,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAA;AA66B9F;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AACH,wBAAsB,eAAe,CACnC,IAAI,EAAE,GAAG,CAAC,MAAM,EAAE,YAAY,CAAC,EAC/B,UAAU,EAAE,GAAG,CAAC,MAAM,CAAC,EACvB,MAAM,EAAE,oBAAoB,EAC5B,EACE,uBAA+B,EAC/B,OAAe,EACf,MAA4B,EAC7B,GAAE;IACD,uBAAuB,CAAC,EAAE,OAAO,CAAC;IAClC,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,MAAM,CAAC,EAAE,MAAM,CAAA;CACX,GACL,OAAO,CAAC,iBAAiB,EAAE,CAAC,CAoJ9B"}
1
+ {"version":3,"file":"translation-manager.d.ts","sourceRoot":"","sources":["../../../src/extractor/core/translation-manager.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,YAAY,EAAE,oBAAoB,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAA;AA66B9F;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AACH,wBAAsB,eAAe,CACnC,IAAI,EAAE,GAAG,CAAC,MAAM,EAAE,YAAY,CAAC,EAC/B,UAAU,EAAE,GAAG,CAAC,MAAM,CAAC,EACvB,MAAM,EAAE,oBAAoB,EAC5B,EACE,uBAA+B,EAC/B,OAAe,EACf,MAA4B,EAC7B,GAAE;IACD,uBAAuB,CAAC,EAAE,OAAO,CAAC;IAClC,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,MAAM,CAAC,EAAE,MAAM,CAAA;CACX,GACL,OAAO,CAAC,iBAAiB,EAAE,CAAC,CAuJ9B"}