@lingui/cli 6.0.1 → 6.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.
|
@@ -2,9 +2,23 @@ export function mergeCatalog(prevCatalog, nextCatalog, forSourceLocale, options)
|
|
|
2
2
|
prevCatalog = prevCatalog || {};
|
|
3
3
|
const nextKeys = Object.keys(nextCatalog);
|
|
4
4
|
const prevKeys = Object.keys(prevCatalog);
|
|
5
|
-
|
|
6
|
-
const
|
|
7
|
-
|
|
5
|
+
// this part is optimized for performance, see https://github.com/lingui/js-lingui/pull/2540
|
|
6
|
+
const hasKeysInBothCatalogs = prevKeys.length > 0 && nextKeys.length > 0;
|
|
7
|
+
let newKeys;
|
|
8
|
+
let mergeKeys;
|
|
9
|
+
let obsoleteKeys;
|
|
10
|
+
if (hasKeysInBothCatalogs) {
|
|
11
|
+
const prevKeySet = new Set(prevKeys);
|
|
12
|
+
const nextKeySet = new Set(nextKeys);
|
|
13
|
+
newKeys = nextKeys.filter((key) => !prevKeySet.has(key));
|
|
14
|
+
mergeKeys = nextKeys.filter((key) => prevKeySet.has(key));
|
|
15
|
+
obsoleteKeys = prevKeys.filter((key) => !nextKeySet.has(key));
|
|
16
|
+
}
|
|
17
|
+
else {
|
|
18
|
+
newKeys = nextKeys;
|
|
19
|
+
mergeKeys = [];
|
|
20
|
+
obsoleteKeys = prevKeys;
|
|
21
|
+
}
|
|
8
22
|
// Initialize new catalog with new keys
|
|
9
23
|
const newMessages = Object.fromEntries(newKeys.map((key) => [
|
|
10
24
|
key,
|
|
@@ -15,7 +15,7 @@ export declare function init(config: LinguiConfigNormalized, extractionResult: E
|
|
|
15
15
|
} | {
|
|
16
16
|
readonly success: true;
|
|
17
17
|
readonly project: TranslationIoProject;
|
|
18
|
-
readonly errors?:
|
|
18
|
+
readonly errors?: undefined;
|
|
19
19
|
}>;
|
|
20
20
|
export declare function sync(config: LinguiConfigNormalized, options: CliExtractOptions, extractionResult: ExtractionResult): Promise<{
|
|
21
21
|
readonly success: false;
|
|
@@ -24,7 +24,7 @@ export declare function sync(config: LinguiConfigNormalized, options: CliExtract
|
|
|
24
24
|
} | {
|
|
25
25
|
readonly success: true;
|
|
26
26
|
readonly project: TranslationIoProject;
|
|
27
|
-
readonly errors?:
|
|
27
|
+
readonly errors?: undefined;
|
|
28
28
|
}>;
|
|
29
29
|
export declare function writeSegmentsToCatalogs(config: LinguiConfigNormalized, sourceLocale: string, extractionResult: ExtractionResult, segmentsPerLocale: {
|
|
30
30
|
[locale: string]: TranslationIoSegment[];
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lingui/cli",
|
|
3
|
-
"version": "6.0
|
|
3
|
+
"version": "6.2.0",
|
|
4
4
|
"description": "Lingui CLI to extract messages, compile catalogs, and manage translation workflows",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"keywords": [
|
|
@@ -52,12 +52,12 @@
|
|
|
52
52
|
"@babel/generator": "^7.28.5",
|
|
53
53
|
"@babel/parser": "^7.22.0",
|
|
54
54
|
"@babel/types": "^7.21.2",
|
|
55
|
-
"@lingui/babel-plugin-extract-messages": "6.0
|
|
56
|
-
"@lingui/babel-plugin-lingui-macro": "6.0
|
|
57
|
-
"@lingui/conf": "6.0
|
|
58
|
-
"@lingui/core": "6.0
|
|
59
|
-
"@lingui/format-po": "6.0
|
|
60
|
-
"@lingui/message-utils": "6.0
|
|
55
|
+
"@lingui/babel-plugin-extract-messages": "6.2.0",
|
|
56
|
+
"@lingui/babel-plugin-lingui-macro": "6.2.0",
|
|
57
|
+
"@lingui/conf": "6.2.0",
|
|
58
|
+
"@lingui/core": "6.2.0",
|
|
59
|
+
"@lingui/format-po": "6.2.0",
|
|
60
|
+
"@lingui/message-utils": "6.2.0",
|
|
61
61
|
"chokidar": "5.0.0",
|
|
62
62
|
"cli-table3": "^0.6.5",
|
|
63
63
|
"commander": "^14.0.2",
|
|
@@ -81,5 +81,5 @@
|
|
|
81
81
|
"msw": "^2.12.7",
|
|
82
82
|
"vitest": "catalog:"
|
|
83
83
|
},
|
|
84
|
-
"gitHead": "
|
|
84
|
+
"gitHead": "9f2a37bc4a9e3de323b4b9094898e8f05cf05956"
|
|
85
85
|
}
|