@ccgp/i18n-ai 0.1.2 → 0.1.3
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/cli.js +0 -17
- package/dist/cli.mjs +0 -17
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -415,23 +415,6 @@ program.command("sync").description("Synchronize translations using AI").option(
|
|
|
415
415
|
let locales = options.locales ? options.locales.split(",") : config ? config.locales : [];
|
|
416
416
|
let defaultLocale = options.default || (config ? config.defaultLocale : null);
|
|
417
417
|
if (!messagesDir || locales.length === 0 || !defaultLocale) {
|
|
418
|
-
if (!config) {
|
|
419
|
-
try {
|
|
420
|
-
const routingPath = (0, import_path2.join)(cwd, "i18n", "routing.ts");
|
|
421
|
-
const routingContent = await (0, import_promises3.readFile)(routingPath, "utf-8").catch(() => "");
|
|
422
|
-
if (routingContent) {
|
|
423
|
-
const localesMatch = routingContent.match(/locales:\s*\[([\s\S]*?)\]/);
|
|
424
|
-
const defaultMatch = routingContent.match(/defaultLocale:\s*["'](\w+)["']/);
|
|
425
|
-
if (localesMatch && locales.length === 0) {
|
|
426
|
-
locales = localesMatch[1].split(",").map((l) => l.trim().replace(/['"]/g, "")).filter(Boolean);
|
|
427
|
-
}
|
|
428
|
-
if (defaultMatch && !defaultLocale) {
|
|
429
|
-
defaultLocale = defaultMatch[1];
|
|
430
|
-
}
|
|
431
|
-
}
|
|
432
|
-
} catch {
|
|
433
|
-
}
|
|
434
|
-
}
|
|
435
418
|
if (!messagesDir) messagesDir = (0, import_path2.resolve)(cwd, "messages");
|
|
436
419
|
if (!defaultLocale) defaultLocale = "en";
|
|
437
420
|
}
|
package/dist/cli.mjs
CHANGED
|
@@ -79,23 +79,6 @@ program.command("sync").description("Synchronize translations using AI").option(
|
|
|
79
79
|
let locales = options.locales ? options.locales.split(",") : config ? config.locales : [];
|
|
80
80
|
let defaultLocale = options.default || (config ? config.defaultLocale : null);
|
|
81
81
|
if (!messagesDir || locales.length === 0 || !defaultLocale) {
|
|
82
|
-
if (!config) {
|
|
83
|
-
try {
|
|
84
|
-
const routingPath = join(cwd, "i18n", "routing.ts");
|
|
85
|
-
const routingContent = await readFile(routingPath, "utf-8").catch(() => "");
|
|
86
|
-
if (routingContent) {
|
|
87
|
-
const localesMatch = routingContent.match(/locales:\s*\[([\s\S]*?)\]/);
|
|
88
|
-
const defaultMatch = routingContent.match(/defaultLocale:\s*["'](\w+)["']/);
|
|
89
|
-
if (localesMatch && locales.length === 0) {
|
|
90
|
-
locales = localesMatch[1].split(",").map((l) => l.trim().replace(/['"]/g, "")).filter(Boolean);
|
|
91
|
-
}
|
|
92
|
-
if (defaultMatch && !defaultLocale) {
|
|
93
|
-
defaultLocale = defaultMatch[1];
|
|
94
|
-
}
|
|
95
|
-
}
|
|
96
|
-
} catch {
|
|
97
|
-
}
|
|
98
|
-
}
|
|
99
82
|
if (!messagesDir) messagesDir = resolve(cwd, "messages");
|
|
100
83
|
if (!defaultLocale) defaultLocale = "en";
|
|
101
84
|
}
|