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. How to detect the current language on Windows (I need the Qt way)
Forum Updated to NodeBB v4.3 + New Features

How to detect the current language on Windows (I need the Qt way)

Scheduled Pinned Locked Moved Solved General and Desktop
9 Posts 2 Posters 3.1k Views 2 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.
  • mrdebugM Offline
    mrdebugM Offline
    mrdebug
    wrote on last edited by mrdebug
    #1

    According with this post,
    https://stackoverflow.com/questions/18594380/qlocale-detects-system-language-incorrectly-on-windows-with-language-pack-instal?utm_medium=organic&utm_source=google_rich_qa&utm_campaign=google_rich_qa
    the line of code
    QLocale::system().name()
    returns the value pointed from the red arrow. I need to have back the value of the green arrow.
    Which is the right Qt way?
    0_1525242009814_Screenshot_20180502_081411.png

    Need programmers to hire?
    www.labcsp.com
    www.denisgottardello.it
    GMT+1
    Skype: mrdebug

    1 Reply Last reply
    0
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Hi,

      Do you mean both the name and the country name ?

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      1 Reply Last reply
      0
      • mrdebugM Offline
        mrdebugM Offline
        mrdebug
        wrote on last edited by
        #3

        No, I need only the selected language.
        For example I need "it" when italian language is selected, "en" when english language is selected.

        Need programmers to hire?
        www.labcsp.com
        www.denisgottardello.it
        GMT+1
        Skype: mrdebug

        1 Reply Last reply
        0
        • SGaistS Offline
          SGaistS Offline
          SGaist
          Lifetime Qt Champion
          wrote on last edited by
          #4

          Then maybe, QLocale::uiLanguages is what you are looking for.

          Or just check what a default constructed QLocale object returns.

          Interested in AI ? www.idiap.ch
          Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

          1 Reply Last reply
          2
          • mrdebugM Offline
            mrdebugM Offline
            mrdebug
            wrote on last edited by
            #5

            Ok, I try

            Need programmers to hire?
            www.labcsp.com
            www.denisgottardello.it
            GMT+1
            Skype: mrdebug

            1 Reply Last reply
            0
            • mrdebugM Offline
              mrdebugM Offline
              mrdebug
              wrote on last edited by
              #6

              Sorry but I was wrong. The green arrow indicates the keyboard layout, not the current language. So
              QLocale::system().name()
              is right.

              Need programmers to hire?
              www.labcsp.com
              www.denisgottardello.it
              GMT+1
              Skype: mrdebug

              1 Reply Last reply
              0
              • SGaistS Offline
                SGaistS Offline
                SGaist
                Lifetime Qt Champion
                wrote on last edited by
                #7

                So everything is working as expected ?

                Interested in AI ? www.idiap.ch
                Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                1 Reply Last reply
                0
                • mrdebugM Offline
                  mrdebugM Offline
                  mrdebug
                  wrote on last edited by
                  #8

                  Yes it is

                  Need programmers to hire?
                  www.labcsp.com
                  www.denisgottardello.it
                  GMT+1
                  Skype: mrdebug

                  1 Reply Last reply
                  0
                  • SGaistS Offline
                    SGaistS Offline
                    SGaist
                    Lifetime Qt Champion
                    wrote on last edited by
                    #9

                    Then please mark the thread as solved :)

                    Interested in AI ? www.idiap.ch
                    Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                    1 Reply Last reply
                    1

                    • Login

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