react-i18next 11.16.1 → 11.16.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/CHANGELOG.md CHANGED
@@ -1,3 +1,7 @@
1
+ ### 11.16.2
2
+
3
+ - update macro to wrap defaults in brackets when necessary [1472](https://github.com/i18next/react-i18next/pull/1472)
4
+
1
5
  ### 11.16.1
2
6
 
3
7
  - types: for context prop of Trans component
package/icu.macro.js CHANGED
@@ -262,9 +262,20 @@ function buildTransElement(
262
262
 
263
263
  // add generated Trans attributes
264
264
  if (!attributeExistsAlready('defaults', finalAttributes))
265
- finalAttributes.push(
266
- t.jSXAttribute(t.jSXIdentifier('defaults'), t.StringLiteral(extracted.defaults)),
267
- );
265
+ if (extracted.defaults.includes(`"`)) {
266
+ // wrap defaults that contain double quotes in brackets
267
+ finalAttributes.push(
268
+ t.jSXAttribute(
269
+ t.jSXIdentifier('defaults'),
270
+ t.jSXExpressionContainer(t.StringLiteral(extracted.defaults)),
271
+ ),
272
+ );
273
+ } else {
274
+ finalAttributes.push(
275
+ t.jSXAttribute(t.jSXIdentifier('defaults'), t.StringLiteral(extracted.defaults)),
276
+ );
277
+ }
278
+
268
279
  if (!attributeExistsAlready('components', finalAttributes))
269
280
  finalAttributes.push(
270
281
  t.jSXAttribute(t.jSXIdentifier('components'), t.jSXExpressionContainer(extracted.components)),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-i18next",
3
- "version": "11.16.1",
3
+ "version": "11.16.2",
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.ts",