@scoutello/i18n-magic 0.64.0 → 0.66.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/README.md +13 -7
- package/dist/cli.js +20 -15
- package/dist/cli.js.map +1 -1
- package/dist/commands/check-missing.d.ts +11 -1
- package/dist/commands/check-missing.d.ts.map +1 -1
- package/dist/commands/check-missing.js +56 -96
- package/dist/commands/check-missing.js.map +1 -1
- package/dist/commands/replace.d.ts +6 -0
- package/dist/commands/replace.d.ts.map +1 -1
- package/dist/commands/replace.js +48 -29
- package/dist/commands/replace.js.map +1 -1
- package/dist/commands/scan.d.ts.map +1 -1
- package/dist/commands/scan.js +114 -80
- package/dist/commands/scan.js.map +1 -1
- package/dist/commands/sync-locales.d.ts.map +1 -1
- package/dist/commands/sync-locales.js +90 -50
- package/dist/commands/sync-locales.js.map +1 -1
- package/dist/index.d.ts +2 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/lib/languges.d.ts.map +1 -1
- package/dist/lib/languges.js +20 -0
- package/dist/lib/languges.js.map +1 -1
- package/dist/lib/locale-storage.d.ts +7 -0
- package/dist/lib/locale-storage.d.ts.map +1 -0
- package/dist/lib/locale-storage.js +49 -0
- package/dist/lib/locale-storage.js.map +1 -0
- package/dist/lib/translation-response.d.ts +8 -0
- package/dist/lib/translation-response.d.ts.map +1 -0
- package/dist/lib/translation-response.js +43 -0
- package/dist/lib/translation-response.js.map +1 -0
- package/dist/lib/types.d.ts +1 -1
- package/dist/lib/types.d.ts.map +1 -1
- package/dist/lib/update-translation-key.d.ts +16 -0
- package/dist/lib/update-translation-key.d.ts.map +1 -0
- package/dist/lib/update-translation-key.js +67 -0
- package/dist/lib/update-translation-key.js.map +1 -0
- package/dist/lib/utils.d.ts +2 -0
- package/dist/lib/utils.d.ts.map +1 -1
- package/dist/lib/utils.js +69 -51
- package/dist/lib/utils.js.map +1 -1
- package/dist/mcp-server.js +28 -79
- package/dist/mcp-server.js.map +1 -1
- package/package.json +5 -9
- package/src/cli.ts +26 -18
- package/src/commands/check-missing.ts +83 -137
- package/src/commands/replace.ts +81 -43
- package/src/commands/scan.ts +130 -108
- package/src/commands/sync-locales.ts +125 -86
- package/src/index.ts +6 -1
- package/src/lib/languges.ts +20 -0
- package/src/lib/locale-storage.ts +76 -0
- package/src/lib/translation-response.ts +59 -0
- package/src/lib/types.ts +1 -1
- package/src/lib/update-translation-key.ts +119 -0
- package/src/lib/utils.ts +92 -76
- package/src/mcp-server.ts +31 -112
package/README.md
CHANGED
|
@@ -16,8 +16,8 @@ Stop context switching. Let AI handle your translations while you stay in your c
|
|
|
16
16
|
## 📋 Requirements
|
|
17
17
|
|
|
18
18
|
- JSON-based i18n libraries (react-i18next, next-i18next, vue-i18n, etc.)
|
|
19
|
-
- Node.js
|
|
20
|
-
- An OpenAI or Google Gemini API key
|
|
19
|
+
- Node.js 20+
|
|
20
|
+
- An OpenAI or Google Gemini API key for commands that generate translations
|
|
21
21
|
|
|
22
22
|
## Why This Matters
|
|
23
23
|
|
|
@@ -48,7 +48,9 @@ npx @scoutello/i18n-magic check-missing # CI/CD validation
|
|
|
48
48
|
|
|
49
49
|
**`clean`** - Removes unused translation keys from all locales. Great for keeping files lean.
|
|
50
50
|
|
|
51
|
-
**`check-missing`** -
|
|
51
|
+
**`check-missing`** - Read-only check across every configured locale and namespace. Exits with error code if translations are missing and never calls a provider or writes. Perfect for CI pipelines.
|
|
52
|
+
|
|
53
|
+
`check-missing`, `clean`, `remove-key`, and `restore-from-namespaces` work without provider credentials. Translation commands request a provider only when they actually have values to translate.
|
|
52
54
|
|
|
53
55
|
### Namespace Organization (for large apps)
|
|
54
56
|
|
|
@@ -84,7 +86,7 @@ Batch add 2+ keys in one call with better performance than multiple single-key c
|
|
|
84
86
|
Retrieve current value for any key.
|
|
85
87
|
|
|
86
88
|
### 5. `update_translation_key` - Fix & Auto-Translate
|
|
87
|
-
|
|
89
|
+
With a configured provider, update and validate all locales before writing. Without a provider, update only the supplied language (or `defaultLocale`) and report the remaining locales as pending.
|
|
88
90
|
|
|
89
91
|
### 6. `list_untranslated_keys` - Batch Check
|
|
90
92
|
Show all missing keys across your codebase.
|
|
@@ -177,9 +179,9 @@ If nothing exists:
|
|
|
177
179
|
**AI**:
|
|
178
180
|
1. Finds the key via search
|
|
179
181
|
2. Calls `update_translation_key`
|
|
180
|
-
3.
|
|
182
|
+
3. Auto-translates to all languages when a provider is configured
|
|
181
183
|
|
|
182
|
-
|
|
184
|
+
Without a provider, the source locale is updated and the response instructs you to run `sync` for the pending locales.
|
|
183
185
|
|
|
184
186
|
### Pattern 3: Batch Check
|
|
185
187
|
|
|
@@ -220,7 +222,7 @@ npx @scoutello/i18n-magic sync
|
|
|
220
222
|
|
|
221
223
|
Later: **"Change title to 'Your Profile'"**
|
|
222
224
|
|
|
223
|
-
**AI**: Calls `update_translation_key` →
|
|
225
|
+
**AI**: Calls `update_translation_key` → all locales update together with a provider, or only the source locale updates and the others are reported as pending.
|
|
224
226
|
|
|
225
227
|
---
|
|
226
228
|
|
|
@@ -238,6 +240,10 @@ context: 'E-commerce for outdoor gear. Friendly tone. Target: adventurers.'
|
|
|
238
240
|
|
|
239
241
|
More context = better AI translations.
|
|
240
242
|
|
|
243
|
+
### Fail-closed translation writes
|
|
244
|
+
|
|
245
|
+
Provider responses must contain exactly the requested keys with string values. A malformed response is retried once with a corrective prompt. If the retry or any later locale fails, `scan`, `sync`, `replace`, and programmatic add/update operations discard their staged changes without writing locale files. Final storage failures can still leave partial writes across files.
|
|
246
|
+
|
|
241
247
|
### CI/CD: Auto-translate on PR
|
|
242
248
|
|
|
243
249
|
```yaml
|
package/dist/cli.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import { Command } from "commander";
|
|
3
3
|
import dotenv from "dotenv";
|
|
4
4
|
import OpenAI from "openai";
|
|
5
|
-
import { checkMissing } from "./commands/check-missing.js";
|
|
5
|
+
import { checkMissing, MissingTranslationsError, } from "./commands/check-missing.js";
|
|
6
6
|
import { removeUnusedKeys } from "./commands/clean.js";
|
|
7
7
|
import { removeKey } from "./commands/remove-key.js";
|
|
8
8
|
import { replaceTranslation } from "./commands/replace.js";
|
|
@@ -82,27 +82,32 @@ for (const command of commands) {
|
|
|
82
82
|
const geminiKey = config.GEMINI_API_KEY;
|
|
83
83
|
// Select appropriate key based on model type
|
|
84
84
|
const key = isGemini ? geminiKey : openaiKey;
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
}),
|
|
95
|
-
});
|
|
85
|
+
const openai = config.openai ||
|
|
86
|
+
(key
|
|
87
|
+
? new OpenAI({
|
|
88
|
+
apiKey: key,
|
|
89
|
+
...(isGemini && {
|
|
90
|
+
baseURL: "https://generativelanguage.googleapis.com/v1beta/openai/",
|
|
91
|
+
}),
|
|
92
|
+
})
|
|
93
|
+
: undefined);
|
|
96
94
|
// For replace and remove-key commands, check for key in argument or option
|
|
97
95
|
if (command.name === "replace" || command.name === "remove-key") {
|
|
98
96
|
// If key is provided as positional argument, use that first
|
|
99
97
|
const keyToUse = typeof arg === "string" ? arg : options.key;
|
|
100
|
-
command.action({ ...config, openai }, keyToUse);
|
|
98
|
+
await command.action({ ...config, openai }, keyToUse);
|
|
101
99
|
}
|
|
102
100
|
else {
|
|
103
|
-
command.action({ ...config, openai });
|
|
101
|
+
await command.action({ ...config, openai });
|
|
104
102
|
}
|
|
105
103
|
});
|
|
106
104
|
}
|
|
107
|
-
program.
|
|
105
|
+
program.parseAsync(process.argv).catch((error) => {
|
|
106
|
+
if (error instanceof MissingTranslationsError) {
|
|
107
|
+
process.exitCode = 1;
|
|
108
|
+
return;
|
|
109
|
+
}
|
|
110
|
+
console.error(error instanceof Error ? error.message : String(error));
|
|
111
|
+
process.exitCode = 1;
|
|
112
|
+
});
|
|
108
113
|
//# sourceMappingURL=cli.js.map
|
package/dist/cli.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cli.js","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAA;AACnC,OAAO,MAAM,MAAM,QAAQ,CAAA;AAC3B,OAAO,MAAM,MAAM,QAAQ,CAAA;AAC3B,OAAO,
|
|
1
|
+
{"version":3,"file":"cli.js","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAA;AACnC,OAAO,MAAM,MAAM,QAAQ,CAAA;AAC3B,OAAO,MAAM,MAAM,QAAQ,CAAA;AAC3B,OAAO,EACL,YAAY,EACZ,wBAAwB,GACzB,MAAM,6BAA6B,CAAA;AACpC,OAAO,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAA;AACtD,OAAO,EAAE,SAAS,EAAE,MAAM,0BAA0B,CAAA;AACpD,OAAO,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAA;AAC1D,OAAO,EAAE,qBAAqB,EAAE,MAAM,uCAAuC,CAAA;AAC7E,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAA;AACrD,OAAO,EAAE,WAAW,EAAE,MAAM,4BAA4B,CAAA;AAExD,OAAO,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAA;AAE3C,MAAM,OAAO,GAAG,IAAI,OAAO,EAAE,CAAA;AAE7B,OAAO;KACJ,IAAI,CAAC,YAAY,CAAC;KAClB,WAAW,CACV,6FAA6F,CAC9F;KACA,OAAO,CAAC,OAAO,CAAC;KAChB,MAAM,CAAC,qBAAqB,EAAE,qBAAqB,CAAC;KACpD,MAAM,CAAC,kBAAkB,EAAE,mBAAmB,CAAC,CAAA;AAElD,MAAM,QAAQ,GAAkB;IAC9B;QACE,IAAI,EAAE,MAAM;QACZ,WAAW,EACT,uH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;IACH,CAAC,CAAC,CAAA;AACJ,CAAC;AAED,OAAO,CAAC,UAAU,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,KAAK,CAAC,CAAC,KAAc,EAAE,EAAE;IACxD,IAAI,KAAK,YAAY,wBAAwB,EAAE,CAAC;QAC9C,OAAO,CAAC,QAAQ,GAAG,CAAC,CAAA;QACpB,OAAM;IACR,CAAC;IAED,OAAO,CAAC,KAAK,CAAC,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAA;IACrE,OAAO,CAAC,QAAQ,GAAG,CAAC,CAAA;AACtB,CAAC,CAAC,CAAA"}
|
|
@@ -1,3 +1,13 @@
|
|
|
1
1
|
import type { Configuration } from "../lib/types.js";
|
|
2
|
-
export
|
|
2
|
+
export interface MissingTranslationsReport {
|
|
3
|
+
missing: Record<string, Record<string, string[]>>;
|
|
4
|
+
totalExpected: number;
|
|
5
|
+
totalMissing: number;
|
|
6
|
+
}
|
|
7
|
+
export declare class MissingTranslationsError extends Error {
|
|
8
|
+
report: MissingTranslationsReport;
|
|
9
|
+
constructor(report: MissingTranslationsReport);
|
|
10
|
+
}
|
|
11
|
+
export declare const collectMissingTranslations: (config: Configuration) => Promise<MissingTranslationsReport>;
|
|
12
|
+
export declare const checkMissing: (config: Configuration) => Promise<MissingTranslationsReport>;
|
|
3
13
|
//# sourceMappingURL=check-missing.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"check-missing.d.ts","sourceRoot":"","sources":["../../src/commands/check-missing.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAA;
|
|
1
|
+
{"version":3,"file":"check-missing.d.ts","sourceRoot":"","sources":["../../src/commands/check-missing.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAA;AAOpD,MAAM,WAAW,yBAAyB;IACxC,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,EAAE,CAAC,CAAC,CAAA;IACjD,aAAa,EAAE,MAAM,CAAA;IACrB,YAAY,EAAE,MAAM,CAAA;CACrB;AAED,qBAAa,wBAAyB,SAAQ,KAAK;IAC9B,MAAM,EAAE,yBAAyB;gBAAjC,MAAM,EAAE,yBAAyB;CAIrD;AAED,eAAO,MAAM,0BAA0B,GACrC,QAAQ,aAAa,KACpB,OAAO,CAAC,yBAAyB,CA4DnC,CAAA;AAgBD,eAAO,MAAM,YAAY,GAAU,QAAQ,aAAa,uCASvD,CAAA"}
|
|
@@ -1,106 +1,66 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
return;
|
|
1
|
+
import { getKeysWithNamespaces, getPureKey, loadLocalesFile, } from "../lib/utils.js";
|
|
2
|
+
export class MissingTranslationsError extends Error {
|
|
3
|
+
constructor(report) {
|
|
4
|
+
super(`Found ${report.totalMissing} missing translation(s).`);
|
|
5
|
+
this.report = report;
|
|
6
|
+
this.name = "MissingTranslationsError";
|
|
8
7
|
}
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
const
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
8
|
+
}
|
|
9
|
+
export const collectMissingTranslations = async (config) => {
|
|
10
|
+
const keysWithNamespaces = await getKeysWithNamespaces({
|
|
11
|
+
globPatterns: config.globPatterns,
|
|
12
|
+
defaultNamespace: config.defaultNamespace,
|
|
13
|
+
});
|
|
14
|
+
const expectedByNamespace = Object.fromEntries(config.namespaces.map((namespace) => [namespace, new Set()]));
|
|
15
|
+
for (const { key, namespaces } of keysWithNamespaces) {
|
|
16
|
+
for (const namespace of namespaces) {
|
|
17
|
+
if (!expectedByNamespace[namespace])
|
|
18
|
+
continue;
|
|
19
|
+
const pureKey = getPureKey(key, namespace, namespace === config.defaultNamespace);
|
|
20
|
+
const expectedKey = pureKey || (!key.includes(":") ? key : null);
|
|
21
|
+
if (expectedKey !== null)
|
|
22
|
+
expectedByNamespace[namespace].add(expectedKey);
|
|
18
23
|
}
|
|
19
24
|
}
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
+
const loadedFiles = await Promise.all(config.locales.flatMap((locale) => config.namespaces.map(async (namespace) => ({
|
|
26
|
+
locale,
|
|
27
|
+
namespace,
|
|
28
|
+
translations: await loadLocalesFile(config.loadPath, locale, namespace, { silent: true }),
|
|
29
|
+
}))));
|
|
30
|
+
const missing = {};
|
|
31
|
+
let totalMissing = 0;
|
|
32
|
+
for (const { locale, namespace, translations } of loadedFiles) {
|
|
33
|
+
const missingKeys = Array.from(expectedByNamespace[namespace]).filter((key) => !Object.hasOwn(translations, key));
|
|
34
|
+
if (missingKeys.length === 0)
|
|
35
|
+
continue;
|
|
36
|
+
missing[locale] ?? (missing[locale] = {});
|
|
37
|
+
missing[locale][namespace] = missingKeys.sort();
|
|
38
|
+
totalMissing += missingKeys.length;
|
|
25
39
|
}
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
keysWithValues.push({
|
|
37
|
-
key: newKey.key,
|
|
38
|
-
namespaces: newKey.namespaces,
|
|
39
|
-
value: existingValue,
|
|
40
|
-
});
|
|
41
|
-
}
|
|
42
|
-
else {
|
|
43
|
-
stillMissingKeys.push(newKey.key);
|
|
44
|
-
keysWithValues.push({
|
|
45
|
-
key: newKey.key,
|
|
46
|
-
namespaces: newKey.namespaces,
|
|
47
|
-
value: null,
|
|
48
|
-
});
|
|
49
|
-
}
|
|
40
|
+
return {
|
|
41
|
+
missing,
|
|
42
|
+
totalExpected: Object.values(expectedByNamespace).reduce((total, keys) => total + keys.size, 0),
|
|
43
|
+
totalMissing,
|
|
44
|
+
};
|
|
45
|
+
};
|
|
46
|
+
const printMissingTranslationsReport = (report) => {
|
|
47
|
+
if (report.totalMissing === 0) {
|
|
48
|
+
console.log("✅ No missing translations found.");
|
|
49
|
+
return;
|
|
50
50
|
}
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
const newKeysObject = keysToWrite.reduce((prev, next) => {
|
|
56
|
-
prev[next.key] = next.value;
|
|
57
|
-
return prev;
|
|
58
|
-
}, {});
|
|
59
|
-
const allLocales = disableTranslationDuringScan ? [defaultLocale] : locales;
|
|
60
|
-
// Batch translate for all non-default locales in parallel
|
|
61
|
-
const translationCache = {
|
|
62
|
-
[defaultLocale]: newKeysObject,
|
|
63
|
-
};
|
|
64
|
-
const nonDefaultLocales = allLocales.filter((l) => l !== defaultLocale);
|
|
65
|
-
if (nonDefaultLocales.length > 0 && !disableTranslationDuringScan) {
|
|
66
|
-
console.log(` 📝 Translating to ${nonDefaultLocales.length} other locale(s)...`);
|
|
67
|
-
await Promise.all(nonDefaultLocales.map(async (locale) => {
|
|
68
|
-
const translatedValues = await translateKey({
|
|
69
|
-
inputLanguage: defaultLocale,
|
|
70
|
-
outputLanguage: locale,
|
|
71
|
-
context,
|
|
72
|
-
object: newKeysObject,
|
|
73
|
-
openai,
|
|
74
|
-
model,
|
|
75
|
-
});
|
|
76
|
-
translationCache[locale] = translatedValues;
|
|
77
|
-
}));
|
|
51
|
+
console.error(`❌ Found ${report.totalMissing} missing translation(s):`);
|
|
52
|
+
for (const [locale, namespaces] of Object.entries(report.missing)) {
|
|
53
|
+
for (const [namespace, keys] of Object.entries(namespaces)) {
|
|
54
|
+
console.error(` ${locale}/${namespace}: ${keys.join(", ")}`);
|
|
78
55
|
}
|
|
79
|
-
// Process all locale/namespace combinations in parallel
|
|
80
|
-
await Promise.all(allLocales.flatMap((locale) => namespaces.map(async (namespace) => {
|
|
81
|
-
const existingKeys = await loadLocalesFile(loadPath, locale, namespace);
|
|
82
|
-
const relevantKeys = keysToWrite.filter((key) => key.namespaces?.includes(namespace));
|
|
83
|
-
if (relevantKeys.length === 0) {
|
|
84
|
-
return;
|
|
85
|
-
}
|
|
86
|
-
const translatedValues = translationCache[locale];
|
|
87
|
-
for (const key of relevantKeys) {
|
|
88
|
-
existingKeys[key.key] = translatedValues[key.key];
|
|
89
|
-
}
|
|
90
|
-
await writeLocalesFile(savePath, locale, namespace, existingKeys);
|
|
91
|
-
console.log(` ✅ Updated ${locale}/${namespace}.json with ${relevantKeys.length} key(s)`);
|
|
92
|
-
})));
|
|
93
|
-
console.log(`\n✅ Successfully auto-filled ${reusedKeys.length} key(s) from existing translations.`);
|
|
94
56
|
}
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
console.error(`\nPlease run 'i18n-magic scan' to provide values for these keys.`);
|
|
102
|
-
process.exit(1);
|
|
57
|
+
};
|
|
58
|
+
export const checkMissing = async (config) => {
|
|
59
|
+
const report = await collectMissingTranslations(config);
|
|
60
|
+
printMissingTranslationsReport(report);
|
|
61
|
+
if (report.totalMissing > 0) {
|
|
62
|
+
throw new MissingTranslationsError(report);
|
|
103
63
|
}
|
|
104
|
-
|
|
64
|
+
return report;
|
|
105
65
|
};
|
|
106
66
|
//# sourceMappingURL=check-missing.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"check-missing.js","sourceRoot":"","sources":["../../src/commands/check-missing.ts"],"names":[],"mappings":"AACA,OAAO,EACL,
|
|
1
|
+
{"version":3,"file":"check-missing.js","sourceRoot":"","sources":["../../src/commands/check-missing.ts"],"names":[],"mappings":"AACA,OAAO,EACL,qBAAqB,EACrB,UAAU,EACV,eAAe,GAChB,MAAM,iBAAiB,CAAA;AAQxB,MAAM,OAAO,wBAAyB,SAAQ,KAAK;IACjD,YAAmB,MAAiC;QAClD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QAC/C,OAAM;IACR,CAAC;IAED,OAAO,CAAC,KAAK,CAAC,WAAW,MAAM,CAAC,YAAY,0BAA0B,CAAC,CAAA;IACvE,KAAK,MAAM,CAAC,MAAM,EAAE,UAAU,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,MAAM,CAAC,OAAO,CAAC,EAAE,CAAC;QAClE,KAAK,MAAM,CAAC,SAAS,EAAE,IAAI,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,UAAU,CAAC,EAAE,CAAC;YAC3D,OAAO,CAAC,KAAK,CAAC,MAAM,MAAM,IAAI,SAAS,KAAK,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,CAAA;QAChE,CAAC;IACH,CAAC;AACH,CAAC,CAAA;AAED,MAAM,CAAC,MAAM,YAAY,GAAG,KAAK,EAAE,MAAqB,EAAE,EAAE;IAC1D,MAAM,MAAM,GAAG,MAAM,0BAA0B,CAAC,MAAM,CAAC,CAAA;IACvD,8BAA8B,CAAC,MAAM,CAAC,CAAA;IAEtC,IAAI,MAAM,CAAC,YAAY,GAAG,CAAC,EAAE,CAAC;QAC5B,MAAM,IAAI,wBAAwB,CAAC,MAAM,CAAC,CAAA;IAC5C,CAAC;IAED,OAAO,MAAM,CAAA;AACf,CAAC,CAAA"}
|
|
@@ -1,3 +1,9 @@
|
|
|
1
1
|
import type { Configuration } from "../lib/types.js";
|
|
2
|
+
export declare const replaceTranslationValue: ({ config, key, value, targetNamespaces, }: {
|
|
3
|
+
config: Configuration;
|
|
4
|
+
key: string;
|
|
5
|
+
value: string;
|
|
6
|
+
targetNamespaces: string[];
|
|
7
|
+
}) => Promise<void>;
|
|
2
8
|
export declare const replaceTranslation: (config: Configuration, key?: string) => Promise<void>;
|
|
3
9
|
//# sourceMappingURL=replace.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"replace.d.ts","sourceRoot":"","sources":["../../src/commands/replace.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAA;AA6BpD,eAAO,MAAM,kBAAkB,GAC7B,QAAQ,aAAa,EACrB,MAAM,MAAM,
|
|
1
|
+
{"version":3,"file":"replace.d.ts","sourceRoot":"","sources":["../../src/commands/replace.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAA;AA6BpD,eAAO,MAAM,uBAAuB,GAAU,2CAK3C;IACD,MAAM,EAAE,aAAa,CAAA;IACrB,GAAG,EAAE,MAAM,CAAA;IACX,KAAK,EAAE,MAAM,CAAA;IACb,gBAAgB,EAAE,MAAM,EAAE,CAAA;CAC3B,kBA2DA,CAAA;AAED,eAAO,MAAM,kBAAkB,GAC7B,QAAQ,aAAa,EACrB,MAAM,MAAM,kBAyGb,CAAA"}
|
package/dist/commands/replace.js
CHANGED
|
@@ -9,8 +9,48 @@ const getKeyToReplace = async (allAvailableKeys) => {
|
|
|
9
9
|
console.log(`The key "${keyToReplace}" exists in namespaces: ${namespaces.join(", ")}.`);
|
|
10
10
|
return { key: keyToReplace, namespaces };
|
|
11
11
|
};
|
|
12
|
+
export const replaceTranslationValue = async ({ config, key, value, targetNamespaces, }) => {
|
|
13
|
+
const { loadPath, savePath, defaultLocale, locales, context, openai } = config;
|
|
14
|
+
const stagedFiles = new Map();
|
|
15
|
+
await Promise.all(targetNamespaces.flatMap((namespace) => locales.map(async (locale) => {
|
|
16
|
+
const existingKeys = await loadLocalesFile(loadPath, locale, namespace);
|
|
17
|
+
stagedFiles.set(JSON.stringify([locale, namespace]), {
|
|
18
|
+
...existingKeys,
|
|
19
|
+
});
|
|
20
|
+
})));
|
|
21
|
+
const translationCache = {
|
|
22
|
+
[defaultLocale]: value,
|
|
23
|
+
};
|
|
24
|
+
await Promise.all(locales
|
|
25
|
+
.filter((locale) => locale !== defaultLocale)
|
|
26
|
+
.map(async (locale) => {
|
|
27
|
+
const translation = await translateKey({
|
|
28
|
+
context,
|
|
29
|
+
inputLanguage: defaultLocale,
|
|
30
|
+
outputLanguage: locale,
|
|
31
|
+
object: { [key]: value },
|
|
32
|
+
openai,
|
|
33
|
+
model: config.model,
|
|
34
|
+
});
|
|
35
|
+
translationCache[locale] = translation[key];
|
|
36
|
+
}));
|
|
37
|
+
for (const namespace of targetNamespaces) {
|
|
38
|
+
for (const locale of locales) {
|
|
39
|
+
const staged = stagedFiles.get(JSON.stringify([locale, namespace]));
|
|
40
|
+
if (!staged) {
|
|
41
|
+
throw new Error(`Internal error: no staged snapshot for ${locale}/${namespace}.`);
|
|
42
|
+
}
|
|
43
|
+
staged[key] = translationCache[locale];
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
for (const namespace of targetNamespaces) {
|
|
47
|
+
for (const locale of locales) {
|
|
48
|
+
await writeLocalesFile(savePath, locale, namespace, stagedFiles.get(JSON.stringify([locale, namespace])));
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
};
|
|
12
52
|
export const replaceTranslation = async (config, key) => {
|
|
13
|
-
const { loadPath,
|
|
53
|
+
const { loadPath, defaultLocale, defaultNamespace, namespaces, locales, globPatterns, } = config;
|
|
14
54
|
// Find all keys with their namespaces from the codebase
|
|
15
55
|
const keysWithNamespaces = await getKeysWithNamespaces({
|
|
16
56
|
globPatterns,
|
|
@@ -77,33 +117,12 @@ export const replaceTranslation = async (config, key) => {
|
|
|
77
117
|
}
|
|
78
118
|
}
|
|
79
119
|
const newTranslation = await getTextInput("Enter the new translation: ");
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
const translation = await translateKey({
|
|
88
|
-
context,
|
|
89
|
-
inputLanguage: defaultLocale,
|
|
90
|
-
outputLanguage: locale,
|
|
91
|
-
object: {
|
|
92
|
-
[keyToReplace]: newTranslation,
|
|
93
|
-
},
|
|
94
|
-
openai,
|
|
95
|
-
model: config.model,
|
|
96
|
-
});
|
|
97
|
-
translationCache[locale] = translation[keyToReplace];
|
|
98
|
-
}));
|
|
99
|
-
}
|
|
100
|
-
// Update the key in all relevant namespaces and locales in parallel
|
|
101
|
-
await Promise.all(targetNamespaces.flatMap((namespace) => locales.map(async (locale) => {
|
|
102
|
-
const newValue = translationCache[locale];
|
|
103
|
-
const existingKeys = await loadLocalesFile(loadPath, locale, namespace);
|
|
104
|
-
existingKeys[keyToReplace] = newValue;
|
|
105
|
-
await writeLocalesFile(savePath, locale, namespace, existingKeys);
|
|
106
|
-
console.log(`Updated "${keyToReplace}" in ${locale} (${namespace}): "${newValue}"`);
|
|
107
|
-
})));
|
|
120
|
+
await replaceTranslationValue({
|
|
121
|
+
config,
|
|
122
|
+
key: keyToReplace,
|
|
123
|
+
value: newTranslation,
|
|
124
|
+
targetNamespaces,
|
|
125
|
+
});
|
|
126
|
+
console.log(`Updated "${keyToReplace}" in ${targetNamespaces.length} namespace(s) and ${locales.length} locale(s).`);
|
|
108
127
|
};
|
|
109
128
|
//# sourceMappingURL=replace.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"replace.js","sourceRoot":"","sources":["../../src/commands/replace.ts"],"names":[],"mappings":"AACA,OAAO,EACL,qBAAqB,EACrB,UAAU,EACV,YAAY,EACZ,eAAe,EACf,YAAY,EACZ,gBAAgB,GACjB,MAAM,iBAAiB,CAAA;AAExB,MAAM,eAAe,GAAG,KAAK,EAC3B,gBAAwE,EACxB,EAAE;IAClD,MAAM,YAAY,GAAG,MAAM,YAAY,CACrC,gDAAgD,CACjD,CAAA;IAED,IAAI,CAAC,gBAAgB,CAAC,YAAY,CAAC,EAAE,CAAC;QACpC,OAAO,CAAC,GAAG,CAAC,YAAY,YAAY,mBAAmB,CAAC,CAAA;QACxD,OAAO,MAAM,eAAe,CAAC,gBAAgB,CAAC,CAAA;IAChD,CAAC;IAED,MAAM,UAAU,GAAG,gBAAgB,CAAC,YAAY,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE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AAC,CAAA;IACxE,MAAM,uBAAuB,CAAC;QAC5B,MAAM;QACN,GAAG,EAAE,YAAY;QACjB,KAAK,EAAE,cAAc;QACrB,gBAAgB;KACjB,CAAC,CAAA;IAEF,OAAO,CAAC,GAAG,CACT,YAAY,YAAY,QAAQ,gBAAgB,CAAC,MAAM,qBAAqB,OAAO,CAAC,MAAM,aAAa,CACxG,CAAA;AACH,CAAC,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"scan.d.ts","sourceRoot":"","sources":["../../src/commands/scan.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAA;
|
|
1
|
+
{"version":3,"file":"scan.d.ts","sourceRoot":"","sources":["../../src/commands/scan.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAA;AAcpD,eAAO,MAAM,gBAAgB,GAAU,QAAQ,aAAa,kBAsK3D,CAAA"}
|