I need to write a multilingual program where users can set their home country and nationality on their profile pages. I can get a list of country names with python and babel easily.
For example, to get "german" language name in slovakian:
from babel import Locale
locale = Locale('de')
print(locale.get_language_name('sk')) # 'nemčina'
It is possible to get the country names in a very similar way. To get the name of "Hungary" in german language:
print(loc.territories["HU"]) # 'Ungarn'
Selecting the nationality name of a person is part of the internationalization process. However, I cannot find a way to get (localized) nationality names. For example, here is Mexico:
from babel import Locale
locale = Locale('en')
print(locale.territories["MX"]) # 'Mexico'
The nationality name is "mexican". It is different from the territory name ('Mexico') and also different from the language name ('Spanish').
Maybe babel cannot be used to determine (translated) nationality names? Is there a library that can be used for this? I would also be happy with a simple database instead of a library. Just I cannot find it. :-(