Language preference: store the locale name in the settings

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
Dirk Hohndel 2016-09-20 12:44:26 -07:00
parent 67a226c00a
commit b972bdb97d

View file

@ -53,9 +53,16 @@ void PreferencesLanguage::syncSettings()
QMessageBox::warning(this, tr("Restart required"), QMessageBox::warning(this, tr("Restart required"),
tr("To correctly load a new language you must restart Subsurface.")); 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; auto lang = SettingsObjectWrapper::instance()->language_settings;
lang->setLanguage(currentText); lang->setLanguage(currentText);
lang->setLangLocale(currentLocale);
lang->setUseSystemLanguage(ui->languageSystemDefault->isChecked()); lang->setUseSystemLanguage(ui->languageSystemDefault->isChecked());
lang->setTimeFormatOverride(!ui->timeFormatSystemDefault->isChecked()); lang->setTimeFormatOverride(!ui->timeFormatSystemDefault->isChecked());
lang->setDateFormatOverride(!ui->dateFormatSystemDefault->isChecked()); lang->setDateFormatOverride(!ui->dateFormatSystemDefault->isChecked());