1
0
mirror of https://github.com/cookiengineer/audacity synced 2025-11-21 16:37:12 +01:00

Bug1288: Don't crash when changing language to "Simplified"...

... but give a warning message about the unknown language.
This commit is contained in:
Paul Licameli
2016-01-26 20:09:54 -05:00
parent 2550a59c0e
commit 907c950a0e
4 changed files with 25 additions and 9 deletions

View File

@@ -985,8 +985,10 @@ wxLanguageInfo userLangs[] =
};
#endif
void AudacityApp::InitLang( const wxString & lang )
wxString AudacityApp::InitLang( const wxString & lang )
{
wxString result = lang;
if (mLocale)
delete mLocale;
@@ -1001,10 +1003,18 @@ void AudacityApp::InitLang( const wxString & lang )
wxSetEnv(wxT("LANG"), wxT("en_US.UTF-8"));
#endif
const wxLanguageInfo *info = wxLocale::FindLanguageInfo(lang);
if (!lang)
const wxLanguageInfo *info = NULL;
if (!lang.empty()) {
info = wxLocale::FindLanguageInfo(lang);
if (!info)
::wxMessageBox(wxString::Format(_("Language \"%s\" is unknown"), lang));
}
if (!info)
{
return;
result = GetSystemLanguageCode();
info = wxLocale::FindLanguageInfo(result);
if (!info)
return result;
}
mLocale = new wxLocale(info->Language);
@@ -1035,6 +1045,8 @@ void AudacityApp::InitLang( const wxString & lang )
wxCommandEvent evt(EVT_LANGUAGE_CHANGE);
ProcessEvent(evt);
}
return result;
}
void AudacityApp::OnFatalException()