@langapi/mcp-server 1.0.7 → 1.1.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.
- package/dist/handlers/index.d.ts +7 -0
- package/dist/handlers/index.d.ts.map +1 -0
- package/dist/handlers/index.js +7 -0
- package/dist/handlers/index.js.map +1 -0
- package/dist/handlers/xcstrings-sync-handler.d.ts +72 -0
- package/dist/handlers/xcstrings-sync-handler.d.ts.map +1 -0
- package/dist/handlers/xcstrings-sync-handler.js +126 -0
- package/dist/handlers/xcstrings-sync-handler.js.map +1 -0
- package/dist/locale-detection/index.d.ts.map +1 -1
- package/dist/locale-detection/index.js +68 -4
- package/dist/locale-detection/index.js.map +1 -1
- package/dist/locale-detection/patterns.d.ts.map +1 -1
- package/dist/locale-detection/patterns.js +30 -0
- package/dist/locale-detection/patterns.js.map +1 -1
- package/dist/tools/get-translation-status.d.ts.map +1 -1
- package/dist/tools/get-translation-status.js +34 -6
- package/dist/tools/get-translation-status.js.map +1 -1
- package/dist/tools/list-local-locales.d.ts +1 -1
- package/dist/tools/list-local-locales.js +2 -2
- package/dist/tools/list-local-locales.js.map +1 -1
- package/dist/tools/sync-translations.d.ts.map +1 -1
- package/dist/tools/sync-translations.js +199 -40
- package/dist/tools/sync-translations.js.map +1 -1
- package/dist/utils/apple-common.d.ts +63 -0
- package/dist/utils/apple-common.d.ts.map +1 -0
- package/dist/utils/apple-common.js +118 -0
- package/dist/utils/apple-common.js.map +1 -0
- package/dist/utils/apple-common.test.d.ts +2 -0
- package/dist/utils/apple-common.test.d.ts.map +1 -0
- package/dist/utils/apple-common.test.js +108 -0
- package/dist/utils/apple-common.test.js.map +1 -0
- package/dist/utils/strings-parser.d.ts +62 -0
- package/dist/utils/strings-parser.d.ts.map +1 -0
- package/dist/utils/strings-parser.js +276 -0
- package/dist/utils/strings-parser.js.map +1 -0
- package/dist/utils/strings-parser.test.d.ts +2 -0
- package/dist/utils/strings-parser.test.d.ts.map +1 -0
- package/dist/utils/strings-parser.test.js +143 -0
- package/dist/utils/strings-parser.test.js.map +1 -0
- package/dist/utils/stringsdict-parser.d.ts +106 -0
- package/dist/utils/stringsdict-parser.d.ts.map +1 -0
- package/dist/utils/stringsdict-parser.js +473 -0
- package/dist/utils/stringsdict-parser.js.map +1 -0
- package/dist/utils/stringsdict-parser.test.d.ts +2 -0
- package/dist/utils/stringsdict-parser.test.d.ts.map +1 -0
- package/dist/utils/stringsdict-parser.test.js +244 -0
- package/dist/utils/stringsdict-parser.test.js.map +1 -0
- package/dist/utils/xcstrings-parser.d.ts +128 -0
- package/dist/utils/xcstrings-parser.d.ts.map +1 -0
- package/dist/utils/xcstrings-parser.js +216 -0
- package/dist/utils/xcstrings-parser.js.map +1 -0
- package/dist/utils/xcstrings-parser.test.d.ts +2 -0
- package/dist/utils/xcstrings-parser.test.d.ts.map +1 -0
- package/dist/utils/xcstrings-parser.test.js +157 -0
- package/dist/utils/xcstrings-parser.test.js.map +1 -0
- package/package.json +1 -1
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Stringsdict (.stringsdict) file parser
|
|
3
|
+
*
|
|
4
|
+
* Stringsdict files are XML plist files used for pluralization and
|
|
5
|
+
* gender rules in iOS/macOS applications.
|
|
6
|
+
*
|
|
7
|
+
* Structure:
|
|
8
|
+
* <dict>
|
|
9
|
+
* <key>items_count</key>
|
|
10
|
+
* <dict>
|
|
11
|
+
* <key>NSStringLocalizedFormatKey</key>
|
|
12
|
+
* <string>%#@count@</string>
|
|
13
|
+
* <key>count</key>
|
|
14
|
+
* <dict>
|
|
15
|
+
* <key>NSStringFormatSpecTypeKey</key>
|
|
16
|
+
* <string>NSStringPluralRuleType</string>
|
|
17
|
+
* <key>one</key>
|
|
18
|
+
* <string>%d item</string>
|
|
19
|
+
* <key>other</key>
|
|
20
|
+
* <string>%d items</string>
|
|
21
|
+
* </dict>
|
|
22
|
+
* </dict>
|
|
23
|
+
* </dict>
|
|
24
|
+
*/
|
|
25
|
+
import type { KeyValue } from "../api/types.js";
|
|
26
|
+
/**
|
|
27
|
+
* Plural variant types supported by iOS
|
|
28
|
+
*/
|
|
29
|
+
export type PluralVariant = "zero" | "one" | "two" | "few" | "many" | "other";
|
|
30
|
+
/**
|
|
31
|
+
* All possible plural variants
|
|
32
|
+
*/
|
|
33
|
+
export declare const PLURAL_VARIANTS: PluralVariant[];
|
|
34
|
+
/**
|
|
35
|
+
* Plural rule definition for a single variable
|
|
36
|
+
*/
|
|
37
|
+
export interface PluralRule {
|
|
38
|
+
/** The format spec type (usually NSStringPluralRuleType) */
|
|
39
|
+
specTypeKey: string;
|
|
40
|
+
/** Optional format value type */
|
|
41
|
+
formatValueTypeKey?: string;
|
|
42
|
+
/** Plural variant values: zero, one, two, few, many, other */
|
|
43
|
+
variants: Partial<Record<PluralVariant, string>>;
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* A single stringsdict entry with its plural rules
|
|
47
|
+
*/
|
|
48
|
+
export interface StringsDictEntry {
|
|
49
|
+
/** The key name (e.g., "items_count") */
|
|
50
|
+
key: string;
|
|
51
|
+
/** The NSStringLocalizedFormatKey value (e.g., "%#@count@") */
|
|
52
|
+
formatKey: string;
|
|
53
|
+
/** Plural rules keyed by variable name (e.g., "count") */
|
|
54
|
+
pluralRules: Record<string, PluralRule>;
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* Parsed content from a .stringsdict file
|
|
58
|
+
*/
|
|
59
|
+
export interface StringsDictContent {
|
|
60
|
+
/** Parsed entries */
|
|
61
|
+
entries: StringsDictEntry[];
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* Parse a .stringsdict file content
|
|
65
|
+
*
|
|
66
|
+
* @param content Raw XML content
|
|
67
|
+
* @returns Parsed content or null if invalid
|
|
68
|
+
*/
|
|
69
|
+
export declare function parseStringsDictContent(content: string): StringsDictContent | null;
|
|
70
|
+
/**
|
|
71
|
+
* Flatten stringsdict entries for API translation
|
|
72
|
+
*
|
|
73
|
+
* Converts plural entries to flat key-value pairs using dot notation:
|
|
74
|
+
* - "items_count.one" = "%d item"
|
|
75
|
+
* - "items_count.other" = "%d items"
|
|
76
|
+
*
|
|
77
|
+
* @param entries Stringsdict entries
|
|
78
|
+
* @returns Flattened key-value pairs
|
|
79
|
+
*/
|
|
80
|
+
export declare function flattenStringsDictForApi(entries: StringsDictEntry[]): KeyValue[];
|
|
81
|
+
/**
|
|
82
|
+
* Unflatten API translations back to stringsdict structure
|
|
83
|
+
*
|
|
84
|
+
* @param translations Flattened translations from API
|
|
85
|
+
* @param sourceEntries Source stringsdict entries (for structure reference)
|
|
86
|
+
* @returns Reconstructed stringsdict entries
|
|
87
|
+
*/
|
|
88
|
+
export declare function unflattenStringsDictFromApi(translations: KeyValue[], sourceEntries: StringsDictEntry[]): StringsDictEntry[];
|
|
89
|
+
/**
|
|
90
|
+
* Reconstruct a .stringsdict file from entries
|
|
91
|
+
*
|
|
92
|
+
* @param entries Stringsdict entries
|
|
93
|
+
* @returns Valid XML plist content
|
|
94
|
+
*/
|
|
95
|
+
export declare function reconstructStringsDictContent(entries: StringsDictEntry[]): string;
|
|
96
|
+
/**
|
|
97
|
+
* Merge new translations into existing stringsdict content
|
|
98
|
+
*
|
|
99
|
+
* @param existingContent Existing target file content (raw XML)
|
|
100
|
+
* @param newTranslations New/updated translations (flattened format)
|
|
101
|
+
* @param sourceEntries Source stringsdict entries (for structure)
|
|
102
|
+
* @param sourceKeys Set of all entry keys in source
|
|
103
|
+
* @returns Merged stringsdict XML content
|
|
104
|
+
*/
|
|
105
|
+
export declare function mergeStringsDictContent(existingContent: string, newTranslations: KeyValue[], sourceEntries: StringsDictEntry[], sourceKeys: Set<string>): string;
|
|
106
|
+
//# sourceMappingURL=stringsdict-parser.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"stringsdict-parser.d.ts","sourceRoot":"","sources":["../../src/utils/stringsdict-parser.ts"],"names":[],"mappings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MAAM,CAgDR;AAED;;;;;;;;GAQG;AACH,wBAAgB,uBAAuB,CACrC,eAAe,EAAE,MAAM,EACvB,eAAe,EAAE,QAAQ,EAAE,EAC3B,aAAa,EAAE,gBAAgB,EAAE,EACjC,UAAU,EAAE,GAAG,CAAC,MAAM,CAAC,GACtB,MAAM,CAqER"}
|
|
@@ -0,0 +1,473 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Stringsdict (.stringsdict) file parser
|
|
3
|
+
*
|
|
4
|
+
* Stringsdict files are XML plist files used for pluralization and
|
|
5
|
+
* gender rules in iOS/macOS applications.
|
|
6
|
+
*
|
|
7
|
+
* Structure:
|
|
8
|
+
* <dict>
|
|
9
|
+
* <key>items_count</key>
|
|
10
|
+
* <dict>
|
|
11
|
+
* <key>NSStringLocalizedFormatKey</key>
|
|
12
|
+
* <string>%#@count@</string>
|
|
13
|
+
* <key>count</key>
|
|
14
|
+
* <dict>
|
|
15
|
+
* <key>NSStringFormatSpecTypeKey</key>
|
|
16
|
+
* <string>NSStringPluralRuleType</string>
|
|
17
|
+
* <key>one</key>
|
|
18
|
+
* <string>%d item</string>
|
|
19
|
+
* <key>other</key>
|
|
20
|
+
* <string>%d items</string>
|
|
21
|
+
* </dict>
|
|
22
|
+
* </dict>
|
|
23
|
+
* </dict>
|
|
24
|
+
*/
|
|
25
|
+
/**
|
|
26
|
+
* All possible plural variants
|
|
27
|
+
*/
|
|
28
|
+
export const PLURAL_VARIANTS = [
|
|
29
|
+
"zero",
|
|
30
|
+
"one",
|
|
31
|
+
"two",
|
|
32
|
+
"few",
|
|
33
|
+
"many",
|
|
34
|
+
"other",
|
|
35
|
+
];
|
|
36
|
+
/**
|
|
37
|
+
* Parse a .stringsdict file content
|
|
38
|
+
*
|
|
39
|
+
* @param content Raw XML content
|
|
40
|
+
* @returns Parsed content or null if invalid
|
|
41
|
+
*/
|
|
42
|
+
export function parseStringsDictContent(content) {
|
|
43
|
+
try {
|
|
44
|
+
const entries = [];
|
|
45
|
+
// Parse XML plist structure - find the root dict
|
|
46
|
+
const plistMatch = content.match(/<plist[^>]*>([\s\S]*)<\/plist>/i);
|
|
47
|
+
if (!plistMatch) {
|
|
48
|
+
return null;
|
|
49
|
+
}
|
|
50
|
+
const plistContent = plistMatch[1];
|
|
51
|
+
// Find the root dict content using balanced matching
|
|
52
|
+
const rootDictContent = extractDictContent(plistContent);
|
|
53
|
+
if (!rootDictContent) {
|
|
54
|
+
return null;
|
|
55
|
+
}
|
|
56
|
+
// Parse root level key-dict pairs
|
|
57
|
+
const rootPairs = parseRootDictPairs(rootDictContent);
|
|
58
|
+
for (const [entryKey, entryContent] of rootPairs) {
|
|
59
|
+
const entry = parseEntryDict(entryKey, entryContent);
|
|
60
|
+
if (entry) {
|
|
61
|
+
entries.push(entry);
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
return { entries };
|
|
65
|
+
}
|
|
66
|
+
catch {
|
|
67
|
+
return null;
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
/**
|
|
71
|
+
* Extract content between <dict> and </dict> tags, handling nesting
|
|
72
|
+
*/
|
|
73
|
+
function extractDictContent(content) {
|
|
74
|
+
const startMatch = content.match(/<dict>/i);
|
|
75
|
+
if (!startMatch || startMatch.index === undefined) {
|
|
76
|
+
return null;
|
|
77
|
+
}
|
|
78
|
+
const start = startMatch.index + 6; // length of "<dict>"
|
|
79
|
+
let depth = 1;
|
|
80
|
+
let pos = start;
|
|
81
|
+
while (pos < content.length && depth > 0) {
|
|
82
|
+
const nextOpen = content.indexOf("<dict>", pos);
|
|
83
|
+
const nextClose = content.indexOf("</dict>", pos);
|
|
84
|
+
if (nextClose === -1) {
|
|
85
|
+
return null; // Unbalanced
|
|
86
|
+
}
|
|
87
|
+
if (nextOpen !== -1 && nextOpen < nextClose) {
|
|
88
|
+
depth++;
|
|
89
|
+
pos = nextOpen + 6;
|
|
90
|
+
}
|
|
91
|
+
else {
|
|
92
|
+
depth--;
|
|
93
|
+
if (depth === 0) {
|
|
94
|
+
return content.slice(start, nextClose);
|
|
95
|
+
}
|
|
96
|
+
pos = nextClose + 7;
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
return null;
|
|
100
|
+
}
|
|
101
|
+
/**
|
|
102
|
+
* Parse root-level key-dict pairs from dict content
|
|
103
|
+
*/
|
|
104
|
+
function parseRootDictPairs(content) {
|
|
105
|
+
const pairs = [];
|
|
106
|
+
let pos = 0;
|
|
107
|
+
while (pos < content.length) {
|
|
108
|
+
// Find next <key>
|
|
109
|
+
const keyMatch = content.slice(pos).match(/<key>([^<]+)<\/key>/i);
|
|
110
|
+
if (!keyMatch || keyMatch.index === undefined) {
|
|
111
|
+
break;
|
|
112
|
+
}
|
|
113
|
+
const keyName = decodeXmlEntities(keyMatch[1]);
|
|
114
|
+
pos += keyMatch.index + keyMatch[0].length;
|
|
115
|
+
// Skip whitespace
|
|
116
|
+
while (pos < content.length && /\s/.test(content[pos])) {
|
|
117
|
+
pos++;
|
|
118
|
+
}
|
|
119
|
+
// Check if next element is <dict>
|
|
120
|
+
if (content.slice(pos, pos + 6).toLowerCase() === "<dict>") {
|
|
121
|
+
// Find matching </dict>
|
|
122
|
+
const dictStart = pos + 6;
|
|
123
|
+
let depth = 1;
|
|
124
|
+
let dictPos = dictStart;
|
|
125
|
+
while (dictPos < content.length && depth > 0) {
|
|
126
|
+
const nextOpen = content.indexOf("<dict>", dictPos);
|
|
127
|
+
const nextClose = content.indexOf("</dict>", dictPos);
|
|
128
|
+
if (nextClose === -1)
|
|
129
|
+
break;
|
|
130
|
+
if (nextOpen !== -1 && nextOpen < nextClose) {
|
|
131
|
+
depth++;
|
|
132
|
+
dictPos = nextOpen + 6;
|
|
133
|
+
}
|
|
134
|
+
else {
|
|
135
|
+
depth--;
|
|
136
|
+
if (depth === 0) {
|
|
137
|
+
const dictContent = content.slice(dictStart, nextClose);
|
|
138
|
+
pairs.push([keyName, dictContent]);
|
|
139
|
+
pos = nextClose + 7;
|
|
140
|
+
}
|
|
141
|
+
else {
|
|
142
|
+
dictPos = nextClose + 7;
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
return pairs;
|
|
149
|
+
}
|
|
150
|
+
/**
|
|
151
|
+
* Parse an entry dict content
|
|
152
|
+
*/
|
|
153
|
+
function parseEntryDict(key, content) {
|
|
154
|
+
const pluralRules = {};
|
|
155
|
+
let formatKey = "";
|
|
156
|
+
// Extract all key-value pairs from the dict
|
|
157
|
+
const pairs = extractDictPairs(content);
|
|
158
|
+
for (const [pairKey, pairValue] of pairs) {
|
|
159
|
+
if (pairKey === "NSStringLocalizedFormatKey" && typeof pairValue === "string") {
|
|
160
|
+
formatKey = pairValue;
|
|
161
|
+
}
|
|
162
|
+
else if (typeof pairValue === "object" && pairValue !== null) {
|
|
163
|
+
// This is a plural rule dict
|
|
164
|
+
const rule = parsePluralRuleDict(pairValue);
|
|
165
|
+
if (rule) {
|
|
166
|
+
pluralRules[pairKey] = rule;
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
if (!formatKey) {
|
|
171
|
+
return null;
|
|
172
|
+
}
|
|
173
|
+
return { key, formatKey, pluralRules };
|
|
174
|
+
}
|
|
175
|
+
/**
|
|
176
|
+
* Extract key-value pairs from a dict element
|
|
177
|
+
*/
|
|
178
|
+
function extractDictPairs(content) {
|
|
179
|
+
const pairs = [];
|
|
180
|
+
let pos = 0;
|
|
181
|
+
while (pos < content.length) {
|
|
182
|
+
// Find next <key>
|
|
183
|
+
const keyMatch = content.slice(pos).match(/<key>([^<]+)<\/key>/i);
|
|
184
|
+
if (!keyMatch || keyMatch.index === undefined) {
|
|
185
|
+
break;
|
|
186
|
+
}
|
|
187
|
+
const pairKey = decodeXmlEntities(keyMatch[1]);
|
|
188
|
+
pos += keyMatch.index + keyMatch[0].length;
|
|
189
|
+
// Skip whitespace
|
|
190
|
+
while (pos < content.length && /\s/.test(content[pos])) {
|
|
191
|
+
pos++;
|
|
192
|
+
}
|
|
193
|
+
// Check what type of value follows
|
|
194
|
+
if (content.slice(pos, pos + 8).toLowerCase() === "<string>") {
|
|
195
|
+
// String value
|
|
196
|
+
const stringMatch = content.slice(pos).match(/<string>([^<]*)<\/string>/i);
|
|
197
|
+
if (stringMatch) {
|
|
198
|
+
pairs.push([pairKey, decodeXmlEntities(stringMatch[1])]);
|
|
199
|
+
pos += stringMatch[0].length;
|
|
200
|
+
}
|
|
201
|
+
}
|
|
202
|
+
else if (content.slice(pos, pos + 6).toLowerCase() === "<dict>") {
|
|
203
|
+
// Dict value - find matching </dict>
|
|
204
|
+
const dictStart = pos + 6;
|
|
205
|
+
let depth = 1;
|
|
206
|
+
let dictPos = dictStart;
|
|
207
|
+
while (dictPos < content.length && depth > 0) {
|
|
208
|
+
const nextOpen = content.indexOf("<dict>", dictPos);
|
|
209
|
+
const nextClose = content.indexOf("</dict>", dictPos);
|
|
210
|
+
if (nextClose === -1)
|
|
211
|
+
break;
|
|
212
|
+
if (nextOpen !== -1 && nextOpen < nextClose) {
|
|
213
|
+
depth++;
|
|
214
|
+
dictPos = nextOpen + 6;
|
|
215
|
+
}
|
|
216
|
+
else {
|
|
217
|
+
depth--;
|
|
218
|
+
if (depth === 0) {
|
|
219
|
+
const nestedContent = content.slice(dictStart, nextClose);
|
|
220
|
+
// Recursively parse nested dict
|
|
221
|
+
const nestedPairs = extractDictPairs(nestedContent);
|
|
222
|
+
const nestedDict = {};
|
|
223
|
+
for (const [k, v] of nestedPairs) {
|
|
224
|
+
if (typeof v === "string") {
|
|
225
|
+
nestedDict[k] = v;
|
|
226
|
+
}
|
|
227
|
+
}
|
|
228
|
+
pairs.push([pairKey, nestedDict]);
|
|
229
|
+
pos = nextClose + 7;
|
|
230
|
+
}
|
|
231
|
+
else {
|
|
232
|
+
dictPos = nextClose + 7;
|
|
233
|
+
}
|
|
234
|
+
}
|
|
235
|
+
}
|
|
236
|
+
}
|
|
237
|
+
else {
|
|
238
|
+
// Unknown element, skip ahead
|
|
239
|
+
pos++;
|
|
240
|
+
}
|
|
241
|
+
}
|
|
242
|
+
return pairs;
|
|
243
|
+
}
|
|
244
|
+
/**
|
|
245
|
+
* Parse a plural rule dict
|
|
246
|
+
*/
|
|
247
|
+
function parsePluralRuleDict(dict) {
|
|
248
|
+
const specTypeKey = dict["NSStringFormatSpecTypeKey"];
|
|
249
|
+
if (!specTypeKey) {
|
|
250
|
+
return null;
|
|
251
|
+
}
|
|
252
|
+
const variants = {};
|
|
253
|
+
for (const variant of PLURAL_VARIANTS) {
|
|
254
|
+
if (dict[variant]) {
|
|
255
|
+
variants[variant] = dict[variant];
|
|
256
|
+
}
|
|
257
|
+
}
|
|
258
|
+
return {
|
|
259
|
+
specTypeKey,
|
|
260
|
+
formatValueTypeKey: dict["NSStringFormatValueTypeKey"],
|
|
261
|
+
variants,
|
|
262
|
+
};
|
|
263
|
+
}
|
|
264
|
+
/**
|
|
265
|
+
* Decode XML entities
|
|
266
|
+
*/
|
|
267
|
+
function decodeXmlEntities(text) {
|
|
268
|
+
return text
|
|
269
|
+
.replace(/</g, "<")
|
|
270
|
+
.replace(/>/g, ">")
|
|
271
|
+
.replace(/&/g, "&")
|
|
272
|
+
.replace(/'/g, "'")
|
|
273
|
+
.replace(/"/g, '"');
|
|
274
|
+
}
|
|
275
|
+
/**
|
|
276
|
+
* Encode XML entities
|
|
277
|
+
*/
|
|
278
|
+
function encodeXmlEntities(text) {
|
|
279
|
+
return text
|
|
280
|
+
.replace(/&/g, "&")
|
|
281
|
+
.replace(/</g, "<")
|
|
282
|
+
.replace(/>/g, ">")
|
|
283
|
+
.replace(/'/g, "'")
|
|
284
|
+
.replace(/"/g, """);
|
|
285
|
+
}
|
|
286
|
+
/**
|
|
287
|
+
* Flatten stringsdict entries for API translation
|
|
288
|
+
*
|
|
289
|
+
* Converts plural entries to flat key-value pairs using dot notation:
|
|
290
|
+
* - "items_count.one" = "%d item"
|
|
291
|
+
* - "items_count.other" = "%d items"
|
|
292
|
+
*
|
|
293
|
+
* @param entries Stringsdict entries
|
|
294
|
+
* @returns Flattened key-value pairs
|
|
295
|
+
*/
|
|
296
|
+
export function flattenStringsDictForApi(entries) {
|
|
297
|
+
const result = [];
|
|
298
|
+
for (const entry of entries) {
|
|
299
|
+
// Add format key (usually contains format specifiers)
|
|
300
|
+
result.push({
|
|
301
|
+
key: `${entry.key}.__formatKey`,
|
|
302
|
+
value: entry.formatKey,
|
|
303
|
+
});
|
|
304
|
+
// Add plural variants
|
|
305
|
+
for (const [ruleName, rule] of Object.entries(entry.pluralRules)) {
|
|
306
|
+
for (const [variant, value] of Object.entries(rule.variants)) {
|
|
307
|
+
result.push({
|
|
308
|
+
key: `${entry.key}.${ruleName}.${variant}`,
|
|
309
|
+
value,
|
|
310
|
+
});
|
|
311
|
+
}
|
|
312
|
+
}
|
|
313
|
+
}
|
|
314
|
+
return result;
|
|
315
|
+
}
|
|
316
|
+
/**
|
|
317
|
+
* Unflatten API translations back to stringsdict structure
|
|
318
|
+
*
|
|
319
|
+
* @param translations Flattened translations from API
|
|
320
|
+
* @param sourceEntries Source stringsdict entries (for structure reference)
|
|
321
|
+
* @returns Reconstructed stringsdict entries
|
|
322
|
+
*/
|
|
323
|
+
export function unflattenStringsDictFromApi(translations, sourceEntries) {
|
|
324
|
+
// Create a map for quick lookup
|
|
325
|
+
const translationsMap = new Map();
|
|
326
|
+
for (const { key, value } of translations) {
|
|
327
|
+
translationsMap.set(key, value);
|
|
328
|
+
}
|
|
329
|
+
// Reconstruct entries following source structure
|
|
330
|
+
const result = [];
|
|
331
|
+
for (const sourceEntry of sourceEntries) {
|
|
332
|
+
const formatKey = translationsMap.get(`${sourceEntry.key}.__formatKey`) ||
|
|
333
|
+
sourceEntry.formatKey;
|
|
334
|
+
const pluralRules = {};
|
|
335
|
+
for (const [ruleName, sourceRule] of Object.entries(sourceEntry.pluralRules)) {
|
|
336
|
+
const variants = {};
|
|
337
|
+
for (const variant of PLURAL_VARIANTS) {
|
|
338
|
+
const translatedKey = `${sourceEntry.key}.${ruleName}.${variant}`;
|
|
339
|
+
const translated = translationsMap.get(translatedKey);
|
|
340
|
+
const sourceValue = sourceRule.variants[variant];
|
|
341
|
+
if (translated !== undefined) {
|
|
342
|
+
variants[variant] = translated;
|
|
343
|
+
}
|
|
344
|
+
else if (sourceValue !== undefined) {
|
|
345
|
+
// Keep source value if no translation
|
|
346
|
+
variants[variant] = sourceValue;
|
|
347
|
+
}
|
|
348
|
+
}
|
|
349
|
+
pluralRules[ruleName] = {
|
|
350
|
+
specTypeKey: sourceRule.specTypeKey,
|
|
351
|
+
formatValueTypeKey: sourceRule.formatValueTypeKey,
|
|
352
|
+
variants,
|
|
353
|
+
};
|
|
354
|
+
}
|
|
355
|
+
result.push({
|
|
356
|
+
key: sourceEntry.key,
|
|
357
|
+
formatKey,
|
|
358
|
+
pluralRules,
|
|
359
|
+
});
|
|
360
|
+
}
|
|
361
|
+
return result;
|
|
362
|
+
}
|
|
363
|
+
/**
|
|
364
|
+
* Reconstruct a .stringsdict file from entries
|
|
365
|
+
*
|
|
366
|
+
* @param entries Stringsdict entries
|
|
367
|
+
* @returns Valid XML plist content
|
|
368
|
+
*/
|
|
369
|
+
export function reconstructStringsDictContent(entries) {
|
|
370
|
+
const lines = [
|
|
371
|
+
'<?xml version="1.0" encoding="UTF-8"?>',
|
|
372
|
+
'<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">',
|
|
373
|
+
'<plist version="1.0">',
|
|
374
|
+
"<dict>",
|
|
375
|
+
];
|
|
376
|
+
for (const entry of entries) {
|
|
377
|
+
lines.push(`\t<key>${encodeXmlEntities(entry.key)}</key>`);
|
|
378
|
+
lines.push("\t<dict>");
|
|
379
|
+
lines.push("\t\t<key>NSStringLocalizedFormatKey</key>");
|
|
380
|
+
lines.push(`\t\t<string>${encodeXmlEntities(entry.formatKey)}</string>`);
|
|
381
|
+
for (const [ruleName, rule] of Object.entries(entry.pluralRules)) {
|
|
382
|
+
lines.push(`\t\t<key>${encodeXmlEntities(ruleName)}</key>`);
|
|
383
|
+
lines.push("\t\t<dict>");
|
|
384
|
+
lines.push("\t\t\t<key>NSStringFormatSpecTypeKey</key>");
|
|
385
|
+
lines.push(`\t\t\t<string>${encodeXmlEntities(rule.specTypeKey)}</string>`);
|
|
386
|
+
if (rule.formatValueTypeKey) {
|
|
387
|
+
lines.push("\t\t\t<key>NSStringFormatValueTypeKey</key>");
|
|
388
|
+
lines.push(`\t\t\t<string>${encodeXmlEntities(rule.formatValueTypeKey)}</string>`);
|
|
389
|
+
}
|
|
390
|
+
// Add variants in consistent order
|
|
391
|
+
for (const variant of PLURAL_VARIANTS) {
|
|
392
|
+
const value = rule.variants[variant];
|
|
393
|
+
if (value !== undefined) {
|
|
394
|
+
lines.push(`\t\t\t<key>${variant}</key>`);
|
|
395
|
+
lines.push(`\t\t\t<string>${encodeXmlEntities(value)}</string>`);
|
|
396
|
+
}
|
|
397
|
+
}
|
|
398
|
+
lines.push("\t\t</dict>");
|
|
399
|
+
}
|
|
400
|
+
lines.push("\t</dict>");
|
|
401
|
+
}
|
|
402
|
+
lines.push("</dict>");
|
|
403
|
+
lines.push("</plist>");
|
|
404
|
+
return lines.join("\n") + "\n";
|
|
405
|
+
}
|
|
406
|
+
/**
|
|
407
|
+
* Merge new translations into existing stringsdict content
|
|
408
|
+
*
|
|
409
|
+
* @param existingContent Existing target file content (raw XML)
|
|
410
|
+
* @param newTranslations New/updated translations (flattened format)
|
|
411
|
+
* @param sourceEntries Source stringsdict entries (for structure)
|
|
412
|
+
* @param sourceKeys Set of all entry keys in source
|
|
413
|
+
* @returns Merged stringsdict XML content
|
|
414
|
+
*/
|
|
415
|
+
export function mergeStringsDictContent(existingContent, newTranslations, sourceEntries, sourceKeys) {
|
|
416
|
+
// Parse existing content
|
|
417
|
+
const existing = parseStringsDictContent(existingContent);
|
|
418
|
+
const existingMap = new Map();
|
|
419
|
+
if (existing) {
|
|
420
|
+
for (const entry of existing.entries) {
|
|
421
|
+
existingMap.set(entry.key, entry);
|
|
422
|
+
}
|
|
423
|
+
}
|
|
424
|
+
// Create map of new translations
|
|
425
|
+
const newTranslationsMap = new Map();
|
|
426
|
+
for (const { key, value } of newTranslations) {
|
|
427
|
+
newTranslationsMap.set(key, value);
|
|
428
|
+
}
|
|
429
|
+
// Build merged entries
|
|
430
|
+
const mergedEntries = [];
|
|
431
|
+
for (const sourceEntry of sourceEntries) {
|
|
432
|
+
if (!sourceKeys.has(sourceEntry.key)) {
|
|
433
|
+
continue;
|
|
434
|
+
}
|
|
435
|
+
const existingEntry = existingMap.get(sourceEntry.key);
|
|
436
|
+
const formatKey = newTranslationsMap.get(`${sourceEntry.key}.__formatKey`) ||
|
|
437
|
+
existingEntry?.formatKey ||
|
|
438
|
+
sourceEntry.formatKey;
|
|
439
|
+
const pluralRules = {};
|
|
440
|
+
for (const [ruleName, sourceRule] of Object.entries(sourceEntry.pluralRules)) {
|
|
441
|
+
const existingRule = existingEntry?.pluralRules[ruleName];
|
|
442
|
+
const variants = {};
|
|
443
|
+
for (const variant of PLURAL_VARIANTS) {
|
|
444
|
+
const translatedKey = `${sourceEntry.key}.${ruleName}.${variant}`;
|
|
445
|
+
const newValue = newTranslationsMap.get(translatedKey);
|
|
446
|
+
const existingValue = existingRule?.variants[variant];
|
|
447
|
+
const sourceValue = sourceRule.variants[variant];
|
|
448
|
+
if (newValue !== undefined) {
|
|
449
|
+
variants[variant] = newValue;
|
|
450
|
+
}
|
|
451
|
+
else if (existingValue !== undefined) {
|
|
452
|
+
variants[variant] = existingValue;
|
|
453
|
+
}
|
|
454
|
+
else if (sourceValue !== undefined) {
|
|
455
|
+
// Only include if source has this variant
|
|
456
|
+
variants[variant] = sourceValue;
|
|
457
|
+
}
|
|
458
|
+
}
|
|
459
|
+
pluralRules[ruleName] = {
|
|
460
|
+
specTypeKey: sourceRule.specTypeKey,
|
|
461
|
+
formatValueTypeKey: sourceRule.formatValueTypeKey,
|
|
462
|
+
variants,
|
|
463
|
+
};
|
|
464
|
+
}
|
|
465
|
+
mergedEntries.push({
|
|
466
|
+
key: sourceEntry.key,
|
|
467
|
+
formatKey,
|
|
468
|
+
pluralRules,
|
|
469
|
+
});
|
|
470
|
+
}
|
|
471
|
+
return reconstructStringsDictContent(mergedEntries);
|
|
472
|
+
}
|
|
473
|
+
//# sourceMappingURL=stringsdict-parser.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"stringsdict-parser.js","sourceRoot":"","sources":["../../src/utils/stringsdict-parser.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AASH;;GAEG;AACH,MAAM,CAAC,MAAM,eAAe,GAAoB;IAC9C,MAAM;IACN,KAAK;IACL,KAAK;IACL,KAAK;IACL,MAAM;IACN,OAAO;CACR,CAAC;AAkCF;;;;;GAKG;AACH,MAAM,UAAU,uBAAuB,CACrC,OAAe;IAEf,IAAI,CAAC;QACH,MAAM,OAAO,GAAuB,EAAE,CAAC;QAEvC,iDAAiD;QACjD,MAAM,UAAU,GAAG,OAAO,CAAC,KAAK,CAAC,iCAAiC,CAAC,CAAC;QACpE,IAAI,CAAC,UAAU,EAAE,CAAC;YAChB,OAAO,IAAI,CAAC;QACd,CAAC;QAED,MAAM,YAAY,GAAG,UAAU,CAAC,CAAC,CAAC,CAAC;QAEnC,qDAAqD;QACrD,MAAM,eAAe,GAAG,kBAAkB,CAAC,YAAY,CAAC,CAAC;QACzD,IAAI,CAAC,eAAe,EAAE,CAAC;YACrB,OAAO,IAAI,CAAC;QACd,CAAC;QAED,kCAAkC;QAClC,MAAM,SAAS,GAAG,kBAAkB,CAAC,eAAe,CAAC,CAAC;QAEtD,KAAK,MAAM,CAAC,QAAQ,EAAE,YAAY,CAAC,IAAI,SAAS,EAAE,CAAC;YACjD,MAAM,KAAK,GAAG,cAAc,CAAC,QAAQ,EAAE,YAAY,CAAC,CAAC;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