@formatjs/cli-lib 7.1.3 → 7.2.0
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.
|
@@ -42,26 +42,34 @@ export async function checkStructuralEquality(translationFilesContents, sourceLo
|
|
|
42
42
|
.filter(([locale]) => locale !== sourceLocale)
|
|
43
43
|
.reduce((result, [locale, content]) => {
|
|
44
44
|
const localeMessages = flatten(content);
|
|
45
|
-
const problematicKeys = Object.keys(enUSMessages)
|
|
45
|
+
const problematicKeys = Object.keys(enUSMessages)
|
|
46
|
+
.map(k => {
|
|
46
47
|
if (!localeMessages[k]) {
|
|
47
|
-
return
|
|
48
|
+
return { key: k, success: true };
|
|
48
49
|
}
|
|
49
50
|
const enUSMessage = enUSMessages[k];
|
|
50
51
|
try {
|
|
51
52
|
const localeMessage = parse(localeMessages[k]);
|
|
52
|
-
return
|
|
53
|
+
return {
|
|
54
|
+
key: k,
|
|
55
|
+
...isStructurallySame(enUSMessage, localeMessage),
|
|
56
|
+
};
|
|
53
57
|
}
|
|
54
58
|
catch (e) {
|
|
55
|
-
|
|
56
|
-
|
|
59
|
+
return {
|
|
60
|
+
key: k,
|
|
61
|
+
success: false,
|
|
62
|
+
error: e instanceof Error ? e : new Error(String(e)),
|
|
63
|
+
};
|
|
57
64
|
}
|
|
58
|
-
})
|
|
65
|
+
})
|
|
66
|
+
.filter(s => !s.success);
|
|
59
67
|
if (!problematicKeys.length) {
|
|
60
68
|
return result;
|
|
61
69
|
}
|
|
62
70
|
writeStderr('---------------------------------\n');
|
|
63
71
|
writeStderr(`These translation keys for locale ${locale} are structurally different from ${sourceLocale}:\n`);
|
|
64
|
-
problematicKeys.forEach(
|
|
72
|
+
problematicKeys.forEach(({ key, error }) => writeStderr(`${key}: ${error?.message}\n`));
|
|
65
73
|
return false;
|
|
66
74
|
}, true);
|
|
67
75
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@formatjs/cli-lib",
|
|
3
|
-
"version": "7.
|
|
3
|
+
"version": "7.2.0",
|
|
4
4
|
"description": "Lib for CLI for formatjs.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"intl",
|
|
@@ -44,9 +44,9 @@
|
|
|
44
44
|
"loud-rejection": "2",
|
|
45
45
|
"tslib": "2",
|
|
46
46
|
"typescript": "5",
|
|
47
|
-
"@formatjs/icu-messageformat-parser": "2.10.1",
|
|
48
47
|
"@formatjs/icu-skeleton-parser": "1.8.12",
|
|
49
|
-
"@formatjs/ts-transformer": "3.13.
|
|
48
|
+
"@formatjs/ts-transformer": "3.13.30",
|
|
49
|
+
"@formatjs/icu-messageformat-parser": "2.11.0"
|
|
50
50
|
},
|
|
51
51
|
"peerDependencies": {
|
|
52
52
|
"@glimmer/env": "^0.1.7",
|