diff --git a/src/slic3r/GUI/GUI_App.cpp b/src/slic3r/GUI/GUI_App.cpp index 4ddb027da0..0e1b798ea8 100644 --- a/src/slic3r/GUI/GUI_App.cpp +++ b/src/slic3r/GUI/GUI_App.cpp @@ -2523,6 +2523,7 @@ void GUI_App::recreate_GUI(const wxString& msg_name) dlg.Update(80, _L("Loading current presets") + dots); load_current_presets(); mainframe->Show(true); + mainframe->refresh_plugin_tips(); dlg.Update(90, _L("Loading a mode view") + dots); @@ -3601,7 +3602,7 @@ bool GUI_App::load_language(wxString language, bool initial) // Get the active language from PrusaSlicer.ini, or empty string if the key does not exist. language = app_config->get("language"); if (! language.empty()) - BOOST_LOG_TRIVIAL(trace) << boost::format("language provided by PrusaSlicer.ini: %1%") % language; + BOOST_LOG_TRIVIAL(trace) << boost::format("language provided by PBambuStudio.conf: %1%") % language; else { // Get the system language. const wxLanguage lang_system = wxLanguage(wxLocale::GetSystemLanguage()); @@ -3609,7 +3610,7 @@ bool GUI_App::load_language(wxString language, bool initial) 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(); // 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 { { std::map language_descptions = { @@ -3644,7 +3645,7 @@ bool GUI_App::load_language(wxString language, bool initial) 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%") % 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__ wxString lc_all; @@ -3716,6 +3717,27 @@ bool GUI_App::load_language(wxString language, bool initial) language_info = wxLocale::GetLanguageInfo(wxLANGUAGE_ENGLISH_UK); app_config->set("language", language_info->CanonicalName.ToUTF8().data()); } + else { + // bbs supported languages + //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 }; + std::string cur_language = app_config->get("language"); + if (cur_language != "") { + //cleanup the language wrongly set before + const wxLanguageInfo *langinfo = nullptr; + bool embedded_language = false; + for (auto index = 0; index < 7; index++) { + langinfo = wxLocale::GetLanguageInfo(supported_languages[index]); + std::string temp_lan = langinfo->CanonicalName.ToUTF8().data(); + if (cur_language == temp_lan) { + embedded_language = true; + break; + } + } + if (!embedded_language) + app_config->erase("app", "language"); + } + } if (! wxLocale::IsAvailable(language_info->Language)) { // Loading the language dictionary failed. diff --git a/src/slic3r/GUI/Preferences.cpp b/src/slic3r/GUI/Preferences.cpp index f6846263f5..cf426cb6f7 100644 --- a/src/slic3r/GUI/Preferences.cpp +++ b/src/slic3r/GUI/Preferences.cpp @@ -634,7 +634,6 @@ wxWindow* PreferencesDialog::create_general_page() // bbs supported languages wxLanguage supported_languages[]{wxLANGUAGE_ENGLISH, wxLANGUAGE_CHINESE_SIMPLIFIED, wxLANGUAGE_GERMAN, wxLANGUAGE_FRENCH, wxLANGUAGE_SPANISH, wxLANGUAGE_SWEDISH, wxLANGUAGE_DUTCH }; - auto translations = wxTranslations::Get()->GetAvailableTranslations(SLIC3R_APP_KEY); std::vector language_infos; language_infos.emplace_back(wxLocale::GetLanguageInfo(wxLANGUAGE_ENGLISH)); @@ -643,7 +642,7 @@ wxWindow* PreferencesDialog::create_general_page() if (langinfo == nullptr) continue; - for (auto si = 0; si < sizeof(supported_languages); si++) { + for (auto si = 0; si < 7; si++) { if (langinfo == wxLocale::GetLanguageInfo(supported_languages[si])) { language_infos.emplace_back(langinfo); }