fix crashes on some Linux distro caused by locale by @pfrench42 #235 (#1766)

fix crashes on some Linux distro caused by locale by @pfrench42

#235
This commit is contained in:
SoftFever 2023-08-11 20:26:37 +08:00 committed by GitHub
parent abc0f1c682
commit 99406816cd
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -4904,6 +4904,9 @@ bool GUI_App::load_language(wxString language, bool initial)
// instead of just reporting that it is impossible to switch.
if (! wxLocale::IsAvailable(language_info->Language)) {
std::string original_lang = into_u8(language_info->CanonicalName);
if (nullptr == m_language_info_system) {
m_language_info_system = wxLocale::GetLanguageInfo(wxLANGUAGE_DEFAULT);
}
language_info = linux_get_existing_locale_language(language_info, m_language_info_system);
BOOST_LOG_TRIVIAL(trace) << boost::format("Can't switch language to %1% (missing locales). Using %2% instead.")
% original_lang % language_info->CanonicalName.ToUTF8().data();