Translations: try to be smarter when picking the right locale

I was reminded to do this when a user in French speaking Switzerland reasonably
suggested that fr_FR would be a much better fallback than en_US in their
situation.

Fixes: #2388

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
Dirk Hohndel 2019-11-20 21:17:28 -08:00
parent 03344b0d9e
commit 2fb9367afe

View file

@ -59,9 +59,16 @@ void init_qt_late()
QLocale loc; QLocale loc;
// assign en_GB for use in South African locale // assign en_GB for use in South African locale
// and capture other French and Spanish speaking countries with the corresponding canonical locales
if (loc.country() == QLocale::SouthAfrica) { if (loc.country() == QLocale::SouthAfrica) {
loc.setDefault(QLocale("en_GB")); loc.setDefault(QLocale("en_GB"));
loc = QLocale(); loc = QLocale();
} else if (loc.language() == QLocale::French) {
loc.setDefault(QLocale("fr_FR"));
loc = QLocale();
} else if (loc.language() == QLocale::Spanish) {
loc.setDefault(QLocale("es_ES"));
loc = QLocale();
} }
QString uiLang = uiLanguage(&loc); QString uiLang = uiLanguage(&loc);
QLocale::setDefault(loc); QLocale::setDefault(loc);