Match currency search against issuing country names too

Searching "Japan" now finds JPY, "Canada" finds CAD, etc. — matching
just the currency's own display name wasn't enough, since e.g.
"Canadian Dollar" doesn't contain "Canada" as a substring.

Adds a per-platform regionDisplayName(regionCode) (java.util.Locale
on JVM/Android, NSLocale on Apple, Intl.DisplayNames on web) and
reuses CurrencyFlag.kt's currency-to-country-code derivation (now
extracted as issuingCountryCodes) to look up the country/countries
behind a currency code. "EU" is hardcoded to "European Union" since
it's not a real ISO 3166-1 code platform locale data can resolve.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01FXcrACM5sok3M1KQJ8kByy
This commit is contained in:
2026-09-10 08:36:12 +03:00
co-authored by Claude Sonnet 5
parent 25a69d8f69
commit eafaeaa8d3
7 changed files with 103 additions and 23 deletions
@@ -37,3 +37,9 @@ actual fun currencyDecimalDigits(code: String): Int = try {
} catch (e: IllegalArgumentException) {
2
}
@Suppress("DEPRECATION") // Locale(language, country) still works fine; Locale.of() needs newer Android API levels.
actual fun regionDisplayName(regionCode: String): String? {
if (regionCode !in Locale.getISOCountries()) return null
return Locale("", regionCode).getDisplayCountry(Locale.getDefault())
}