getLocalizedCountryName

fun getLocalizedCountryName(country: Country, localeLanguageTag: String = getLocaleLanguageTag()): String

Retrieves the localized country name based on the provided locale language tag.

This function uses the localeLanguageTag to fetch the translated country name in the desired language. If no locale is provided, it defaults to the current system locale.

Return

The localized country name as a String based on the provided language tag. If localization fails, it falls back to the country code itself.

Example: Get the country name in German val countryGermany = Countries.DE val localizedNameGerman = countryGermany.getLocalizedCountryName(countryGermany, "de-DE") println(localizedNameGerman) // Outputs: "Deutschland" (since "Germany" is "Deutschland" in German)

Parameters

country

The Country object for which the localized name is to be fetched. The countryCode property of this object is used to determine the country.

localeLanguageTag

The language tag representing the desired language/region (e.g., "en-US", "fr-FR"). If not provided, the current system locale will be used by default.