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. QLocale::uiLanguages() returns erroneous value
Forum Updated to NodeBB v4.3 + New Features

QLocale::uiLanguages() returns erroneous value

Scheduled Pinned Locked Moved General and Desktop
2 Posts 2 Posters 999 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.
  • A Offline
    A Offline
    alexandros
    wrote on last edited by
    #1

    I want to enable automatic language detection for my application.

    So, I call

    @
    translator->load(QLocale::system(), "wallch", "_", translationsFolder, ".qm")
    @

    This should load the appropriate qm file based on system language.

    But it fails miserably because it detects English and not Greek.

    I searched a bit the QLocale documentation and the code
    @
    qDebug() << QLocale::system().uiLanguages();
    @
    returns
    @
    ("en-US")
    @
    which is totally wrong, because on my system's locale settings (KDE 4.14.1, KUbuntu 14.10) I've set Greek as my preferred and then English:

    !http://i.imgur.com/TiPsPkY.png(Preferred Languages)!

    Does anyone know if this is a bug or whether I'm doing something wrong?

    It's worth noting that my whole system user interface is displayed in Greek, the menus, the programs, everything. Also it's worth noting that KDE applications (that detect that Greek is the appropriate language to load the application in) are actually written in Qt too!

    Output of the locale command under my system:

    @
    alex@MaD-pc:~$ locale
    LANG=en_US.UTF-8
    LANGUAGE=en_US
    LC_CTYPE="en_US.UTF-8"
    LC_NUMERIC=el_GR.UTF-8
    LC_TIME=el_GR.UTF-8
    LC_COLLATE="en_US.UTF-8"
    LC_MONETARY=el_GR.UTF-8
    LC_MESSAGES="en_US.UTF-8"
    LC_PAPER=el_GR.UTF-8
    LC_NAME=el_GR.UTF-8
    LC_ADDRESS=el_GR.UTF-8
    LC_TELEPHONE=el_GR.UTF-8
    LC_MEASUREMENT=el_GR.UTF-8
    LC_IDENTIFICATION=el_GR.UTF-8
    LC_ALL=
    @

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

      Hi,

      AFAIK, and from your post, it seems that QLocale is using english
      @
      LANG=en_US.UTF-8
      LANGUAGE=en_US
      @

      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

      • Login

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