@prettifystudio/lyngo-cli 0.1.1 → 0.1.2
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/bin/lyngo +8 -3
- package/package.json +1 -1
package/bin/lyngo
CHANGED
|
@@ -8,7 +8,8 @@
|
|
|
8
8
|
// lyngo whoami who the token belongs to
|
|
9
9
|
// lyngo init [--languages fr,de] [--primary en] [--workspace <name>] [--yes] [--github]
|
|
10
10
|
// connect this repository: project, scaffolding, languages, agent hook
|
|
11
|
-
// lyngo localize [--languages fr,de] [--dry]
|
|
11
|
+
// lyngo localize [--languages fr,de] [--no-translate] [--dry]
|
|
12
|
+
// localize (+ translate) the working tree's changes
|
|
12
13
|
// lyngo check <file> the user-facing strings of one file
|
|
13
14
|
// lyngo status the project as Lyngo knows it
|
|
14
15
|
//
|
|
@@ -488,6 +489,8 @@ async function localize(opts) {
|
|
|
488
489
|
const payload = files.map((p) => ({ path: p, content: fs.readFileSync(p, 'utf8') }));
|
|
489
490
|
const args = { files: payload, catalogs: catalogs.map((c) => ({ path: c.path, content: fs.existsSync(c.path) ? fs.readFileSync(c.path, 'utf8') : c.content })), format: 'patch' };
|
|
490
491
|
if (opts.languages) args.languages = opts.languages.filter((l) => l !== status.primary_language);
|
|
492
|
+
// --no-translate: keys only, catalogs for translators. Without the flag the project's setting decides.
|
|
493
|
+
if (opts['no-translate']) args.translate = false;
|
|
491
494
|
const r = await call('localize', args);
|
|
492
495
|
if (r.patch && r.patch.trim()) {
|
|
493
496
|
if (opts.dry) { process.stdout.write(r.patch); }
|
|
@@ -512,6 +515,7 @@ async function localize(opts) {
|
|
|
512
515
|
const wrapped = report.files.reduce((n, f) => n + f.wrapped.length, 0);
|
|
513
516
|
console.log(`lyngo: ${wrapped} string${wrapped === 1 ? '' : 's'} localized in ${report.files.length} file${report.files.length === 1 ? '' : 's'}; ${report.added.length} new key${report.added.length === 1 ? '' : 's'}, ${report.reused.length} reused.`);
|
|
514
517
|
for (const f of report.files) console.log(` ${f.path}: ${f.wrapped.slice(0, 6).map((s) => JSON.stringify(s)).join(', ')}${f.wrapped.length > 6 ? ', …' : ''}`);
|
|
518
|
+
if (opts['no-translate'] || (status.translate_on_localize === false && !Object.keys(report.languages).length)) console.log(' catalogs: not translated (keys only).');
|
|
515
519
|
for (const [code, l] of Object.entries(report.languages)) {
|
|
516
520
|
const flagged = l.flagged.length ? `; ${l.flagged.length} flagged for review: ${l.flagged.slice(0, 3).map((x) => JSON.stringify(x.key || x)).join(', ')}` : '';
|
|
517
521
|
console.log(` ${code}: ${l.translated} translated, ${l.from_memory} from memory${flagged}`);
|
|
@@ -548,8 +552,9 @@ const HELP = `lyngo ${version()}: localization for your repository, from the ter
|
|
|
548
552
|
lyngo init [--languages fr,de] [--primary en] [--workspace <name>] [--yes] [--github]
|
|
549
553
|
connect this repository: project, i18n setup, languages, agent hook
|
|
550
554
|
(--languages are the target languages; the source stays en unless --primary)
|
|
551
|
-
lyngo localize [--languages fr,de] [--dry]
|
|
552
|
-
localize
|
|
555
|
+
lyngo localize [--languages fr,de] [--no-translate] [--dry]
|
|
556
|
+
localize what changed in the working tree, and translate it
|
|
557
|
+
(--no-translate: keys only; the project setting "Translate when localizing" is the default)
|
|
553
558
|
lyngo translate <code> [<code>…] fill every key a language's catalog lacks, from the primary catalog
|
|
554
559
|
lyngo check <file> the user-facing strings of one file
|
|
555
560
|
lyngo status the project as Lyngo knows it
|
package/package.json
CHANGED