FIX: set the default language to local if supported

Change-Id: I03fb37dc4d28bb354c7711afde6d8fb389daa53f
This commit is contained in:
lane.wei 2022-07-23 21:25:57 +08:00 committed by Lane.Wei
parent 7a68cc56b2
commit 5527ebb5e3
1 changed files with 5 additions and 5 deletions

View File

@ -1963,7 +1963,7 @@ bool GUI_App::on_init_inner()
preset_bundle->set_default_suppressed(true); preset_bundle->set_default_suppressed(true);
Bind(EVT_USER_LOGIN, &GUI_App::on_user_login, this); Bind(EVT_USER_LOGIN, &GUI_App::on_user_login, this);
on_init_network(); on_init_network();
//BBS if load user preset failed //BBS if load user preset failed
@ -2065,7 +2065,7 @@ bool GUI_App::on_init_inner()
//#endif //__APPLE__ //#endif //__APPLE__
Bind(EVT_HTTP_ERROR, &GUI_App::on_http_error, this); Bind(EVT_HTTP_ERROR, &GUI_App::on_http_error, this);
Bind(wxEVT_IDLE, [this](wxIdleEvent& event) Bind(wxEVT_IDLE, [this](wxIdleEvent& event)
{ {
@ -3610,7 +3610,7 @@ bool GUI_App::load_language(wxString language, bool initial)
m_language_info_system = wxLocale::GetLanguageInfo(lang_system); m_language_info_system = wxLocale::GetLanguageInfo(lang_system);
BOOST_LOG_TRIVIAL(trace) << boost::format("System language detected (user locales and such): %1%") % m_language_info_system->CanonicalName.ToUTF8().data(); BOOST_LOG_TRIVIAL(trace) << boost::format("System language detected (user locales and such): %1%") % m_language_info_system->CanonicalName.ToUTF8().data();
// BBS set language to app config // BBS set language to app config
//app_config->set("language", m_language_info_system->CanonicalName.ToUTF8().data()); app_config->set("language", m_language_info_system->CanonicalName.ToUTF8().data());
} else { } else {
{ {
std::map<wxString, wxString> language_descptions = { std::map<wxString, wxString> language_descptions = {
@ -3645,7 +3645,7 @@ bool GUI_App::load_language(wxString language, bool initial)
m_language_info_best = wxLocale::FindLanguageInfo(best_language); m_language_info_best = wxLocale::FindLanguageInfo(best_language);
BOOST_LOG_TRIVIAL(trace) << boost::format("Best translation language detected (may be different from user locales): %1%") % BOOST_LOG_TRIVIAL(trace) << boost::format("Best translation language detected (may be different from user locales): %1%") %
m_language_info_best->CanonicalName.ToUTF8().data(); m_language_info_best->CanonicalName.ToUTF8().data();
//app_config->set("language", m_language_info_best->CanonicalName.ToUTF8().data()); app_config->set("language", m_language_info_best->CanonicalName.ToUTF8().data());
} }
#ifdef __linux__ #ifdef __linux__
wxString lc_all; wxString lc_all;
@ -3717,7 +3717,7 @@ bool GUI_App::load_language(wxString language, bool initial)
language_info = wxLocale::GetLanguageInfo(wxLANGUAGE_ENGLISH_UK); language_info = wxLocale::GetLanguageInfo(wxLANGUAGE_ENGLISH_UK);
app_config->set("language", language_info->CanonicalName.ToUTF8().data()); app_config->set("language", language_info->CanonicalName.ToUTF8().data());
} }
else { else if (initial) {
// bbs supported languages // bbs supported languages
//TODO: use a global one with Preference //TODO: use a global one with Preference
wxLanguage supported_languages[] {wxLANGUAGE_ENGLISH, wxLANGUAGE_CHINESE_SIMPLIFIED, wxLANGUAGE_GERMAN, wxLANGUAGE_FRENCH, wxLANGUAGE_SPANISH, wxLANGUAGE_SWEDISH, wxLANGUAGE_DUTCH }; wxLanguage supported_languages[] {wxLANGUAGE_ENGLISH, wxLANGUAGE_CHINESE_SIMPLIFIED, wxLANGUAGE_GERMAN, wxLANGUAGE_FRENCH, wxLANGUAGE_SPANISH, wxLANGUAGE_SWEDISH, wxLANGUAGE_DUTCH };