Apps, web, i18n, UI, partners, payouts, backoffice, bariki, prod infra
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
1 parent
45d7512d2b
commit
3489e0b816
319 files changed
+45483
-121
No files matched your search
@@ -0,0 +1,31 @@
|
||||
/**
|
||||
* Выгрузка для носителей языка: i18n-review/<lang>.csv
|
||||
* key, ru, translation, status, approved
|
||||
* Носитель правит колонку translation и ставит "yes" в approved, затем: pnpm i18n:import <файл>.
|
||||
*
|
||||
* pnpm i18n:export — все языки, только needs_review
|
||||
* pnpm i18n:export -- --all — все ключи
|
||||
*/
|
||||
import { mkdirSync, writeFileSync } from 'node:fs';
|
||||
import path from 'node:path';
|
||||
import { csvEscape, readLocale, readReview, ROOT, statusOf, TARGETS } from './lib.ts';
|
||||
|
||||
const all = process.argv.includes('--all');
|
||||
const ru = readLocale('ru');
|
||||
const review = readReview();
|
||||
const outDir = path.resolve(ROOT, '../../i18n-review');
|
||||
mkdirSync(outDir, { recursive: true });
|
||||
|
||||
for (const locale of TARGETS) {
|
||||
const msgs = readLocale(locale);
|
||||
const rows = [['key', 'ru', 'translation', 'status', 'approved']];
|
||||
for (const [key, source] of Object.entries(ru)) {
|
||||
const status = statusOf(review, locale, key, source, msgs[key]);
|
||||
if (!all && status === 'approved') continue;
|
||||
rows.push([key, source, msgs[key] ?? '', status, '']);
|
||||
}
|
||||
const file = path.join(outDir, `${locale}.csv`);
|
||||
// BOM — чтобы Excel открыл UTF-8 с армянским и китайским
|
||||
writeFileSync(file, '' + rows.map((r) => r.map(csvEscape).join(',')).join('\n') + '\n');
|
||||
console.log(`${file}: ${rows.length - 1} строк`);
|
||||
}
|
||||
Reference in new issue
Block a user