Fix localization context (#14642)

Co-authored-by: Alexandre Folle de Menezes <afmenez@terra.com.br>
This commit is contained in:
Ian Bassi
2026-07-07 12:15:37 -03:00
committed by GitHub
parent b2adfb5c13
commit bec1ce706c
31 changed files with 202 additions and 73 deletions

View File

@@ -1905,7 +1905,7 @@ bool GLGizmoAdvancedCut::render_slider_double_input(const std::string &label, fl
mean_size *= float(units_mm_to_in);
min_size *= float(units_mm_to_in);
}
std::string format = value_in < 0.f ? " " : m_imperial_units ? "%.4f " + _u8L("in") : "%.2f " + _u8L("mm");
std::string format = value_in < 0.f ? " " : m_imperial_units ? "%.4f " + _CTX_utf8("in", "inches") : "%.2f " + _u8L("mm");
m_imgui->bbl_slider_float_style(("##" + label).c_str(), &value, min_size, mean_size, format.c_str());

View File

@@ -241,7 +241,7 @@ std::string GLGizmoCut3D::get_tooltip() const
std::string tooltip;
if (m_hover_id == Z || (m_dragging && m_hover_id == CutPlane)) {
double koef = m_imperial_units ? GizmoObjectManipulation::mm_to_in : 1.0;
std::string unit_str = " " + (m_imperial_units ? _u8L("in") : _u8L("mm"));
std::string unit_str = " " + (m_imperial_units ? _CTX_utf8("in", "inches") : _u8L("mm"));
const BoundingBoxf3& tbb = m_transformed_bounding_box;
const std::string name = m_keep_as_parts ? _u8L("Part") : _u8L("Object");
@@ -541,7 +541,7 @@ bool GLGizmoCut3D::render_double_input(const std::string& label, double& value_i
ImGui::InputDouble(("##" + label).c_str(), &value, 0.0f, 0.0f, "%.2f", ImGuiInputTextFlags_CharsDecimal);
ImGui::SameLine();
m_imgui->text(m_imperial_units ? _L("in") : _L("mm"));
m_imgui->text(m_imperial_units ? _CTX("in", "inches") : _L("mm"));
value_in = value * (m_imperial_units ? GizmoObjectManipulation::in_to_mm : 1.0);
return !is_approx(old_val, value);
@@ -582,7 +582,7 @@ bool GLGizmoCut3D::render_slider_two_input(const std::string& label, float& valu
if (m_imperial_units) {
min_size *= f_mm_to_in;
}
std::string format = value_in < 0.f ? " " : m_imperial_units ? "%.4f " + _u8L("in") : "%.2f " + _u8L("mm");
std::string format = value_in < 0.f ? " " : m_imperial_units ? "%.4f " + _CTX_utf8("in", "inches") : "%.2f " + _u8L("mm");
m_imgui->bbl_slider_float_style(("##" + label).c_str(), &value, min_size, mean_size, format.c_str());
@@ -653,7 +653,7 @@ bool GLGizmoCut3D::render_slider_input(const std::string& label, float& value_in
if (m_imperial_units) {
min_size *= f_mm_to_in;
}
std::string format = value_in < 0.f ? " " : m_imperial_units ? "%.4f " + _u8L("in") : "%.2f " + _u8L("mm");
std::string format = value_in < 0.f ? " " : m_imperial_units ? "%.4f " + _CTX_utf8("in", "inches") : "%.2f " + _u8L("mm");
m_imgui->bbl_slider_float_style(("##" + label).c_str(), &value, min_size, max_value, format.c_str());
@@ -2472,7 +2472,7 @@ void GLGizmoCut3D::render_connectors_input_window(CutConnectors &connectors, flo
void GLGizmoCut3D::render_build_size()
{
double koef = m_imperial_units ? GizmoObjectManipulation::mm_to_in : 1.0;
wxString unit_str = m_imperial_units ? _L("in") : _L("mm");
wxString unit_str = m_imperial_units ? _CTX("in", "inches") : _L("mm");
Vec3d tbb_sz = m_transformed_bounding_box.size() * koef; // ORCA
ImGui::AlignTextToFramePadding();

View File

@@ -1252,7 +1252,7 @@ void GLGizmoMeasure::render_dimensioning()
const bool use_inches = wxGetApp().app_config->get_bool("use_inches");
const double curr_value = use_inches ? GizmoObjectManipulation::mm_to_in * distance : distance;
const std::string curr_value_str = format_double(curr_value);
const std::string units = use_inches ? _u8L("in") : _u8L("mm");
const std::string units = use_inches ? _CTX_utf8("in", "inches") : _u8L("mm");
const float value_str_width = 20.0f + ImGui::CalcTextSize(curr_value_str.c_str()).x;
static double edit_value = 0.0;
@@ -2130,7 +2130,7 @@ void GLGizmoMeasure::show_face_face_assembly_senior()
void GLGizmoMeasure::init_render_input_window()
{
m_use_inches = wxGetApp().app_config->get_bool("use_inches");
m_units = m_use_inches ? " " + _u8L("in") : " " + _u8L("mm");
m_units = " " + (m_use_inches ? _CTX_utf8("in", "inches") : _u8L("mm"));
m_space_size = ImGui::CalcTextSize(" ").x * 2;
m_input_size_max = ImGui::CalcTextSize("-100.00").x * 1.2;
m_same_model_object = is_two_volume_in_same_model_object();

View File

@@ -1704,7 +1704,7 @@ void GLGizmoSVG::draw_size()
if (m_keep_ratio) {
std::stringstream ss;
ss << std::setprecision(2) << std::fixed << width << " x " << height << " " << (use_inch ? "in" : "mm");
ss << std::setprecision(2) << std::fixed << width << " x " << height << " " << (use_inch ? _CTX("in", "inches") : _L("mm"));
ImGui::SameLine(m_gui_cfg->input_offset);
ImGui::SetNextItemWidth(m_gui_cfg->input_width);

View File

@@ -54,7 +54,7 @@ GizmoObjectManipulation::GizmoObjectManipulation(GLCanvas3D& glcanvas)
: m_glcanvas(glcanvas)
{
m_imperial_units = wxGetApp().app_config->get("use_inches") == "1";
m_new_unit_string = m_imperial_units ? L("in") : L("mm");
m_new_unit_string = m_imperial_units ? L_CONTEXT("in", "inches") : L("mm");
const wxString shift = GUI::shortkey_shift_prefix();
const wxString alt = GUI::shortkey_alt_prefix();
@@ -92,7 +92,7 @@ void GizmoObjectManipulation::update_ui_from_settings()
if (m_imperial_units != (wxGetApp().app_config->get("use_inches") == "1")) {
m_imperial_units = wxGetApp().app_config->get("use_inches") == "1";
m_new_unit_string = m_imperial_units ? L("in") : L("mm");
m_new_unit_string = m_imperial_units ? L_CONTEXT("in", "inches") : L("mm");
update_buffered_value();
}