mirror of
				https://github.com/SoftFever/OrcaSlicer.git
				synced 2025-10-31 04:31:15 -06:00 
			
		
		
		
	FIX: use current_language_code_safe() for valid language
Change-Id: I480730055588aa76bd40f35e6c4bcbe9833c330d
This commit is contained in:
		
							parent
							
								
									74a1bb8c0f
								
							
						
					
					
						commit
						c5bba1fa85
					
				
					 6 changed files with 9 additions and 24 deletions
				
			
		|  | @ -351,8 +351,6 @@ void OG_CustomCtrl::OnMotion(wxMouseEvent& event) | |||
|     wxString tooltip; | ||||
|     std::string markdowntip; | ||||
| 
 | ||||
|     wxString language = wxGetApp().app_config->get("language"); | ||||
| 
 | ||||
|     // BBS: markdown tip
 | ||||
|     CtrlLine* focusedLine = nullptr; | ||||
|     // BBS
 | ||||
|  |  | |||
|  | @ -43,7 +43,7 @@ const std::vector<std::string> license_list = { | |||
| ProjectPanel::ProjectPanel(wxWindow *parent, wxWindowID id, const wxPoint &pos, const wxSize &size, long style) : wxPanel(parent, id, pos, size, style) | ||||
| { | ||||
|     m_project_home_url = wxString::Format("file://%s/web/model/index.html", from_u8(resources_dir())); | ||||
|     std::string strlang = wxGetApp().app_config->get("language"); | ||||
|     wxString strlang = wxGetApp().current_language_code_safe(); | ||||
|     if (strlang != "") | ||||
|         m_project_home_url = wxString::Format("file://%s/web/model/index.html?lang=%s", from_u8(resources_dir()), strlang); | ||||
| 
 | ||||
|  |  | |||
|  | @ -437,7 +437,7 @@ static std::string generate_system_info_json() | |||
|     ); | ||||
| #endif // __WXGTK__
 | ||||
|     data_node.put("SystemLanguage", sys_language); | ||||
|     data_node.put("TranslationLanguage: ", wxGetApp().app_config->get("language")); | ||||
|     data_node.put("TranslationLanguage: ", wxGetApp().current_language_code_safe()); | ||||
| 
 | ||||
| 
 | ||||
|     pt::ptree hw_node; | ||||
|  |  | |||
|  | @ -171,8 +171,8 @@ wxString GuideFrame::SetStartPage(GuidePage startpage, bool load) | |||
|         TargetUrl = from_u8((boost::filesystem::path(resources_dir()) / "web/guide/21/index.html").make_preferred().string()); | ||||
|     } | ||||
| 
 | ||||
|     std::string strlang = wxGetApp().app_config->get("language"); | ||||
|     BOOST_LOG_TRIVIAL(info) << __FUNCTION__<< boost::format(", strlang=%1%")%strlang; | ||||
|     wxString strlang = wxGetApp().current_language_code_safe(); | ||||
|     BOOST_LOG_TRIVIAL(info) << __FUNCTION__<< boost::format(", strlang=%1%") % into_u8(strlang); | ||||
|     if (strlang != "") | ||||
|         TargetUrl = wxString::Format("%s?lang=%s", w2s(TargetUrl), strlang); | ||||
| 
 | ||||
|  |  | |||
|  | @ -37,37 +37,24 @@ BEGIN_EVENT_TABLE(ZUserLogin, wxDialog) | |||
| EVT_TIMER(NETWORK_OFFLINE_TIMER_ID, ZUserLogin::OnTimer) | ||||
| END_EVENT_TABLE() | ||||
| 
 | ||||
| string &replace_str(string &str, const string &to_replaced, const string &newchars) | ||||
| { | ||||
|     for (string::size_type pos(0); pos != string::npos; pos += newchars.length()) { | ||||
|         pos = str.find(to_replaced, pos); | ||||
|         if (pos != string::npos) | ||||
|             str.replace(pos, to_replaced.length(), newchars); | ||||
|         else | ||||
|             break; | ||||
|     } | ||||
|     return str; | ||||
| } | ||||
| 
 | ||||
| int ZUserLogin::web_sequence_id = 20000; | ||||
| 
 | ||||
| ZUserLogin::ZUserLogin() : wxDialog((wxWindow *) (wxGetApp().mainframe), wxID_ANY, "BambuStudio") | ||||
| { | ||||
|     SetBackgroundColour(*wxWHITE); | ||||
|     // Url
 | ||||
|     AppConfig * config   = wxGetApp().app_config; | ||||
|     NetworkAgent* agent = wxGetApp().getAgent(); | ||||
|     if (!agent) return; | ||||
|     std::string host_url = agent->get_bambulab_host(); | ||||
|     TargetUrl = host_url + "/sign-in"; | ||||
|     m_networkOk = false; | ||||
| 
 | ||||
|     std::string strlang = config->get("language"); | ||||
|     wxString strlang = wxGetApp().current_language_code_safe(); | ||||
|     if (strlang != "") { | ||||
|         replace_str(strlang, "_", "-"); | ||||
|         strlang.Replace("_", "-"); | ||||
|         TargetUrl = host_url + "/" + strlang + "/sign-in"; | ||||
|     } | ||||
| 
 | ||||
|    | ||||
|     BOOST_LOG_TRIVIAL(info) << "login url = " << TargetUrl.ToStdString(); | ||||
| 
 | ||||
|     m_bbl_user_agent = wxString::Format("BBL-Slicer/v%s", SLIC3R_VERSION); | ||||
|  |  | |||
|  | @ -33,7 +33,7 @@ WebViewPanel::WebViewPanel(wxWindow *parent) | |||
|         : wxPanel(parent, wxID_ANY, wxDefaultPosition, wxDefaultSize) | ||||
|  { | ||||
|     wxString url = wxString::Format("file://%s/web/homepage/index.html", from_u8(resources_dir())); | ||||
|     std::string strlang = wxGetApp().app_config->get("language"); | ||||
|     wxString strlang = wxGetApp().current_language_code_safe(); | ||||
|     if (strlang != "") | ||||
|         url = wxString::Format("file://%s/web/homepage/index.html?lang=%s", from_u8(resources_dir()), strlang); | ||||
| 
 | ||||
|  | @ -505,7 +505,7 @@ int WebViewPanel::get_model_mall_detail_url(std::string *url, std::string id) | |||
| { | ||||
|     // https://makerhub-qa.bambu-lab.com/en/models/2077
 | ||||
|     std::string h = wxGetApp().get_model_http_url(wxGetApp().app_config->get_country_code()); | ||||
|     auto l = wxGetApp().app_config->get("language"); | ||||
|     auto l = wxGetApp().current_language_code_safe(); | ||||
|     if (auto n = l.find('_'); n != std::string::npos) | ||||
|         l = l.substr(0, n); | ||||
|     *url = (boost::format("%1%%2%/models/%3%") % h % l % id).str(); | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 chunmao.guo
						chunmao.guo