CI / policy (pull_request) Successful in 11s
CI / validate (pull_request) Successful in 43s
CI / build (pull_request) Successful in 38s
CI / benchmark (pull_request) Successful in 1m42s
CI / security (pull_request) Successful in 1m5s
CI / test (pull_request) Successful in 2m58s
CI / images (pull_request) Successful in 1m15s
CI / required (pull_request) Successful in 1s
CI / policy (push) Successful in 6s
CI / build (push) Successful in 35s
CI / validate (push) Successful in 42s
CI / benchmark (push) Successful in 1m31s
CI / security (push) Successful in 1m44s
CI / test (push) Successful in 2m45s
CI / images (push) Successful in 54s
CI / required (push) Successful in 1s
French (and German/Spanish) users saw English wherever the UI rendered planning-engine reason messages or raw identifiers. - Look up planner reasons by code in planning.reasons and planning.validationReasons instead of rendering reason.message; the engine keeps its English messages. - Show calculation stages with their translated labels. - Translate the Material datepicker labels and the comparison date placeholder; add the declared-day comparison reason. - Keep <html lang> in sync with the loaded translation. - Generate the registry with English first and `satisfies AppTranslations`, and test that every language has en.json's keys. - Fix fr "Weekend" -> "Week-end". Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
40 lines
1.3 KiB
JavaScript
40 lines
1.3 KiB
JavaScript
const fs = require('fs');
|
|
const path = require('path');
|
|
|
|
const i18nDir = path.join(__dirname, '../src/i18n');
|
|
const registryFile = path.join(__dirname, '../src/app/i18n-registry.ts');
|
|
|
|
if (!fs.existsSync(i18nDir)) {
|
|
console.error(`i18n directory not found at ${i18nDir}`);
|
|
process.exit(1);
|
|
}
|
|
|
|
const files = fs
|
|
.readdirSync(i18nDir)
|
|
.filter((file) => file.endsWith('.json'))
|
|
// English first: TranslationService falls back to the first language.
|
|
.sort((a, b) => (b === 'en.json') - (a === 'en.json') || a.localeCompare(b));
|
|
|
|
let importStatements = '';
|
|
let registryEntries = '';
|
|
|
|
files.forEach((file) => {
|
|
const langCode = path.basename(file, '.json');
|
|
importStatements += `import ${langCode} from '../i18n/${file}';\n`;
|
|
registryEntries += `\t${langCode}: ${langCode} satisfies AppTranslations,\n`;
|
|
});
|
|
|
|
const content = `// This file is auto-generated by scripts/generate-langs.js. Do not edit directly.
|
|
import { AppTranslations } from './services/translation-service';
|
|
${importStatements}
|
|
export const translationsMap: Record<string, AppTranslations> = {
|
|
${registryEntries}};
|
|
|
|
export const availableLanguagesList: string[] = Object.keys(translationsMap);
|
|
`;
|
|
|
|
fs.writeFileSync(registryFile, content, 'utf8');
|
|
console.log(
|
|
`Successfully generated i18n registry at ${registryFile} with ${files.length} languages.`,
|
|
);
|