Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. No way to create localized list of country names?
Forum Updated to NodeBB v4.3 + New Features

No way to create localized list of country names?

Scheduled Pinned Locked Moved General and Desktop
5 Posts 4 Posters 4.4k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • E Offline
    E Offline
    eflarup
    wrote on last edited by
    #1

    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?

    1 Reply Last reply
    0
    • F Offline
      F Offline
      flaviotordini
      wrote on last edited by
      #2

      I'm trying to do the same thing and did not find a way. It looks like QLocale can't do it.

      1 Reply Last reply
      0
      • M Offline
        M Offline
        MuldeR
        wrote on last edited by
        #3

        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:
        @QStringList list;
        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)

        My OpenSource software at: http://muldersoft.com/

        Qt v4.8.6 MSVC 2013, static/shared: http://goo.gl/BXqhrS

        Go visit the coop: http://youtu.be/Jay...

        1 Reply Last reply
        0
        • W Offline
          W Offline
          Wilk
          wrote on last edited by
          #4

          Hello.
          Try to look at "this language manager":http://www.workslikeclockwork.com/index.php/components/language-manager/

          1 Reply Last reply
          0
          • F Offline
            F Offline
            flaviotordini
            wrote on last edited by
            #5

            @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.

            1 Reply Last reply
            0

            • Login

            • Login or register to search.
            • First post
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • Users
            • Groups
            • Search
            • Get Qt Extensions
            • Unsolved