react-i18next 16.1.2 → 16.1.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/CHANGELOG.md CHANGED
@@ -1,3 +1,11 @@
1
+ ### 16.1.4
2
+
3
+ - fix: detect pre-transformation use of interpolation like number/date/etc. [1875](https://github.com/i18next/react-i18next/pull/1875)
4
+
5
+ ### 16.1.3
6
+
7
+ - fix: ensure invalid identifiers are quoted in the props object [1874](https://github.com/i18next/react-i18next/pull/1874)
8
+
1
9
  ### 16.1.2
2
10
 
3
11
  - missing.js extensions for Icu imports
@@ -1 +1 @@
1
- {"type":"module","version":"16.1.2"}
1
+ {"type":"module","version":"16.1.4"}
package/icu.macro.js CHANGED
@@ -86,9 +86,12 @@ function ICUMacro({ references, state, babel }) {
86
86
  const elementName = openingElement.name;
87
87
  const isMemberExpression = babel.types.isJSXMemberExpression(elementName);
88
88
 
89
- if (!isMemberExpression && elementName.name === 'IcuTrans') {
89
+ if (
90
+ !isMemberExpression &&
91
+ (elementName.name === 'IcuTrans' || elementName.name === 'Trans')
92
+ ) {
90
93
  // this is a valid use of number/date/time/etc.
91
- // Only check IcuTrans since Trans transformation (lines 57-71) happens before this validation
94
+ // Check for both IcuTrans (after transformation) and Trans (during transformation)
92
95
  return;
93
96
  }
94
97
  }
@@ -364,7 +367,12 @@ function jsxElementToDeclaration(jsxElement, t) {
364
367
  propValue = t.nullLiteral();
365
368
  }
366
369
 
367
- propsProperties.push(t.objectProperty(t.identifier(propName), propValue));
370
+ // Use string literal for keys that aren't valid identifiers (e.g., contain hyphens)
371
+ const propKey = /^[a-zA-Z_$][a-zA-Z0-9_$]*$/.test(propName)
372
+ ? t.identifier(propName)
373
+ : t.stringLiteral(propName);
374
+
375
+ propsProperties.push(t.objectProperty(propKey, propValue));
368
376
  }
369
377
  });
370
378
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-i18next",
3
- "version": "16.1.2",
3
+ "version": "16.1.4",
4
4
  "description": "Internationalization for react done right. Using the i18next i18n ecosystem.",
5
5
  "main": "dist/commonjs/index.js",
6
6
  "types": "./index.d.mts",