fix(radio): resolve common country exonyms Intl.DisplayNames omits (#232)

Recognize common country names and exonyms in Radio country requests and station filtering. Keep ambiguous country names rejected.
This commit is contained in:
Malek authored and GitHub committed 2026-09-10 21:01:39 -07:00
1 parent 024738a8d2
commit 87a92c8bc4
4 files changed
+57 -3

No files matched your search

+16
View File
@@ -55,6 +55,22 @@ for (const [name, code] of Object.entries({
brunei: 'BN',
'cape verde': 'CV',
'the netherlands': 'NL',
// Common English names and exonyms whose code is not reachable through the
// Intl.DisplayNames primary label, so they would otherwise fail closed
// (verified against ICU 77): TR resolves only as 'Türkiye', MM only as
// 'Myanmar (Burma)', AE only as 'United Arab Emirates', SZ as 'Eswatini',
// TL as 'Timor-Leste'. Each maps to exactly one country; ambiguous names
// (e.g. bare "Congo") are deliberately left to fail closed.
turkey: 'TR',
turkiye: 'TR',
myanmar: 'MM',
burma: 'MM',
uae: 'AE',
holland: 'NL',
swaziland: 'SZ',
'east timor': 'TL',
'cabo verde': 'CV',
vatican: 'VA',
})) COUNTRY_NAME_TO_CODE.set(countryKey(name), code);
function canonicalCountryName(code) {