i18next-cli 1.41.3 → 1.41.4

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
@@ -28,7 +28,7 @@ const program = new commander.Command();
28
28
  program
29
29
  .name('i18next-cli')
30
30
  .description('A unified, high-performance i18next CLI.')
31
- .version('1.41.3'); // This string is replaced with the actual version at build time by rollup
31
+ .version('1.41.4'); // This string is replaced with the actual version at build time by rollup
32
32
  // new: global config override option
33
33
  program.option('-c, --config <path>', 'Path to i18next-cli config file (overrides detection)');
34
34
  program
@@ -373,7 +373,23 @@ class JSXHandler {
373
373
  generatePluralKeysForTrans(key, defaultValue, ns, isOrdinal, optionsNode, explicitDefaultFromSource, locations, keyAcceptingContext) {
374
374
  try {
375
375
  const type = isOrdinal ? 'ordinal' : 'cardinal';
376
- const pluralCategories = new Intl.PluralRules(this.config.extract?.primaryLanguage, { type }).resolvedOptions().pluralCategories;
376
+ // Generate plural forms for ALL target languages to ensure we have all necessary keys
377
+ // This matches the behavior of generatePluralKeys used for t()
378
+ const allPluralCategories = new Set();
379
+ for (const locale of this.config.locales) {
380
+ try {
381
+ const pluralRules = new Intl.PluralRules(locale, { type });
382
+ const categories = pluralRules.resolvedOptions().pluralCategories;
383
+ categories.forEach(cat => allPluralCategories.add(cat));
384
+ }
385
+ catch (e) {
386
+ // If a locale is invalid, fall back to English rules
387
+ const englishRules = new Intl.PluralRules('en', { type });
388
+ const categories = englishRules.resolvedOptions().pluralCategories;
389
+ categories.forEach(cat => allPluralCategories.add(cat));
390
+ }
391
+ }
392
+ const pluralCategories = Array.from(allPluralCategories).sort();
377
393
  const pluralSeparator = this.config.extract.pluralSeparator ?? '_';
378
394
  // Get plural-specific default values from tOptions if available
379
395
  let otherDefault;
package/dist/esm/cli.js CHANGED
@@ -26,7 +26,7 @@ const program = new Command();
26
26
  program
27
27
  .name('i18next-cli')
28
28
  .description('A unified, high-performance i18next CLI.')
29
- .version('1.41.3'); // This string is replaced with the actual version at build time by rollup
29
+ .version('1.41.4'); // This string is replaced with the actual version at build time by rollup
30
30
  // new: global config override option
31
31
  program.option('-c, --config <path>', 'Path to i18next-cli config file (overrides detection)');
32
32
  program
@@ -371,7 +371,23 @@ class JSXHandler {
371
371
  generatePluralKeysForTrans(key, defaultValue, ns, isOrdinal, optionsNode, explicitDefaultFromSource, locations, keyAcceptingContext) {
372
372
  try {
373
373
  const type = isOrdinal ? 'ordinal' : 'cardinal';
374
- const pluralCategories = new Intl.PluralRules(this.config.extract?.primaryLanguage, { type }).resolvedOptions().pluralCategories;
374
+ // Generate plural forms for ALL target languages to ensure we have all necessary keys
375
+ // This matches the behavior of generatePluralKeys used for t()
376
+ const allPluralCategories = new Set();
377
+ for (const locale of this.config.locales) {
378
+ try {
379
+ const pluralRules = new Intl.PluralRules(locale, { type });
380
+ const categories = pluralRules.resolvedOptions().pluralCategories;
381
+ categories.forEach(cat => allPluralCategories.add(cat));
382
+ }
383
+ catch (e) {
384
+ // If a locale is invalid, fall back to English rules
385
+ const englishRules = new Intl.PluralRules('en', { type });
386
+ const categories = englishRules.resolvedOptions().pluralCategories;
387
+ categories.forEach(cat => allPluralCategories.add(cat));
388
+ }
389
+ }
390
+ const pluralCategories = Array.from(allPluralCategories).sort();
375
391
  const pluralSeparator = this.config.extract.pluralSeparator ?? '_';
376
392
  // Get plural-specific default values from tOptions if available
377
393
  let otherDefault;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "i18next-cli",
3
- "version": "1.41.3",
3
+ "version": "1.41.4",
4
4
  "description": "A unified, high-performance i18next CLI.",
5
5
  "type": "module",
6
6
  "bin": {
@@ -1 +1 @@
1
- {"version":3,"file":"jsx-handler.d.ts","sourceRoot":"","sources":["../../../src/extractor/parsers/jsx-handler.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAoB,MAAM,WAAW,CAAA;AAC7D,OAAO,KAAK,EAAE,aAAa,EA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