From 6846ba0b592f77b383c9f685bd56181469033729 Mon Sep 17 00:00:00 2001 From: YuSanka Date: Wed, 3 Feb 2021 17:29:26 +0100 Subject: [PATCH] Localization: Fixed localization of some 3d-Scene notifications + Move a call of the load_language() before SplashScreen creation --- src/slic3r/GUI/GLCanvas3D.cpp | 10 +++++----- src/slic3r/GUI/GUI_App.cpp | 6 +++--- src/slic3r/GUI/NotificationManager.cpp | 10 +++++----- 3 files changed, 13 insertions(+), 13 deletions(-) diff --git a/src/slic3r/GUI/GLCanvas3D.cpp b/src/slic3r/GUI/GLCanvas3D.cpp index fbe6681f4e..917e11d0fd 100644 --- a/src/slic3r/GUI/GLCanvas3D.cpp +++ b/src/slic3r/GUI/GLCanvas3D.cpp @@ -631,12 +631,12 @@ void GLCanvas3D::WarningTexture::activate(WarningTexture::Warning warning, bool std::string text; bool error = false; switch (warning) { - case ObjectOutside: text = L("An object outside the print area was detected."); break; - case ToolpathOutside: text = L("A toolpath outside the print area was detected."); error = true; break; - case SlaSupportsOutside: text = L("SLA supports outside the print area were detected."); error = true; break; - case SomethingNotShown: text = L("Some objects are not visible."); break; + case ObjectOutside: text = _u8L("An object outside the print area was detected."); break; + case ToolpathOutside: text = _u8L("A toolpath outside the print area was detected."); error = true; break; + case SlaSupportsOutside: text = _u8L("SLA supports outside the print area were detected."); error = true; break; + case SomethingNotShown: text = _u8L("Some objects are not visible."); break; case ObjectClashed: - text = L( "An object outside the print area was detected.\n" + text = _u8L( "An object outside the print area was detected.\n" "Resolve the current problem to continue slicing."); error = true; break; diff --git a/src/slic3r/GUI/GUI_App.cpp b/src/slic3r/GUI/GUI_App.cpp index 085bdb865a..12fba187e7 100644 --- a/src/slic3r/GUI/GUI_App.cpp +++ b/src/slic3r/GUI/GUI_App.cpp @@ -799,6 +799,9 @@ bool GUI_App::on_init_inner() app_config->set("version", SLIC3R_VERSION); app_config->save(); + // If load_language() fails, the application closes. + load_language(wxString(), true); + wxInitAllImageHandlers(); SplashScreen* scrn = nullptr; @@ -866,9 +869,6 @@ bool GUI_App::on_init_inner() init_label_colours(); init_fonts(); - // If load_language() fails, the application closes. - load_language(wxString(), true); - // Suppress the '- default -' presets. preset_bundle->set_default_suppressed(app_config->get("no_defaults") == "1"); try { diff --git a/src/slic3r/GUI/NotificationManager.cpp b/src/slic3r/GUI/NotificationManager.cpp index b0d0a556c6..72fd22b1a3 100644 --- a/src/slic3r/GUI/NotificationManager.cpp +++ b/src/slic3r/GUI/NotificationManager.cpp @@ -740,11 +740,11 @@ void NotificationManager::PopNotification::update(const NotificationData& n) } bool NotificationManager::PopNotification::compare_text(const std::string& text) { - std::string t1(m_text1); - std::string t2(text); - t1.erase(std::remove_if(t1.begin(), t1.end(), ::isspace), t1.end()); - t2.erase(std::remove_if(t2.begin(), t2.end(), ::isspace), t2.end()); - if (t1.compare(t2) == 0) + std::wstring wt1 = boost::nowide::widen(m_text1); + std::wstring wt2 = boost::nowide::widen(text); + wt1.erase(std::remove_if(wt1.begin(), wt1.end(), ::iswspace), wt1.end()); + wt2.erase(std::remove_if(wt2.begin(), wt2.end(), ::iswspace), wt2.end()); + if (wt1.compare(wt2) == 0) return true; return false; }