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>
This commit is contained in:
Tomaz Canabrava 2013-12-06 14:29:38 -02:00 committed by Dirk Hohndel
parent bfe5ccda1c
commit 4e263bae98
5 changed files with 118 additions and 18 deletions

View file

@ -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");