From b972bdb97dea32bb7d67f54786f06fa687d15b99 Mon Sep 17 00:00:00 2001 From: Dirk Hohndel Date: Tue, 20 Sep 2016 12:44:26 -0700 Subject: [PATCH] Language preference: store the locale name in the settings Signed-off-by: Dirk Hohndel --- desktop-widgets/preferences/preferences_language.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/desktop-widgets/preferences/preferences_language.cpp b/desktop-widgets/preferences/preferences_language.cpp index 7484bbe96..3a6720b4f 100644 --- a/desktop-widgets/preferences/preferences_language.cpp +++ b/desktop-widgets/preferences/preferences_language.cpp @@ -53,9 +53,16 @@ void PreferencesLanguage::syncSettings() QMessageBox::warning(this, tr("Restart required"), tr("To correctly load a new language you must restart Subsurface.")); } + QAbstractItemModel *m = ui->languageDropdown->model(); + QModelIndexList languages = m->match(m->index(0, 0), Qt::DisplayRole, currentText); + QString currentLocale; + if (languages.count()) + currentLocale = m->data(languages.first(),Qt::UserRole).toString(); + auto lang = SettingsObjectWrapper::instance()->language_settings; lang->setLanguage(currentText); + lang->setLangLocale(currentLocale); lang->setUseSystemLanguage(ui->languageSystemDefault->isChecked()); lang->setTimeFormatOverride(!ui->timeFormatSystemDefault->isChecked()); lang->setDateFormatOverride(!ui->dateFormatSystemDefault->isChecked());