QLocale::uiLanguages() returns erroneous value



  • 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=
    @


  • Lifetime Qt Champion

    Hi,

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


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.