@discord/intl 0.16.1 → 0.17.0-canary.5c5dd4a
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/format.js +2 -1
- package/package.json +2 -2
- package/src/format.ts +2 -1
package/dist/format.js
CHANGED
|
@@ -41,6 +41,7 @@ function bindFormatValuesWithBuilder(builder, nodes, locales, formatters, format
|
|
|
41
41
|
builder.pushLiteralText(nodes[0]);
|
|
42
42
|
return;
|
|
43
43
|
}
|
|
44
|
+
let keyIndex = 0;
|
|
44
45
|
for (const node of nodes) {
|
|
45
46
|
if (typeof node === 'string') {
|
|
46
47
|
builder.pushLiteralText(node);
|
|
@@ -139,7 +140,7 @@ function bindFormatValuesWithBuilder(builder, nodes, locales, formatters, format
|
|
|
139
140
|
if (typeof value !== 'function') {
|
|
140
141
|
throw `expected a function type for a Tag formatting value, ${variableName}. got ${typeof value}: ${value}`;
|
|
141
142
|
}
|
|
142
|
-
let chunks = value(appliedChildren);
|
|
143
|
+
let chunks = value(appliedChildren, `${keyIndex++}`);
|
|
143
144
|
chunks = Array.isArray(chunks) ? chunks : [chunks];
|
|
144
145
|
for (const chunk of chunks) {
|
|
145
146
|
if (typeof chunk === 'string') {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@discord/intl",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.17.0-canary.5c5dd4a",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"description": "Client runtime for managing messages and translations in a React project.",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
"@formatjs/intl": "^2.10.1",
|
|
24
24
|
"@intrnl/xxhash64": "^0.1.2",
|
|
25
25
|
"intl-messageformat": "^10.5.11",
|
|
26
|
-
"@discord/intl-ast": "0.
|
|
26
|
+
"@discord/intl-ast": "0.17.0"
|
|
27
27
|
},
|
|
28
28
|
"devDependencies": {
|
|
29
29
|
"@swc/cli": "^0.3.12",
|
package/src/format.ts
CHANGED
|
@@ -65,6 +65,7 @@ export function bindFormatValuesWithBuilder<
|
|
|
65
65
|
return;
|
|
66
66
|
}
|
|
67
67
|
|
|
68
|
+
let keyIndex = 0;
|
|
68
69
|
for (const node of nodes) {
|
|
69
70
|
if (typeof node === 'string') {
|
|
70
71
|
builder.pushLiteralText(node);
|
|
@@ -189,7 +190,7 @@ export function bindFormatValuesWithBuilder<
|
|
|
189
190
|
if (typeof value !== 'function') {
|
|
190
191
|
throw `expected a function type for a Tag formatting value, ${variableName}. got ${typeof value}: ${value}`;
|
|
191
192
|
}
|
|
192
|
-
let chunks = value(appliedChildren);
|
|
193
|
+
let chunks = value(appliedChildren, `${keyIndex++}`);
|
|
193
194
|
chunks = Array.isArray(chunks) ? chunks : [chunks];
|
|
194
195
|
for (const chunk of chunks) {
|
|
195
196
|
if (typeof chunk === 'string') {
|