diff options
author | Tomaz Canabrava <tcanabrava@kde.org> | 2013-12-06 14:29:38 -0200 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2013-12-06 09:49:05 -0800 |
commit | 4e263bae987bcc343497496bcdc962c292977b6a (patch) | |
tree | 9cf584fe5c83493356e64a0b17faae4bbb31ad55 /qt-gui.cpp | |
parent | bfe5ccda1ca50221828255e8f017a5f0180a020a (diff) | |
download | subsurface-4e263bae987bcc343497496bcdc962c292977b6a.tar.gz |
Added a language preference to the Settings.
When the user first opens the application the default language is
selected; this can be changed to a hardcoded one by going to system
preferences and choosing the one you want.
Restart required.
Fixes #136
[Dirk Hohndel: whitespace fixes, removed qDebug() call, rephrased the
message displayed prompting the user to restart.]
Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'qt-gui.cpp')
-rw-r--r-- | qt-gui.cpp | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/qt-gui.cpp b/qt-gui.cpp index b3dff800b..a65621314 100644 --- a/qt-gui.cpp +++ b/qt-gui.cpp @@ -87,8 +87,12 @@ void init_ui(int *argcp, char ***argvp) QCoreApplication::addLibraryPath(QCoreApplication::applicationDirPath()); xslt_path = strdup(getSubsurfaceDataPath("xslt").toAscii().data()); - QLocale loc; + QSettings s; + s.beginGroup("Language"); + QLocale loc(s.value("UiLanguage", QLocale().uiLanguages().first()).toString()); QString uiLang = loc.uiLanguages().first(); + s.endGroup(); + // there's a stupid Qt bug on MacOS where uiLanguages doesn't give us the country info if (!uiLang.contains('-') && uiLang != loc.bcp47Name()) { QLocale loc2(loc.bcp47Name()); @@ -117,7 +121,6 @@ void init_ui(int *argcp, char ***argvp) } } - QSettings s; s.beginGroup("DiveComputer"); default_dive_computer_vendor = getSetting(s, "dive_computer_vendor"); default_dive_computer_product = getSetting(s,"dive_computer_product"); |