From 3b46d68e4f295ebe1124d6ca15813c150edcd053 Mon Sep 17 00:00:00 2001 From: YuSanka Date: Fri, 16 Dec 2022 13:47:58 +0100 Subject: [PATCH] MeasureGizmo: Fixed localization for buttons + UKR Localization specific workaround --- src/slic3r/GUI/GUI_App.cpp | 11 +++++++++++ src/slic3r/GUI/Gizmos/GLGizmoMeasure.cpp | 8 ++++---- 2 files changed, 15 insertions(+), 4 deletions(-) diff --git a/src/slic3r/GUI/GUI_App.cpp b/src/slic3r/GUI/GUI_App.cpp index 161784d95..7a42e1eec 100644 --- a/src/slic3r/GUI/GUI_App.cpp +++ b/src/slic3r/GUI/GUI_App.cpp @@ -2216,6 +2216,17 @@ bool GUI_App::load_language(wxString language, bool initial) // Override language at the active wxTranslations class (which is stored in the active m_wxLocale) // to load possibly different dictionary, for example, load Czech dictionary for Slovak language. wxTranslations::Get()->SetLanguage(language_dict); + { + // UKR Localization specific workaround till the wxWidgets doesn't fixed: + // From wxWidgets 3.1.6 calls setlocation(0, wxInfoLanguage->LocaleTag), see (https://github.com/prusa3d/wxWidgets/commit/deef116a09748796711d1e3509965ee208dcdf0b#diff-7de25e9a71c4dce61bbf76492c589623d5b93fd1bb105ceaf0662075d15f4472), + // where LocaleTag is a Tag of locale in BCP 47 - like notation. + // For Ukrainian Language LocaleTag == "uk". + // But setlocale(0, "uk") returns "English_United Kingdom.1252" instead of "uk", + // and, as a result, locales are set to English_United Kingdom + + if (language_info->CanonicalName == "uk") + setlocale(0, language_info->GetCanonicalWithRegion().data()); + } m_wxLocale->AddCatalog(SLIC3R_APP_KEY); m_imgui->set_language(into_u8(language_info->CanonicalName)); //FIXME This is a temporary workaround, the correct solution is to switch to "C" locale during file import / export only. diff --git a/src/slic3r/GUI/Gizmos/GLGizmoMeasure.cpp b/src/slic3r/GUI/Gizmos/GLGizmoMeasure.cpp index ed9e2d078..fc99e52c0 100644 --- a/src/slic3r/GUI/Gizmos/GLGizmoMeasure.cpp +++ b/src/slic3r/GUI/Gizmos/GLGizmoMeasure.cpp @@ -1359,10 +1359,10 @@ void GLGizmoMeasure::render_dimensioning() action_exit(); ImGui::SameLine(); - if (m_imgui->button(_u8L("Scale"))) + if (m_imgui->button(_CTX(L_CONTEXT("Scale", "Verb"), "Verb"))) action_scale(edit_value, curr_value); ImGui::SameLine(); - if (m_imgui->button(_u8L("Cancel"))) + if (m_imgui->button(_L("Cancel"))) action_exit(); ImGui::EndPopup(); } @@ -1991,7 +1991,7 @@ void GLGizmoMeasure::on_render_input_window(float x, float y, float bottom_limit radius = (on_circle - center).norm(); if (use_inches) radius = ObjectManipulation::mm_to_in * radius; - text += " (" + _u8L("Diameter:") + " " + format_double(2.0 * radius) + units + ")"; + text += " (" + _u8L("Diameter") + ": " + format_double(2.0 * radius) + units + ")"; } return text; }; @@ -2004,7 +2004,7 @@ void GLGizmoMeasure::on_render_input_window(float x, float y, float bottom_limit } m_imgui->disabled_begin(!m_selected_features.first.feature.has_value()); - if (m_imgui->button(_u8L("Restart selection"))) { + if (m_imgui->button(_L("Restart selection"))) { m_selected_features.reset(); m_selected_sphere_raycasters.clear(); m_imgui->set_requires_extra_frame();