MeasureGizmo: Fixed localization for buttons

+ UKR Localization specific workaround
This commit is contained in:
YuSanka 2022-12-16 13:47:58 +01:00
parent 4da322d527
commit 3b46d68e4f
2 changed files with 15 additions and 4 deletions

View File

@ -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.

View File

@ -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();