mirror of https://github.com/mgba-emu/mgba.git
Qt: Fix up how the language names get displayed
This commit is contained in:
parent
c2741c73db
commit
0ca391cffc
|
@ -357,7 +357,7 @@ SettingsView::SettingsView(ConfigController* controller, InputController* inputC
|
|||
});
|
||||
|
||||
QLocale englishLocale("en");
|
||||
m_ui.languages->addItem(englishLocale.nativeLanguageName(), englishLocale);
|
||||
m_ui.languages->addItem("English", englishLocale);
|
||||
QDir ts(":/translations/");
|
||||
for (auto& name : ts.entryList()) {
|
||||
if (!name.endsWith(".qm") || !name.startsWith(binaryName)) {
|
||||
|
@ -367,7 +367,17 @@ SettingsView::SettingsView(ConfigController* controller, InputController* inputC
|
|||
if (locale.language() == QLocale::English) {
|
||||
continue;
|
||||
}
|
||||
m_ui.languages->addItem(locale.nativeLanguageName(), locale);
|
||||
QString endonym = locale.nativeLanguageName();
|
||||
// Manualy handle some cases that Qt can't seem to do properly
|
||||
if (locale.language() == QLocale::Spanish) {
|
||||
// Qt insists this is called español de España, regardless of if we set the country
|
||||
endonym = u8"Español";
|
||||
} else if (locale.language() == QLocale::Portuguese && locale.country() == QLocale::Brazil) {
|
||||
// Qt insists that Brazilian Portuguese is just called Português
|
||||
endonym = u8"Português brasileiro";
|
||||
}
|
||||
endonym[0] = endonym[0].toUpper();
|
||||
m_ui.languages->addItem(endonym, locale);
|
||||
if (locale.bcp47Name() == QLocale().bcp47Name()) {
|
||||
m_ui.languages->setCurrentIndex(m_ui.languages->count() - 1);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue