Locale: don't overwrite explicit choice
If the user selects a language from the dialog (by clicking 'change'), then preserve that explicit choice even when clicking on another location which would reset the language based on the installer- language.
This commit is contained in:
parent
98d58215ad
commit
49cdaf10d6
@ -1,6 +1,7 @@
|
||||
/* === This file is part of Calamares - <http://github.com/calamares> ===
|
||||
*
|
||||
* Copyright 2016, Teo Mrnjavac <teo@kde.org>
|
||||
* Copyright 2017, Adriaan de Groot <groot@kde.org>
|
||||
*
|
||||
* Calamares is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@ -20,6 +21,8 @@
|
||||
#include <QLocale>
|
||||
|
||||
LocaleConfiguration::LocaleConfiguration()
|
||||
: explicit_lang( false )
|
||||
, explicit_lc( false )
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -1,6 +1,7 @@
|
||||
/* === This file is part of Calamares - <http://github.com/calamares> ===
|
||||
*
|
||||
* Copyright 2016, Teo Mrnjavac <teo@kde.org>
|
||||
* Copyright 2017, Adriaan de Groot <groot@kde.org>
|
||||
*
|
||||
* Calamares is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@ -40,6 +41,10 @@ public:
|
||||
lc_telephone, lc_measurement, lc_identification;
|
||||
QString myLanguageLocaleBcp47;
|
||||
QMap< QString, QString > toMap();
|
||||
|
||||
// If the user has explicitly selected language (from the dialog)
|
||||
// or numbers format, set these to avoid implicit changes to them.
|
||||
bool explicit_lang, explicit_lc;
|
||||
};
|
||||
|
||||
#endif // LOCALECONFIGURATION_H
|
||||
|
@ -171,6 +171,7 @@ LocalePage::LocalePage( QWidget* parent )
|
||||
!dlg->selectedLCLocale().isEmpty() )
|
||||
{
|
||||
m_selectedLocaleConfiguration.lang = dlg->selectedLCLocale();
|
||||
m_selectedLocaleConfiguration.explicit_lang = true;
|
||||
this->updateLocaleLabels();
|
||||
}
|
||||
|
||||
@ -200,6 +201,7 @@ LocalePage::LocalePage( QWidget* parent )
|
||||
m_selectedLocaleConfiguration.lc_telephone = dlg->selectedLCLocale();
|
||||
m_selectedLocaleConfiguration.lc_measurement = dlg->selectedLCLocale();
|
||||
m_selectedLocaleConfiguration.lc_identification = dlg->selectedLCLocale();
|
||||
m_selectedLocaleConfiguration.explicit_lc = true;
|
||||
|
||||
this->updateLocaleLabels();
|
||||
}
|
||||
@ -482,6 +484,27 @@ LocalePage::updateGlobalStorage()
|
||||
location.region + '/' + location.zone } );
|
||||
}
|
||||
|
||||
m_selectedLocaleConfiguration = guessLocaleConfiguration();
|
||||
// Preserve those settings that have been made explicit.
|
||||
auto newLocale = guessLocaleConfiguration();
|
||||
if ( !m_selectedLocaleConfiguration.isEmpty() &&
|
||||
m_selectedLocaleConfiguration.explicit_lang )
|
||||
newLocale.lang = m_selectedLocaleConfiguration.lang;
|
||||
if ( !m_selectedLocaleConfiguration.isEmpty() &&
|
||||
m_selectedLocaleConfiguration.explicit_lc )
|
||||
{
|
||||
newLocale.lc_numeric = m_selectedLocaleConfiguration.lc_numeric;
|
||||
newLocale.lc_time = m_selectedLocaleConfiguration.lc_time;
|
||||
newLocale.lc_monetary = m_selectedLocaleConfiguration.lc_monetary;
|
||||
newLocale.lc_paper = m_selectedLocaleConfiguration.lc_paper;
|
||||
newLocale.lc_name = m_selectedLocaleConfiguration.lc_name;
|
||||
newLocale.lc_address = m_selectedLocaleConfiguration.lc_address;
|
||||
newLocale.lc_telephone = m_selectedLocaleConfiguration.lc_telephone;
|
||||
newLocale.lc_measurement = m_selectedLocaleConfiguration.lc_measurement;
|
||||
newLocale.lc_identification = m_selectedLocaleConfiguration.lc_identification;
|
||||
}
|
||||
newLocale.explicit_lang = m_selectedLocaleConfiguration.explicit_lang;
|
||||
newLocale.explicit_lc = m_selectedLocaleConfiguration.explicit_lc;
|
||||
|
||||
m_selectedLocaleConfiguration = newLocale;
|
||||
updateLocaleLabels();
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user