No way to create localized list of country names?
I am a newbie at Qt, so this is probably a very simple question:
I can't find a Qt equivalent to the ICU Locale::getDisplayCountry function. I am looking for a function that will allow me to display a list of country names, all localized into the same language.
I have found QLocale::countryToString, but that just gives me the invariant QLocale name for the country, not a localized version. And QLocale::nativeCountryName () seems to work only for actual locale combinations (I can get the Spanish name for Spain, but not the Spanish name for Denmark, for instance).
Did I overlook something?
I'm trying to do the same thing and did not find a way. It looks like QLocale can't do it.
bq. I am looking for a function that will allow me to display a list of country names, all localized into the same language.
You can simply create the list yourself:
list << tr("First country name");
list << tr("Second country name");
list << tr("Third country name");
/* ... */@
The strings you write in tr() will become translatable, so you can simply translate those strings in Qt Linguist, separately for each language you want to support in your software.
Then simply install the desired translator using qApp->installTranslator() as usual...
(If your actual question was whether Qt already contains translations of all country names into all languages, then I'm not quite sure. But the answer might be that it doesn't. And then you'll have to do it yourself)
Try to look at "this language manager":http://www.workslikeclockwork.com/index.php/components/language-manager/
@MulderR That goes without saying. Obviously we're searching for a way that does not require human translators. QLocale internally has the needed data but somehow fails to address this use case.
@Wilk I don't see how that class is relevant to this thread.