findByIso2

Looks up a country by ISO alpha-2 code, case-insensitively.

The result carries the English Country.displayName. That is the right thing for lookup, comparison and storage; it is the wrong thing to put straight on screen in a localized app — use the locale overload for that.


fun findByIso2(code: String?, locale: Locale): Country?(source)

Looks up a country by ISO alpha-2 code with its name in locale.

Use this when seeding a selector with an initial country the user will see, so the name matches what the picker itself shows:

var country by remember {
mutableStateOf(DefaultCountryDataSource.findByIso2("DE", Locale.current))
}

Without it a French user sees "Germany" in the field until they open the sheet, where the same country is listed as "Allemagne".

Identity is unaffected either way: Country compares on Country.iso2Code alone, so a localized instance and an English one are equal and interchangeable as map keys.