RezinaLMS-CustomerEnd/tools/i18n-check.mjs
kirukib 118d26d158 feat: Phase 0 Claude-hosted demo of the e-learning platform
Spec v1.2, Logosmental-based design direction and tokens, pnpm monorepo
(apps/demo, packages/data|features|i18n|db/seed), student + admin screens
in 4 locales, simulated ArifPay checkout on the real order state machine,
artifact inline/check tools, domain rule checks and UI audit fixes.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-06 23:57:11 +03:00

14 lines
785 B
JavaScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

// Fails when a locale catalog is missing keys that en.json has (§12). Usage: node tools/i18n-check.mjs
import fs from 'fs';
const dir = 'packages/i18n/messages';
const flat = (o, p = '') => Object.entries(o).flatMap(([k, v]) => (typeof v === 'object' ? flat(v, p + k + '.') : [p + k]));
const en = new Set(flat(JSON.parse(fs.readFileSync(`${dir}/en.json`, 'utf8'))));
let bad = 0;
for (const loc of ['am', 'om', 'ti']) {
const keys = new Set(flat(JSON.parse(fs.readFileSync(`${dir}/${loc}.json`, 'utf8'))));
const missing = [...en].filter((k) => !keys.has(k));
if (missing.length) { bad++; console.error(`${loc}: missing ${missing.length} keys`, missing.slice(0, 20)); }
}
console.log(bad ? 'i18n: FAIL' : `i18n: OK (${en.size} keys × 4 locales)`);
process.exit(bad ? 1 : 0);