feat(core): add built-in locale packs and lazy loadLocale (#1590)

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
Sam Potts
2026-06-18 12:16:47 -07:00
committed by GitHub
co-authored by Cursor
parent 768bf09da0
commit 9170a5879e
171 changed files with 3416 additions and 6 deletions
@@ -0,0 +1,20 @@
import { mkdirSync, writeFileSync } from 'node:fs';
import { dirname, resolve } from 'node:path';
import { fileURLToPath } from 'node:url';
import { SHIPPED_LOCALE_TAGS } from '../../core/src/core/i18n/built-in-locales.ts';
const REGISTRY = '@videojs/html/cdn/i18n-registry';
const outDir = resolve(dirname(fileURLToPath(import.meta.url)), '../src/cdn/locales');
const tags = SHIPPED_LOCALE_TAGS;
mkdirSync(outDir, { recursive: true });
for (const tag of tags) {
const body = `import { registerI18n } from '${REGISTRY}';
import translations from '@videojs/core/i18n/locales/${tag}';
registerI18n('${tag}', translations);
`;
writeFileSync(resolve(outDir, `${tag}.ts`), body);
}