i18next-cli 1.41.0 → 1.41.1

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.0'); // This string is replaced with the actual version at build time by rollup
31
+ .version('1.41.1'); // 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
@@ -202,20 +202,29 @@ class CallExpressionHandler {
202
202
  if (!ns)
203
203
  ns = this.config.extract.defaultNS;
204
204
  let finalKey = key;
205
+ let keyPrefix;
206
+ // Check for keyPrefix in call options before falling back to scope
207
+ if (options) {
208
+ const kpVal = astUtils.getObjectPropValue(options, 'keyPrefix');
209
+ if (typeof kpVal === 'string')
210
+ keyPrefix = kpVal;
211
+ }
212
+ // Fall back to scope keyPrefix if not overridden in options
213
+ keyPrefix ||= scopeInfo?.keyPrefix;
205
214
  // Apply keyPrefix AFTER namespace extraction
206
- if (scopeInfo?.keyPrefix) {
215
+ if (keyPrefix) {
207
216
  const keySeparator = this.config.extract.keySeparator ?? '.';
208
217
  // Apply keyPrefix - handle case where keyPrefix already ends with separator
209
218
  if (keySeparator !== false) {
210
- if (scopeInfo.keyPrefix.endsWith(keySeparator)) {
211
- finalKey = `${scopeInfo.keyPrefix}${key}`;
219
+ if (keyPrefix.endsWith(keySeparator)) {
220
+ finalKey = `${keyPrefix}${key}`;
212
221
  }
213
222
  else {
214
- finalKey = `${scopeInfo.keyPrefix}${keySeparator}${key}`;
223
+ finalKey = `${keyPrefix}${keySeparator}${key}`;
215
224
  }
216
225
  }
217
226
  else {
218
- finalKey = `${scopeInfo.keyPrefix}${key}`;
227
+ finalKey = `${keyPrefix}${key}`;
219
228
  }
220
229
  // Validate keyPrefix combinations that create problematic keys
221
230
  if (keySeparator !== false) {
@@ -223,7 +232,7 @@ class CallExpressionHandler {
223
232
  const segments = finalKey.split(keySeparator);
224
233
  const hasEmptySegment = segments.some(segment => segment.trim() === '');
225
234
  if (hasEmptySegment) {
226
- this.logger.warn(`Skipping key with empty segments: '${finalKey}' (keyPrefix: '${scopeInfo.keyPrefix}', key: '${key}')`);
235
+ this.logger.warn(`Skipping key with empty segments: '${finalKey}' (keyPrefix: '${keyPrefix}', key: '${key}')`);
227
236
  continue;
228
237
  }
229
238
  }
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.0'); // This string is replaced with the actual version at build time by rollup
29
+ .version('1.41.1'); // 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
@@ -200,20 +200,29 @@ class CallExpressionHandler {
200
200
  if (!ns)
201
201
  ns = this.config.extract.defaultNS;
202
202
  let finalKey = key;
203
+ let keyPrefix;
204
+ // Check for keyPrefix in call options before falling back to scope
205
+ if (options) {
206
+ const kpVal = getObjectPropValue(options, 'keyPrefix');
207
+ if (typeof kpVal === 'string')
208
+ keyPrefix = kpVal;
209
+ }
210
+ // Fall back to scope keyPrefix if not overridden in options
211
+ keyPrefix ||= scopeInfo?.keyPrefix;
203
212
  // Apply keyPrefix AFTER namespace extraction
204
- if (scopeInfo?.keyPrefix) {
213
+ if (keyPrefix) {
205
214
  const keySeparator = this.config.extract.keySeparator ?? '.';
206
215
  // Apply keyPrefix - handle case where keyPrefix already ends with separator
207
216
  if (keySeparator !== false) {
208
- if (scopeInfo.keyPrefix.endsWith(keySeparator)) {
209
- finalKey = `${scopeInfo.keyPrefix}${key}`;
217
+ if (keyPrefix.endsWith(keySeparator)) {
218
+ finalKey = `${keyPrefix}${key}`;
210
219
  }
211
220
  else {
212
- finalKey = `${scopeInfo.keyPrefix}${keySeparator}${key}`;
221
+ finalKey = `${keyPrefix}${keySeparator}${key}`;
213
222
  }
214
223
  }
215
224
  else {
216
- finalKey = `${scopeInfo.keyPrefix}${key}`;
225
+ finalKey = `${keyPrefix}${key}`;
217
226
  }
218
227
  // Validate keyPrefix combinations that create problematic keys
219
228
  if (keySeparator !== false) {
@@ -221,7 +230,7 @@ class CallExpressionHandler {
221
230
  const segments = finalKey.split(keySeparator);
222
231
  const hasEmptySegment = segments.some(segment => segment.trim() === '');
223
232
  if (hasEmptySegment) {
224
- this.logger.warn(`Skipping key with empty segments: '${finalKey}' (keyPrefix: '${scopeInfo.keyPrefix}', key: '${key}')`);
233
+ this.logger.warn(`Skipping key with empty segments: '${finalKey}' (keyPrefix: '${keyPrefix}', key: '${key}')`);
225
234
  continue;
226
235
  }
227
236
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "i18next-cli",
3
- "version": "1.41.0",
3
+ "version": "1.41.1",
4
4
  "description": "A unified, high-performance i18next CLI.",
5
5
  "type": "module",
6
6
  "bin": {
@@ -1 +1 @@
1
- {"version":3,"file":"call-expression-handler.d.ts","sourceRoot":"","sources":["../../../src/extractor/parsers/call-expression-handler.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAA6C,MAAM,WAAW,CAAA;AAC1F,OAAO,KAAK,EAAE,aAAa,EAAE,oBAAoB,EAAE,MAAM,EAAgB,SAAS,EAAE,MAAM,aAAa,CAAA;AACvG,OAAO,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAA;AAM1D,qBAAa,qBAAqB;IAChC,OAAO,CAAC,aAAa,CAAe;IACpC,OAAO,CAAC,MAAM,CAAuC;IACrD,OAAO,CAAC,MAAM,CAAQ;IACtB,OAAO,CAAC,kBAAkB,CAAoB;IACvC,UAAU,cAAoB;IACrC,OAAO,CAAC,cAAc,CAAc;IACpC,OAAO,CAAC,cAAc,CAAc;IACpC,OAAO,CAAC,eAAe,CAAY;gBAGjC,MAAM,EAAE,IAAI,CAAC,oBAAoB,EAAE,SAAS,CAAC,EAC7C,aAAa,EAAE,aAAa,EAC5B,MAAM,EAAE,MAAM,EACd,kBAAkB,EAAE,kBAAkB,EACtC,cAAc,EAAE,MAAM,MAAM,EAC5B,cAAc,EAAE,MAAM,MAAM;IAU9B;;;OAGG;IACI,gBAAgB,IAAK,IAAI;IAIhC;;;OAGG;IACH,OAAO,CAAC,mBAAmB;IA4C3B;;;;;;;;;;;;;;OAcG;IACH,oBAAoB,CAAE,IAAI,EAAE,cAAc,EAAE,YAAY,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,SAAS,GAAG,SAAS,GAAG,IAAI;IAuXxG;;OAEG;IACH,OAAO,CAAC,iBAAiB;IA4BzB,OAAO,CAAC,oBAAoB;IA6E5B,OAAO,CAAC,wBAAwB;IAyEhC;;;;;;OAMG;IACH,OAAO,CAAC,4BAA4B;IA8BpC;;;;;;;;;;;;;OAaG;IACH,OAAO,CAAC,sBAAsB;IA2C9B;;;;;;;;;;;OAWG;IACH,OAAO,CAAC,gBAAgB;IA6LxB;;;;;;;;;OASG;IACH,OAAO,CAAC,eAAe;CA2BxB"}
1
+ {"version":3,"file":"call-expression-handler.d.ts","sourceRoot":"","sources":["../../../src/extractor/parsers/call-expression-handler.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAA6C,MAAM,WAAW,CAAA;AAC1F,OAAO,KAAK,EAAE,aAAa,EAAE,oBAAoB,EAAE,MAAM,EAAgB,SAAS,EAAE,MAAM,aAAa,CAAA;AACvG,OAAO,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAA;AAM1D,qBAAa,qBAAqB;IAChC,OAAO,CAAC,aAAa,CAAe;IACpC,OAAO,CAAC,MAAM,CAAuC;IACrD,OAAO,CAAC,MAAM,CAAQ;IACtB,OAAO,CAAC,kBAAkB,CAAoB;IACvC,UAAU,cAAoB;IACrC,OAAO,CAAC,cAAc,CAAc;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