mirror of
https://github.com/Matysh/houseplan-card
synced 2026-10-07 23:19:14 +00:00
@@ -5,6 +5,8 @@ import { readdirSync, readFileSync } from 'node:fs';
|
||||
import {
|
||||
FALLBACK_LANGUAGE_CODE,
|
||||
LANGUAGE_REGISTRY,
|
||||
buildLanguageLookup,
|
||||
languageEntry,
|
||||
languageOptions,
|
||||
normalizeLanguageTag,
|
||||
resolveLanguageCode,
|
||||
@@ -38,6 +40,16 @@ test('i18n: registry codes and English fallback are valid', () => {
|
||||
}
|
||||
});
|
||||
|
||||
test('i18n: canonical regional codes use normalized lookup keys', () => {
|
||||
const regional = { code: 'pt-BR', nativeLabel: 'Português (Brasil)', dictionary: {} };
|
||||
const lookup = buildLanguageLookup([regional]);
|
||||
assert.equal(lookup.get('pt-br'), regional);
|
||||
assert.equal(lookup.get(normalizeLanguageTag('PT_br')), regional);
|
||||
for (const entry of LANGUAGE_REGISTRY) {
|
||||
assert.equal(languageEntry(entry.code.toUpperCase()), entry);
|
||||
}
|
||||
});
|
||||
|
||||
test('i18n: registry matches frontend and backend locale files', () => {
|
||||
const registryCodes = LANGUAGE_REGISTRY.map(({ code }) => code).sort();
|
||||
const localeCodes = (url) => readdirSync(url)
|
||||
|
||||
Reference in New Issue
Block a user