locale: store locate to preferences after fixing up mac-weirdness

In uiLanguage() the preferences fields are initialized and there
is fixup for a MacOS indiosyncrasy. For some reason the uncorrected
value is written to the preferences. Let's store the corrected
value instead.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
This commit is contained in:
Berthold Stoeger 2020-03-22 16:25:43 +01:00 committed by Dirk Hohndel
parent 621d00d891
commit 2dca7d0ce5

View file

@ -471,8 +471,6 @@ QString uiLanguage(QLocale *callerLoc)
else else
uiLang = languages[0]; uiLang = languages[0];
prefs.locale.lang_locale = copy_qstring(uiLang);
// there's a stupid Qt bug on MacOS where uiLanguages doesn't give us the country info // there's a stupid Qt bug on MacOS where uiLanguages doesn't give us the country info
if (!uiLang.contains('-') && uiLang != loc.bcp47Name()) { if (!uiLang.contains('-') && uiLang != loc.bcp47Name()) {
QLocale loc2(loc.bcp47Name()); QLocale loc2(loc.bcp47Name());
@ -488,6 +486,8 @@ QString uiLanguage(QLocale *callerLoc)
if (callerLoc) if (callerLoc)
*callerLoc = loc; *callerLoc = loc;
prefs.locale.lang_locale = copy_qstring(uiLang);
if (!prefs.date_format_override || empty_string(prefs.date_format_short) || empty_string(prefs.date_format)) { if (!prefs.date_format_override || empty_string(prefs.date_format_short) || empty_string(prefs.date_format)) {
// derive our standard date format from what the locale gives us // derive our standard date format from what the locale gives us
// the short format is fine // the short format is fine