Linux specific fix for switching languages: PrusaSlicer 2.3 forces
en_GB locale when switching to English from the user interface, while often Linux users have just en_US locales configured. With this commit the user will have to select English (U.S.) or English (U.K.). Usually English (U.S.) will work. Vojtech is scared to touch the code for the other platforms (Windows and Mac) as the language switching has been reworked multiple times and it is quite fragile.
This commit is contained in:
parent
982e6eb55b
commit
2e73a75951
@ -1278,6 +1278,11 @@ bool GUI_App::select_language()
|
||||
wxArrayString translations = wxTranslations::Get()->GetAvailableTranslations(SLIC3R_APP_KEY);
|
||||
std::vector<const wxLanguageInfo*> language_infos;
|
||||
language_infos.emplace_back(wxLocale::GetLanguageInfo(wxLANGUAGE_ENGLISH));
|
||||
#ifdef __linux__
|
||||
// wxWidgets consider the default English locale to be en_GB, which is often missing on Linux.
|
||||
// Thus we offer en_US on Linux as well.
|
||||
language_infos.emplace_back(wxLocale::GetLanguageInfo(wxLANGUAGE_ENGLISH_US));
|
||||
#endif // __linux__
|
||||
for (size_t i = 0; i < translations.GetCount(); ++ i) {
|
||||
const wxLanguageInfo *langinfo = wxLocale::FindLanguageInfo(translations[i]);
|
||||
if (langinfo != nullptr)
|
||||
@ -1306,6 +1311,13 @@ bool GUI_App::select_language()
|
||||
if (language_infos[i]->CanonicalName.BeforeFirst('_') == "en")
|
||||
// This will be the default selection if the active language does not match any dictionary.
|
||||
init_selection_default = i;
|
||||
#ifdef __linux__
|
||||
// wxWidgets consider the default English locale to be en_GB, which is often missing on Linux.
|
||||
// Thus we make the distintion between "en_US" and "en_GB" clear.
|
||||
if (language_infos[i]->CanonicalName == "en_GB" && language_infos[i]->Description == "English")
|
||||
names.Add("English (U.K.)");
|
||||
else
|
||||
#endif // __linux__
|
||||
names.Add(language_infos[i]->Description);
|
||||
}
|
||||
if (init_selection == -1)
|
||||
|
Loading…
Reference in New Issue
Block a user