lingo.dev 0.95.0 → 0.97.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/build/cli.cjs +153 -118
- package/build/cli.cjs.map +1 -1
- package/build/cli.mjs +111 -76
- package/build/cli.mjs.map +1 -1
- package/package.json +6 -5
package/build/cli.mjs
CHANGED
|
@@ -29,7 +29,8 @@ function getSettings(explicitApiKey) {
|
|
|
29
29
|
llm: {
|
|
30
30
|
openaiApiKey: env.OPENAI_API_KEY || systemFile.llm?.openaiApiKey,
|
|
31
31
|
anthropicApiKey: env.ANTHROPIC_API_KEY || systemFile.llm?.anthropicApiKey,
|
|
32
|
-
groqApiKey: env.GROQ_API_KEY || systemFile.llm?.groqApiKey
|
|
32
|
+
groqApiKey: env.GROQ_API_KEY || systemFile.llm?.groqApiKey,
|
|
33
|
+
googleApiKey: env.GOOGLE_API_KEY || systemFile.llm?.googleApiKey
|
|
33
34
|
}
|
|
34
35
|
};
|
|
35
36
|
}
|
|
@@ -57,7 +58,8 @@ var SettingsSchema = Z.object({
|
|
|
57
58
|
llm: Z.object({
|
|
58
59
|
openaiApiKey: Z.string().optional(),
|
|
59
60
|
anthropicApiKey: Z.string().optional(),
|
|
60
|
-
groqApiKey: Z.string().optional()
|
|
61
|
+
groqApiKey: Z.string().optional(),
|
|
62
|
+
googleApiKey: Z.string().optional()
|
|
61
63
|
})
|
|
62
64
|
});
|
|
63
65
|
var SETTINGS_KEYS = flattenZodObject(
|
|
@@ -80,7 +82,8 @@ function _loadEnv() {
|
|
|
80
82
|
LINGODOTDEV_WEB_URL: Z.string().optional(),
|
|
81
83
|
OPENAI_API_KEY: Z.string().optional(),
|
|
82
84
|
ANTHROPIC_API_KEY: Z.string().optional(),
|
|
83
|
-
GROQ_API_KEY: Z.string().optional()
|
|
85
|
+
GROQ_API_KEY: Z.string().optional(),
|
|
86
|
+
GOOGLE_API_KEY: Z.string().optional()
|
|
84
87
|
}).passthrough().parse(process.env);
|
|
85
88
|
}
|
|
86
89
|
function _loadSystemFile() {
|
|
@@ -96,7 +99,8 @@ function _loadSystemFile() {
|
|
|
96
99
|
llm: Z.object({
|
|
97
100
|
openaiApiKey: Z.string().optional(),
|
|
98
101
|
anthropicApiKey: Z.string().optional(),
|
|
99
|
-
groqApiKey: Z.string().optional()
|
|
102
|
+
groqApiKey: Z.string().optional(),
|
|
103
|
+
googleApiKey: Z.string().optional()
|
|
100
104
|
}).optional()
|
|
101
105
|
}).passthrough().parse(data);
|
|
102
106
|
}
|
|
@@ -153,6 +157,12 @@ function _envVarsInfo() {
|
|
|
153
157
|
`\u2139\uFE0F Using GROQ_API_KEY env var instead of key from user config`
|
|
154
158
|
);
|
|
155
159
|
}
|
|
160
|
+
if (env.GOOGLE_API_KEY && systemFile.llm?.googleApiKey) {
|
|
161
|
+
console.info(
|
|
162
|
+
"\x1B[36m%s\x1B[0m",
|
|
163
|
+
`\u2139\uFE0F Using GOOGLE_API_KEY env var instead of key from user config`
|
|
164
|
+
);
|
|
165
|
+
}
|
|
156
166
|
if (env.LINGODOTDEV_API_URL) {
|
|
157
167
|
console.info(
|
|
158
168
|
"\x1B[36m%s\x1B[0m",
|
|
@@ -4479,6 +4489,7 @@ function countWordsInRecord(payload) {
|
|
|
4479
4489
|
// src/cli/processor/index.ts
|
|
4480
4490
|
import { createOpenAI } from "@ai-sdk/openai";
|
|
4481
4491
|
import { createAnthropic } from "@ai-sdk/anthropic";
|
|
4492
|
+
import { createGoogleGenerativeAI } from "@ai-sdk/google";
|
|
4482
4493
|
function createProcessor(provider, params) {
|
|
4483
4494
|
if (!provider) {
|
|
4484
4495
|
const result = createLingoLocalizer(params);
|
|
@@ -4528,6 +4539,15 @@ function getPureModelProvider(provider) {
|
|
|
4528
4539
|
return createAnthropic({
|
|
4529
4540
|
apiKey: process.env.ANTHROPIC_API_KEY
|
|
4530
4541
|
})(provider.model);
|
|
4542
|
+
case "google":
|
|
4543
|
+
if (!process.env.GOOGLE_API_KEY) {
|
|
4544
|
+
throw new Error(
|
|
4545
|
+
createMissingKeyErrorMessage("Google", "GOOGLE_API_KEY")
|
|
4546
|
+
);
|
|
4547
|
+
}
|
|
4548
|
+
return createGoogleGenerativeAI({
|
|
4549
|
+
apiKey: process.env.GOOGLE_API_KEY
|
|
4550
|
+
})(provider.model);
|
|
4531
4551
|
default:
|
|
4532
4552
|
throw new Error(createUnsupportedProviderErrorMessage(provider?.id));
|
|
4533
4553
|
}
|
|
@@ -5623,6 +5643,7 @@ function createLingoDotDevLocalizer(explicitApiKey) {
|
|
|
5623
5643
|
|
|
5624
5644
|
// src/cli/localizer/explicit.ts
|
|
5625
5645
|
import { createAnthropic as createAnthropic2 } from "@ai-sdk/anthropic";
|
|
5646
|
+
import { createGoogleGenerativeAI as createGoogleGenerativeAI2 } from "@ai-sdk/google";
|
|
5626
5647
|
import { createOpenAI as createOpenAI2 } from "@ai-sdk/openai";
|
|
5627
5648
|
import chalk9 from "chalk";
|
|
5628
5649
|
import dedent6 from "dedent";
|
|
@@ -5634,11 +5655,11 @@ function createExplicitLocalizer(provider) {
|
|
|
5634
5655
|
throw new Error(
|
|
5635
5656
|
dedent6`
|
|
5636
5657
|
You're trying to use unsupported provider: ${chalk9.dim(provider.id)}.
|
|
5637
|
-
|
|
5658
|
+
|
|
5638
5659
|
To fix this issue:
|
|
5639
5660
|
1. Switch to one of the supported providers, or
|
|
5640
5661
|
2. Remove the ${chalk9.italic("provider")} node from your i18n.json configuration to switch to ${chalk9.hex(colors.green)("Lingo.dev")}
|
|
5641
|
-
|
|
5662
|
+
|
|
5642
5663
|
${chalk9.hex(colors.blue)("Docs: https://lingo.dev/go/docs")}
|
|
5643
5664
|
`
|
|
5644
5665
|
);
|
|
@@ -5658,6 +5679,14 @@ function createExplicitLocalizer(provider) {
|
|
|
5658
5679
|
apiKeyName: "ANTHROPIC_API_KEY",
|
|
5659
5680
|
baseUrl: provider.baseUrl
|
|
5660
5681
|
});
|
|
5682
|
+
case "google":
|
|
5683
|
+
return createAiSdkLocalizer({
|
|
5684
|
+
factory: (params) => createGoogleGenerativeAI2(params).languageModel(provider.model),
|
|
5685
|
+
id: provider.id,
|
|
5686
|
+
prompt: provider.prompt,
|
|
5687
|
+
apiKeyName: "GOOGLE_API_KEY",
|
|
5688
|
+
baseUrl: provider.baseUrl
|
|
5689
|
+
});
|
|
5661
5690
|
}
|
|
5662
5691
|
}
|
|
5663
5692
|
function createAiSdkLocalizer(params) {
|
|
@@ -5933,7 +5962,8 @@ async function plan(input2) {
|
|
|
5933
5962
|
bucketPathPattern: bucketPath.pathPattern,
|
|
5934
5963
|
injectLocale: bucket.injectLocale || [],
|
|
5935
5964
|
lockedKeys: bucket.lockedKeys || [],
|
|
5936
|
-
lockedPatterns: bucket.lockedPatterns || []
|
|
5965
|
+
lockedPatterns: bucket.lockedPatterns || [],
|
|
5966
|
+
onlyKeys: input2.flags.key || []
|
|
5937
5967
|
});
|
|
5938
5968
|
}
|
|
5939
5969
|
}
|
|
@@ -6084,6 +6114,8 @@ function createWorkerTask(args) {
|
|
|
6084
6114
|
});
|
|
6085
6115
|
const processableData = _32.chain(sourceData).entries().filter(
|
|
6086
6116
|
([key, value]) => delta.added.includes(key) || delta.updated.includes(key) || !!args.ctx.flags.force
|
|
6117
|
+
).filter(
|
|
6118
|
+
([key]) => !assignedTask.onlyKeys.length || assignedTask.onlyKeys.includes(key)
|
|
6087
6119
|
).fromPairs().value();
|
|
6088
6120
|
if (!Object.keys(processableData).length) {
|
|
6089
6121
|
return { status: "skipped" };
|
|
@@ -6168,38 +6200,29 @@ var flagsSchema2 = z2.object({
|
|
|
6168
6200
|
targetLocale: z2.array(z2.string()).optional()
|
|
6169
6201
|
});
|
|
6170
6202
|
|
|
6203
|
+
// src/cli/cmd/run/_utils.ts
|
|
6204
|
+
async function determineAuthId(ctx) {
|
|
6205
|
+
const isByokMode = !!ctx.config?.provider;
|
|
6206
|
+
if (isByokMode) {
|
|
6207
|
+
return null;
|
|
6208
|
+
} else {
|
|
6209
|
+
try {
|
|
6210
|
+
const authStatus = await ctx.localizer?.checkAuth();
|
|
6211
|
+
return authStatus?.username || null;
|
|
6212
|
+
} catch {
|
|
6213
|
+
return null;
|
|
6214
|
+
}
|
|
6215
|
+
}
|
|
6216
|
+
}
|
|
6217
|
+
|
|
6171
6218
|
// src/cli/cmd/run/index.ts
|
|
6172
|
-
import chalk13 from "chalk";
|
|
6173
6219
|
var run_default = new Command16().command("run").description("Run Lingo.dev localization engine").helpOption("-h, --help", "Show help").option(
|
|
6174
6220
|
"--source-locale <source-locale>",
|
|
6175
|
-
"Locale to use as source locale. Defaults to i18n.json locale.source"
|
|
6176
|
-
(val, prev) => {
|
|
6177
|
-
if (!val) return prev;
|
|
6178
|
-
if (!process.argv.includes("--target-locale")) {
|
|
6179
|
-
console.error(
|
|
6180
|
-
`
|
|
6181
|
-
\u274C ${chalk13.red("Error")}: --source-locale must be used together with --target-locale
|
|
6182
|
-
`
|
|
6183
|
-
);
|
|
6184
|
-
process.exit(1);
|
|
6185
|
-
}
|
|
6186
|
-
return val;
|
|
6187
|
-
}
|
|
6221
|
+
"Locale to use as source locale. Defaults to i18n.json locale.source"
|
|
6188
6222
|
).option(
|
|
6189
6223
|
"--target-locale <target-locale>",
|
|
6190
6224
|
"Locale to use as target locale. Defaults to i18n.json locale.targets",
|
|
6191
|
-
(val, prev) =>
|
|
6192
|
-
if (!val) return prev;
|
|
6193
|
-
if (!process.argv.includes("--source-locale")) {
|
|
6194
|
-
console.error(
|
|
6195
|
-
`
|
|
6196
|
-
\u274C ${chalk13.red("Error")}: --target-locale must be used together with --source-locale
|
|
6197
|
-
`
|
|
6198
|
-
);
|
|
6199
|
-
process.exit(1);
|
|
6200
|
-
}
|
|
6201
|
-
return prev ? [...prev, val] : [val];
|
|
6202
|
-
}
|
|
6225
|
+
(val, prev) => prev ? [...prev, val] : [val]
|
|
6203
6226
|
).option(
|
|
6204
6227
|
"--bucket <bucket>",
|
|
6205
6228
|
"Bucket to process",
|
|
@@ -6226,6 +6249,7 @@ var run_default = new Command16().command("run").description("Run Lingo.dev loca
|
|
|
6226
6249
|
"Number of concurrent tasks to run",
|
|
6227
6250
|
(val) => parseInt(val)
|
|
6228
6251
|
).action(async (args) => {
|
|
6252
|
+
let authId = null;
|
|
6229
6253
|
try {
|
|
6230
6254
|
const ctx = {
|
|
6231
6255
|
flags: flagsSchema2.parse(args),
|
|
@@ -6241,6 +6265,11 @@ var run_default = new Command16().command("run").description("Run Lingo.dev loca
|
|
|
6241
6265
|
await renderHero();
|
|
6242
6266
|
await renderSpacer();
|
|
6243
6267
|
await setup(ctx);
|
|
6268
|
+
authId = await determineAuthId(ctx);
|
|
6269
|
+
trackEvent(authId, "cmd.run.start", {
|
|
6270
|
+
config: ctx.config,
|
|
6271
|
+
flags: ctx.flags
|
|
6272
|
+
});
|
|
6244
6273
|
await renderSpacer();
|
|
6245
6274
|
await plan(ctx);
|
|
6246
6275
|
await renderSpacer();
|
|
@@ -6248,7 +6277,12 @@ var run_default = new Command16().command("run").description("Run Lingo.dev loca
|
|
|
6248
6277
|
await renderSpacer();
|
|
6249
6278
|
await renderSummary(ctx.results);
|
|
6250
6279
|
await renderSpacer();
|
|
6280
|
+
trackEvent(authId, "cmd.run.success", {
|
|
6281
|
+
config: ctx.config,
|
|
6282
|
+
flags: ctx.flags
|
|
6283
|
+
});
|
|
6251
6284
|
} catch (error) {
|
|
6285
|
+
trackEvent(authId || "unknown", "cmd.run.error", {});
|
|
6252
6286
|
process.exit(1);
|
|
6253
6287
|
}
|
|
6254
6288
|
});
|
|
@@ -6970,7 +7004,7 @@ import { bucketTypeSchema as bucketTypeSchema4, localeCodeSchema as localeCodeSc
|
|
|
6970
7004
|
import { Command as Command18 } from "interactive-commander";
|
|
6971
7005
|
import Z11 from "zod";
|
|
6972
7006
|
import Ora10 from "ora";
|
|
6973
|
-
import
|
|
7007
|
+
import chalk13 from "chalk";
|
|
6974
7008
|
import Table from "cli-table3";
|
|
6975
7009
|
var status_default = new Command18().command("status").description("Show the status of the localization process").helpOption("-h, --help", "Show help").option("--locale <locale>", "Locale to process", (val, prev) => prev ? [...prev, val] : [val]).option("--bucket <bucket>", "Bucket to process", (val, prev) => prev ? [...prev, val] : [val]).option(
|
|
6976
7010
|
"--file [files...]",
|
|
@@ -7113,7 +7147,7 @@ var status_default = new Command18().command("status").description("Show the sta
|
|
|
7113
7147
|
languageStats[targetLocale].words += sourceWordCount;
|
|
7114
7148
|
totalWordCount.set(targetLocale, (totalWordCount.get(targetLocale) || 0) + sourceWordCount);
|
|
7115
7149
|
bucketOra.succeed(
|
|
7116
|
-
`[${sourceLocale} -> ${targetLocale}] ${
|
|
7150
|
+
`[${sourceLocale} -> ${targetLocale}] ${chalk13.red(`0% complete`)} (0/${sourceKeys.length} keys) - file not found`
|
|
7117
7151
|
);
|
|
7118
7152
|
continue;
|
|
7119
7153
|
}
|
|
@@ -7149,20 +7183,20 @@ var status_default = new Command18().command("status").description("Show the sta
|
|
|
7149
7183
|
const completionPercent = (completeKeys.length / totalKeysInFile * 100).toFixed(1);
|
|
7150
7184
|
if (missingKeys.length === 0 && updatedKeys.length === 0) {
|
|
7151
7185
|
bucketOra.succeed(
|
|
7152
|
-
`[${sourceLocale} -> ${targetLocale}] ${
|
|
7186
|
+
`[${sourceLocale} -> ${targetLocale}] ${chalk13.green(`100% complete`)} (${completeKeys.length}/${totalKeysInFile} keys)`
|
|
7153
7187
|
);
|
|
7154
7188
|
} else {
|
|
7155
|
-
const message = `[${sourceLocale} -> ${targetLocale}] ${parseFloat(completionPercent) > 50 ?
|
|
7189
|
+
const message = `[${sourceLocale} -> ${targetLocale}] ${parseFloat(completionPercent) > 50 ? chalk13.yellow(`${completionPercent}% complete`) : chalk13.red(`${completionPercent}% complete`)} (${completeKeys.length}/${totalKeysInFile} keys)`;
|
|
7156
7190
|
bucketOra.succeed(message);
|
|
7157
7191
|
if (flags.verbose) {
|
|
7158
7192
|
if (missingKeys.length > 0) {
|
|
7159
|
-
console.log(` ${
|
|
7193
|
+
console.log(` ${chalk13.red(`Missing:`)} ${missingKeys.length} keys, ~${wordsToTranslate} words`);
|
|
7160
7194
|
console.log(
|
|
7161
|
-
` ${
|
|
7195
|
+
` ${chalk13.dim(`Example missing: ${missingKeys.slice(0, 2).join(", ")}${missingKeys.length > 2 ? "..." : ""}`)}`
|
|
7162
7196
|
);
|
|
7163
7197
|
}
|
|
7164
7198
|
if (updatedKeys.length > 0) {
|
|
7165
|
-
console.log(` ${
|
|
7199
|
+
console.log(` ${chalk13.yellow(`Updated:`)} ${updatedKeys.length} keys that changed in source`);
|
|
7166
7200
|
}
|
|
7167
7201
|
}
|
|
7168
7202
|
}
|
|
@@ -7177,16 +7211,16 @@ var status_default = new Command18().command("status").description("Show the sta
|
|
|
7177
7211
|
}, 0);
|
|
7178
7212
|
const totalCompletedKeys = totalSourceKeyCount - totalKeysNeedingTranslation / targetLocales.length;
|
|
7179
7213
|
console.log();
|
|
7180
|
-
ora.succeed(
|
|
7181
|
-
console.log(
|
|
7214
|
+
ora.succeed(chalk13.green(`Localization status completed.`));
|
|
7215
|
+
console.log(chalk13.bold.cyan(`
|
|
7182
7216
|
\u2554\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2557`));
|
|
7183
|
-
console.log(
|
|
7184
|
-
console.log(
|
|
7185
|
-
console.log(
|
|
7217
|
+
console.log(chalk13.bold.cyan(`\u2551 LOCALIZATION STATUS REPORT \u2551`));
|
|
7218
|
+
console.log(chalk13.bold.cyan(`\u255A\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u255D`));
|
|
7219
|
+
console.log(chalk13.bold(`
|
|
7186
7220
|
\u{1F4DD} SOURCE CONTENT:`));
|
|
7187
|
-
console.log(`\u2022 Source language: ${
|
|
7188
|
-
console.log(`\u2022 Source keys: ${
|
|
7189
|
-
console.log(
|
|
7221
|
+
console.log(`\u2022 Source language: ${chalk13.green(i18nConfig.locale.source)}`);
|
|
7222
|
+
console.log(`\u2022 Source keys: ${chalk13.yellow(totalSourceKeyCount.toString())} keys across all files`);
|
|
7223
|
+
console.log(chalk13.bold(`
|
|
7190
7224
|
\u{1F310} LANGUAGE BY LANGUAGE BREAKDOWN:`));
|
|
7191
7225
|
const table = new Table({
|
|
7192
7226
|
head: ["Language", "Status", "Complete", "Missing", "Updated", "Total Keys", "Words to Translate"],
|
|
@@ -7208,19 +7242,19 @@ var status_default = new Command18().command("status").description("Show the sta
|
|
|
7208
7242
|
let statusColor;
|
|
7209
7243
|
if (stats.missing === totalSourceKeyCount) {
|
|
7210
7244
|
statusText = "\u{1F534} Not started";
|
|
7211
|
-
statusColor =
|
|
7245
|
+
statusColor = chalk13.red;
|
|
7212
7246
|
} else if (stats.missing === 0 && stats.updated === 0) {
|
|
7213
7247
|
statusText = "\u2705 Complete";
|
|
7214
|
-
statusColor =
|
|
7248
|
+
statusColor = chalk13.green;
|
|
7215
7249
|
} else if (parseFloat(percentComplete) > 80) {
|
|
7216
7250
|
statusText = "\u{1F7E1} Almost done";
|
|
7217
|
-
statusColor =
|
|
7251
|
+
statusColor = chalk13.yellow;
|
|
7218
7252
|
} else if (parseFloat(percentComplete) > 0) {
|
|
7219
7253
|
statusText = "\u{1F7E0} In progress";
|
|
7220
|
-
statusColor =
|
|
7254
|
+
statusColor = chalk13.yellow;
|
|
7221
7255
|
} else {
|
|
7222
7256
|
statusText = "\u{1F534} Not started";
|
|
7223
|
-
statusColor =
|
|
7257
|
+
statusColor = chalk13.red;
|
|
7224
7258
|
}
|
|
7225
7259
|
const words = totalWordCount.get(locale) || 0;
|
|
7226
7260
|
totalWordsToTranslate += words;
|
|
@@ -7228,17 +7262,17 @@ var status_default = new Command18().command("status").description("Show the sta
|
|
|
7228
7262
|
locale,
|
|
7229
7263
|
statusColor(statusText),
|
|
7230
7264
|
`${stats.complete}/${totalSourceKeyCount} (${percentComplete}%)`,
|
|
7231
|
-
stats.missing > 0 ?
|
|
7232
|
-
stats.updated > 0 ?
|
|
7233
|
-
totalNeeded > 0 ?
|
|
7265
|
+
stats.missing > 0 ? chalk13.red(stats.missing.toString()) : "0",
|
|
7266
|
+
stats.updated > 0 ? chalk13.yellow(stats.updated.toString()) : "0",
|
|
7267
|
+
totalNeeded > 0 ? chalk13.magenta(totalNeeded.toString()) : "0",
|
|
7234
7268
|
words > 0 ? `~${words.toLocaleString()}` : "0"
|
|
7235
7269
|
]);
|
|
7236
7270
|
}
|
|
7237
7271
|
console.log(table.toString());
|
|
7238
|
-
console.log(
|
|
7272
|
+
console.log(chalk13.bold(`
|
|
7239
7273
|
\u{1F4CA} USAGE ESTIMATE:`));
|
|
7240
7274
|
console.log(
|
|
7241
|
-
`\u2022 WORDS TO BE CONSUMED: ~${
|
|
7275
|
+
`\u2022 WORDS TO BE CONSUMED: ~${chalk13.yellow.bold(totalWordsToTranslate.toLocaleString())} words across all languages`
|
|
7242
7276
|
);
|
|
7243
7277
|
console.log(` (Words are counted from source language for keys that need translation in target languages)`);
|
|
7244
7278
|
if (targetLocales.length > 1) {
|
|
@@ -7250,11 +7284,11 @@ var status_default = new Command18().command("status").description("Show the sta
|
|
|
7250
7284
|
}
|
|
7251
7285
|
}
|
|
7252
7286
|
if (flags.confirm && Object.keys(fileStats).length > 0) {
|
|
7253
|
-
console.log(
|
|
7287
|
+
console.log(chalk13.bold(`
|
|
7254
7288
|
\u{1F4D1} BREAKDOWN BY FILE:`));
|
|
7255
7289
|
Object.entries(fileStats).sort((a, b) => b[1].wordCount - a[1].wordCount).forEach(([path16, stats]) => {
|
|
7256
7290
|
if (stats.sourceKeys === 0) return;
|
|
7257
|
-
console.log(
|
|
7291
|
+
console.log(chalk13.bold(`
|
|
7258
7292
|
\u2022 ${path16}:`));
|
|
7259
7293
|
console.log(` ${stats.sourceKeys} source keys, ~${stats.wordCount.toLocaleString()} source words`);
|
|
7260
7294
|
const fileTable = new Table({
|
|
@@ -7272,13 +7306,13 @@ var status_default = new Command18().command("status").description("Show the sta
|
|
|
7272
7306
|
const total = stats.sourceKeys;
|
|
7273
7307
|
const completion = (complete / total * 100).toFixed(1);
|
|
7274
7308
|
let status = "\u2705 Complete";
|
|
7275
|
-
let statusColor =
|
|
7309
|
+
let statusColor = chalk13.green;
|
|
7276
7310
|
if (langStats.missing === total) {
|
|
7277
7311
|
status = "\u274C Not started";
|
|
7278
|
-
statusColor =
|
|
7312
|
+
statusColor = chalk13.red;
|
|
7279
7313
|
} else if (langStats.missing > 0 || langStats.updated > 0) {
|
|
7280
7314
|
status = `\u26A0\uFE0F ${completion}% complete`;
|
|
7281
|
-
statusColor =
|
|
7315
|
+
statusColor = chalk13.yellow;
|
|
7282
7316
|
}
|
|
7283
7317
|
let details = "";
|
|
7284
7318
|
if (langStats.missing > 0 || langStats.updated > 0) {
|
|
@@ -7298,16 +7332,16 @@ var status_default = new Command18().command("status").description("Show the sta
|
|
|
7298
7332
|
(locale) => languageStats[locale].missing === 0 && languageStats[locale].updated === 0
|
|
7299
7333
|
);
|
|
7300
7334
|
const missingLanguages = targetLocales.filter((locale) => languageStats[locale].complete === 0);
|
|
7301
|
-
console.log(
|
|
7335
|
+
console.log(chalk13.bold.green(`
|
|
7302
7336
|
\u{1F4A1} OPTIMIZATION TIPS:`));
|
|
7303
7337
|
if (missingLanguages.length > 0) {
|
|
7304
7338
|
console.log(
|
|
7305
|
-
`\u2022 ${
|
|
7339
|
+
`\u2022 ${chalk13.yellow(missingLanguages.join(", "))} ${missingLanguages.length === 1 ? "has" : "have"} no translations yet`
|
|
7306
7340
|
);
|
|
7307
7341
|
}
|
|
7308
7342
|
if (completeLanguages.length > 0) {
|
|
7309
7343
|
console.log(
|
|
7310
|
-
`\u2022 ${
|
|
7344
|
+
`\u2022 ${chalk13.green(completeLanguages.join(", "))} ${completeLanguages.length === 1 ? "is" : "are"} completely translated`
|
|
7311
7345
|
);
|
|
7312
7346
|
}
|
|
7313
7347
|
if (targetLocales.length > 1) {
|
|
@@ -7386,7 +7420,7 @@ function validateParams2(i18nConfig, flags) {
|
|
|
7386
7420
|
import { Command as Command19 } from "interactive-commander";
|
|
7387
7421
|
import * as cp from "node:child_process";
|
|
7388
7422
|
import figlet2 from "figlet";
|
|
7389
|
-
import
|
|
7423
|
+
import chalk14 from "chalk";
|
|
7390
7424
|
import { vice as vice2 } from "gradient-string";
|
|
7391
7425
|
var colors2 = {
|
|
7392
7426
|
orange: "#ff6600",
|
|
@@ -7400,7 +7434,7 @@ var may_the_fourth_default = new Command19().command("may-the-fourth").descripti
|
|
|
7400
7434
|
await renderClear2();
|
|
7401
7435
|
await renderBanner2();
|
|
7402
7436
|
await renderSpacer2();
|
|
7403
|
-
console.log(
|
|
7437
|
+
console.log(chalk14.hex(colors2.yellow)("Loading the Star Wars movie..."));
|
|
7404
7438
|
await renderSpacer2();
|
|
7405
7439
|
await new Promise((resolve, reject) => {
|
|
7406
7440
|
const ssh = cp.spawn("ssh", ["starwarstel.net"], {
|
|
@@ -7419,10 +7453,10 @@ var may_the_fourth_default = new Command19().command("may-the-fourth").descripti
|
|
|
7419
7453
|
});
|
|
7420
7454
|
await renderSpacer2();
|
|
7421
7455
|
console.log(
|
|
7422
|
-
`${
|
|
7456
|
+
`${chalk14.hex(colors2.green)("We hope you enjoyed it! :)")} ${chalk14.hex(colors2.blue)("May the Fourth be with you! \u{1F680}")}`
|
|
7423
7457
|
);
|
|
7424
7458
|
await renderSpacer2();
|
|
7425
|
-
console.log(
|
|
7459
|
+
console.log(chalk14.dim(`---`));
|
|
7426
7460
|
await renderSpacer2();
|
|
7427
7461
|
await renderHero2();
|
|
7428
7462
|
});
|
|
@@ -7445,19 +7479,19 @@ async function renderBanner2() {
|
|
|
7445
7479
|
}
|
|
7446
7480
|
async function renderHero2() {
|
|
7447
7481
|
console.log(
|
|
7448
|
-
`\u26A1\uFE0F ${
|
|
7482
|
+
`\u26A1\uFE0F ${chalk14.hex(colors2.green)("Lingo.dev")} - open-source, AI-powered i18n CLI for web & mobile localization.`
|
|
7449
7483
|
);
|
|
7450
7484
|
console.log(" ");
|
|
7451
7485
|
console.log(
|
|
7452
|
-
|
|
7486
|
+
chalk14.hex(colors2.blue)("\u2B50 GitHub Repo: https://lingo.dev/go/gh")
|
|
7453
7487
|
);
|
|
7454
|
-
console.log(
|
|
7488
|
+
console.log(chalk14.hex(colors2.blue)("\u{1F4AC} 24/7 Support: hi@lingo.dev"));
|
|
7455
7489
|
}
|
|
7456
7490
|
|
|
7457
7491
|
// package.json
|
|
7458
7492
|
var package_default = {
|
|
7459
7493
|
name: "lingo.dev",
|
|
7460
|
-
version: "0.
|
|
7494
|
+
version: "0.97.0",
|
|
7461
7495
|
description: "Lingo.dev CLI",
|
|
7462
7496
|
private: false,
|
|
7463
7497
|
publishConfig: {
|
|
@@ -7570,6 +7604,7 @@ var package_default = {
|
|
|
7570
7604
|
license: "Apache-2.0",
|
|
7571
7605
|
dependencies: {
|
|
7572
7606
|
"@ai-sdk/anthropic": "^1.2.11",
|
|
7607
|
+
"@ai-sdk/google": "^1.2.19",
|
|
7573
7608
|
"@ai-sdk/openai": "^1.3.22",
|
|
7574
7609
|
"@babel/generator": "^7.27.1",
|
|
7575
7610
|
"@babel/parser": "^7.27.1",
|
|
@@ -7579,10 +7614,10 @@ var package_default = {
|
|
|
7579
7614
|
"@gitbeaker/rest": "^39.34.3",
|
|
7580
7615
|
"@inkjs/ui": "^2.0.0",
|
|
7581
7616
|
"@inquirer/prompts": "^7.4.1",
|
|
7617
|
+
"@lingo.dev/_compiler": "workspace:*",
|
|
7618
|
+
"@lingo.dev/_react": "workspace:*",
|
|
7582
7619
|
"@lingo.dev/_sdk": "workspace:*",
|
|
7583
7620
|
"@lingo.dev/_spec": "workspace:*",
|
|
7584
|
-
"@lingo.dev/_react": "workspace:*",
|
|
7585
|
-
"@lingo.dev/_compiler": "workspace:*",
|
|
7586
7621
|
"@modelcontextprotocol/sdk": "^1.5.0",
|
|
7587
7622
|
"@paralleldrive/cuid2": "^2.2.2",
|
|
7588
7623
|
ai: "^4.3.15",
|