feat(i18n): expand supported languages from 31 to 49 with flags and locale formats
Add 18 previously missing language entries to SUPPORTED_LANGUAGES in app/utils/i18n.py so every translation JSON file in frontend/translations/ is properly indexed and served by the language selector: New languages: af, ar, cy, eo, fa, fy, gl, he, ja, kn, ko, li, nds, no, pa, sr, vi, vls Each new language entry includes: - Correct ISO 639-1/639-3 code matching its JSON filename - Native name and display name - Appropriate country/language flag emoji - Locale-specific date and number formatting rules in _LOCALE_FORMATS Also: rename nb "Norwegian" → "Norwegian Bokmål" to distinguish it from no "Norwegian". Update tests/test_i18n.py: - Count assertions: 31 → 49 - Expected code set expanded to all 49 codes - Fix test_unsupported_language_fallback (ja/ko now supported, use xx/yy) Update docs/InternationalizationGuide.md: - Language count: 10 → 49 - Full language table with flags, native names, tiers - Complete file structure listing all 49 JSON files Co-authored-by: christianlouis <361235+christianlouis@users.noreply.github.com>
This commit is contained in:
+24
-6
@@ -161,7 +161,7 @@ class TestParseAcceptLanguage:
|
||||
|
||||
@pytest.mark.unit
|
||||
def test_unsupported_language_fallback(self) -> None:
|
||||
result = _parse_accept_language("ja, ko")
|
||||
result = _parse_accept_language("xx, yy")
|
||||
assert result is None
|
||||
|
||||
@pytest.mark.unit
|
||||
@@ -326,7 +326,7 @@ class TestSupportedLanguages:
|
||||
|
||||
@pytest.mark.unit
|
||||
def test_ten_languages_supported(self) -> None:
|
||||
assert len(SUPPORTED_LANGUAGES) == 31
|
||||
assert len(SUPPORTED_LANGUAGES) == 49
|
||||
|
||||
@pytest.mark.unit
|
||||
def test_supported_codes_set(self) -> None:
|
||||
@@ -338,10 +338,8 @@ class TestSupportedLanguages:
|
||||
"it",
|
||||
"pt",
|
||||
"nl",
|
||||
"pl",
|
||||
"zh",
|
||||
"ru",
|
||||
"nb",
|
||||
"no",
|
||||
"da",
|
||||
"sv",
|
||||
"fi",
|
||||
@@ -349,6 +347,13 @@ class TestSupportedLanguages:
|
||||
"ga",
|
||||
"lb",
|
||||
"ca",
|
||||
"cy",
|
||||
"fy",
|
||||
"gl",
|
||||
"li",
|
||||
"vls",
|
||||
"nds",
|
||||
"pl",
|
||||
"cs",
|
||||
"sk",
|
||||
"hu",
|
||||
@@ -360,8 +365,21 @@ class TestSupportedLanguages:
|
||||
"et",
|
||||
"lv",
|
||||
"lt",
|
||||
"sr",
|
||||
"tr",
|
||||
"uk",
|
||||
"ru",
|
||||
"he",
|
||||
"ar",
|
||||
"fa",
|
||||
"af",
|
||||
"zh",
|
||||
"ja",
|
||||
"ko",
|
||||
"vi",
|
||||
"pa",
|
||||
"kn",
|
||||
"eo",
|
||||
}
|
||||
assert SUPPORTED_LANGUAGE_CODES == expected
|
||||
|
||||
@@ -385,7 +403,7 @@ class TestI18nAPI:
|
||||
assert response.status_code == 200
|
||||
data = response.json()
|
||||
assert "languages" in data
|
||||
assert len(data["languages"]) == 31
|
||||
assert len(data["languages"]) == 49
|
||||
assert data["default"] == "en"
|
||||
# Verify each language has required fields
|
||||
for lang in data["languages"]:
|
||||
|
||||
Reference in New Issue
Block a user