diff options
author | Dirk Hohndel <dirk@hohndel.org> | 2016-09-20 12:44:26 -0700 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2016-09-20 12:48:30 -0700 |
commit | b972bdb97dea32bb7d67f54786f06fa687d15b99 (patch) | |
tree | 9a5a75767ca60a6cbf8fbd775b76533de94b7fa8 | |
parent | 67a226c00a78ca4f3c63e5818a9306e6f7257d10 (diff) | |
download | subsurface-b972bdb97dea32bb7d67f54786f06fa687d15b99.tar.gz |
Language preference: store the locale name in the settings
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
-rw-r--r-- | desktop-widgets/preferences/preferences_language.cpp | 7 |
1 files changed, 7 insertions, 0 deletions
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()); |