Map from ISO country code to native name

Anyway to convert some code like BR into Brasil? I currently have data to map from BR to Brazil, but not in its native language (pt-BR = Brasil, en-US = Brazil).

Looks like I get a lot of good search results searching for "iso 3166"

These are the top results:

  • iso_country only maps to international names.
  • dia-i18n also only maps to international names. Languages translate both to native and international names (like what I do already support in rialight_localization) and doesn't include country/region native name.
  • iso3166-3 doesn't map to any name.
  • isocountry only maps to international names.
  • country-code doesn't map to any name.
  • iso-rs is the same situation as dia-i18n. But this crate also seems useful as it provides timezone and currency.
  • rust_iso3166 only maps to international names.

What should BE return for Belgium? As far as I can tell Belgiƫ, Belgique and Belgien are all equally valid choices, and there's no standard defining what you're looking for. A (Country, Language) -> CountryName mapping seems more appropriate, but then in most cases where you want that you want full-on localisation. I imagine that's why there's no crate that does what you want.


I'm not sure I need to map from name to code. I think Country -> InternationalCountryName and Country -> NativeCountryName are enough for general localization.

The question is, what is the native name of a country with several official languages?

Countries, states and languages overlap but don't match.


The most popular, I guess? Or maybe @Heliozoa is right, it makes sense to be able to translate country code to name in any language. I found a NPM package earlier that maps from language code to name in whatever language, but I don't think such NPM package covers countries...

Oh, btw the NPM package I just talked about is country-name, which allows you to retrieve the country name in a given language. I used it before, but for language tags I was only able to retrieve either international or native name.

I think it's not trivial to port it to Rust, but I'll see...

This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.