]> git.lyx.org Git - features.git/commitdiff
Fix setting Interlingua as GUI language
authorJean-Marc Lasgouttes <lasgouttes@lyx.org>
Tue, 17 Mar 2015 10:34:28 +0000 (11:34 +0100)
committerJean-Marc Lasgouttes <lasgouttes@lyx.org>
Tue, 17 Mar 2015 11:37:24 +0000 (12:37 +0100)
The problem came from the fact that Qt associates Interlingua to locale C.
Now, we do not rely anymore on the Qt locale to set the language. I suspect that the problem will still exist if the system locale is ia_IA.

Fixes bug #9267.

src/frontends/qt4/GuiApplication.cpp

index 39b73cf062060e6eb8f1e7e5ff347341885e73a4..f858d85c90326e017ed65c8193ed3f0a2e61df94 100644 (file)
@@ -192,16 +192,19 @@ frontend::Application * createApplication(int & argc, char * argv[])
 void setLocale()
 {
        QLocale theLocale;
+       string code;
        if (lyxrc.gui_language == "auto") {
                theLocale = QLocale::system();
+               code = fromqstr(theLocale.name());
+               // Qt tries to outsmart us and transforms en_US to C.
+               if (code == "C")
+                       code = "en_US";
        } else {
                Language const * l = languages.getLanguage(lyxrc.gui_language);
-               string const code = l ? l->code() : string();
+               code = l ? l->code() : string();
                theLocale = QLocale(toqstr(code));
        }
-       string const code = fromqstr(theLocale.name());
-       // Qt tries to outsmart us and transforms en_US to C.
-       Messages::guiLanguage((code == "C") ? "en_US" : code);
+       Messages::guiLanguage(code);
        QLocale::setDefault(theLocale);
        setlocale(LC_NUMERIC, "C");
 }