From fed960535775dc38e2fcda1148d9dcfd8ff202d6 Mon Sep 17 00:00:00 2001 From: semmelrinde <124386289+semmelrinde@users.noreply.github.com> Date: Wed, 28 Oct 2026 12:13:38 +0000 Subject: [PATCH] Sketch: the status in the view and the browser's editing mark in the user's language (#8084) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Sketch: the status in the view and the browser's editing mark in the user's language While a sketch is edited, the view's corner said "Sketch1 — 2 degrees of freedom" (or "fully constrained", "constraints conflict") and the browser marked the sketch "(editing)" or "(attachment lost)", in English whatever the language; one degree of freedom read "1 degrees of freedom". They now take messages: the catalogs' existing degrees-of- freedom ones and four new ones. Co-Authored-By: Claude Opus 5.5 * Sketch status and editing mark: the sketch's default name as shown elsewhere The browser shows a default name in the user's language ("Skizze 1") except on the edited sketch's row, whose mark made it a different text; the view's status kept the stored name too. Both now use the name as the browser shows it. Co-Authored-By: Claude Opus 5.5 --------- Co-authored-by: Claude Opus 5.5 --- .../locales/pending/sketch-status-texts.json | 74 +++++++++++++++++++ crates/ui-egui/src/browser.rs | 4 +- crates/ui-egui/src/browser_model_tests.rs | 11 +++ crates/ui-egui/src/viewport.rs | 11 ++- 4 files changed, 94 insertions(+), 6 deletions(-) create mode 100644 assets/locales/pending/sketch-status-texts.json diff --git a/assets/locales/pending/sketch-status-texts.json b/assets/locales/pending/sketch-status-texts.json new file mode 100644 index 000000000..669eccba9 --- /dev/null +++ b/assets/locales/pending/sketch-status-texts.json @@ -0,0 +1,74 @@ +{ + "en": { + "browser.sketch_attachment_lost": "{name} (attachment lost)", + "browser.sketch_editing": "{name} (editing)", + "sketch.status_conflict": "constraints conflict", + "sketch.status_fully_constrained": "fully constrained" + }, + "ar": { + "browser.sketch_attachment_lost": "{name} (فُقد الارتباط)", + "browser.sketch_editing": "{name} (قيد التحرير)", + "sketch.status_conflict": "تعارض القيود", + "sketch.status_fully_constrained": "مقيّد بالكامل" + }, + "de": { + "browser.sketch_attachment_lost": "{name} (Bezug verloren)", + "browser.sketch_editing": "{name} (in Bearbeitung)", + "sketch.status_conflict": "Bedingungen widersprechen sich", + "sketch.status_fully_constrained": "vollständig bestimmt" + }, + "es": { + "browser.sketch_attachment_lost": "{name} (fijación perdida)", + "browser.sketch_editing": "{name} (en edición)", + "sketch.status_conflict": "restricciones en conflicto", + "sketch.status_fully_constrained": "totalmente restringido" + }, + "fr": { + "browser.sketch_attachment_lost": "{name} (attache perdue)", + "browser.sketch_editing": "{name} (en cours de modification)", + "sketch.status_conflict": "contraintes en conflit", + "sketch.status_fully_constrained": "entièrement contrainte" + }, + "he": { + "browser.sketch_attachment_lost": "{name} (ההצמדה אבדה)", + "browser.sketch_editing": "{name} (בעריכה)", + "sketch.status_conflict": "אילוצים סותרים", + "sketch.status_fully_constrained": "מאולץ במלואו" + }, + "it": { + "browser.sketch_attachment_lost": "{name} (aggancio perso)", + "browser.sketch_editing": "{name} (in modifica)", + "sketch.status_conflict": "vincoli in conflitto", + "sketch.status_fully_constrained": "completamente vincolato" + }, + "ja": { + "browser.sketch_attachment_lost": "{name} (アタッチメント消失)", + "browser.sketch_editing": "{name} (編集中)", + "sketch.status_conflict": "拘束が競合しています", + "sketch.status_fully_constrained": "完全拘束" + }, + "ko": { + "browser.sketch_attachment_lost": "{name} (부착 해제됨)", + "browser.sketch_editing": "{name} (편집 중)", + "sketch.status_conflict": "구속 조건 충돌", + "sketch.status_fully_constrained": "완전 구속" + }, + "vi": { + "browser.sketch_attachment_lost": "{name} (mất liên kết)", + "browser.sketch_editing": "{name} (đang sửa)", + "sketch.status_conflict": "ràng buộc xung đột", + "sketch.status_fully_constrained": "ràng buộc hoàn toàn" + }, + "zh": { + "browser.sketch_attachment_lost": "{name} (附着丢失)", + "browser.sketch_editing": "{name} (编辑中)", + "sketch.status_conflict": "约束冲突", + "sketch.status_fully_constrained": "完全约束" + }, + "zh-TW": { + "browser.sketch_attachment_lost": "{name} (附著遺失)", + "browser.sketch_editing": "{name} (編輯中)", + "sketch.status_conflict": "拘束衝突", + "sketch.status_fully_constrained": "完全拘束" + } +} diff --git a/crates/ui-egui/src/browser.rs b/crates/ui-egui/src/browser.rs index e794ea88f..b49a587e0 100644 --- a/crates/ui-egui/src/browser.rs +++ b/crates/ui-egui/src/browser.rs @@ -2032,9 +2032,9 @@ impl Entry { thing: Thing::Sketch(f.id), patterns: crate::sketch_pattern_tree::has_patterns(app, f.id).then(|| format!("s:{}/patterns", f.id)), label: if lost { - format!("{} (attachment lost)", f.name) + crate::i18n::format("browser.sketch_attachment_lost", &[("name", &crate::i18n::tr_name(&f.name))]) } else if active { - format!("{} (editing)", f.name) + crate::i18n::format("browser.sketch_editing", &[("name", &crate::i18n::tr_name(&f.name))]) } else { f.name.clone() }, diff --git a/crates/ui-egui/src/browser_model_tests.rs b/crates/ui-egui/src/browser_model_tests.rs index 89dfb43f3..9e6931023 100644 --- a/crates/ui-egui/src/browser_model_tests.rs +++ b/crates/ui-egui/src/browser_model_tests.rs @@ -409,3 +409,14 @@ fn browser_rows_still_fold_or_select_when_move_copy_is_not_open() { click(&mut h, "row:Bodies"); assert!(h.app.tree.collapsed.contains("c0/bodies")); } + +/// The sketch being edited is marked in the user's language, not with an English "(editing)", +/// and its default name reads as the browser shows it elsewhere. +#[test] +fn the_edited_sketch_is_marked_in_the_users_language() { + let mut h = crate::scenario::Harness::new(); + h.app.run("sketch.create", json!({"plane":"XY","name":"Sketch1"})).unwrap(); + let _japanese = crate::i18n::scope("ja"); + let rows = super::entries(&h.app, 0, "sketches"); + assert_eq!(rows.iter().map(|r| r.label.as_str()).collect::>(), ["スケッチ1 (編集中)"]); +} diff --git a/crates/ui-egui/src/viewport.rs b/crates/ui-egui/src/viewport.rs index 17dee33c7..3e232824e 100644 --- a/crates/ui-egui/src/viewport.rs +++ b/crates/ui-egui/src/viewport.rs @@ -5331,13 +5331,16 @@ fn overlays(app: &SolveApp, painter: &egui::Painter, proj: &Proj) { loose_end_markers(sk, &ss.ends, &ss.plane, painter, proj, &v); // Sketch status. if let Some(r) = app.viewport.layout.as_ref().map(|l| l.content) { - let msg = if !ss.report.ok() { - format!("{} — constraints conflict", ss.name) + let status = if !ss.report.ok() { + crate::i18n::tr("sketch.status_conflict").to_string() } else if ss.report.dof == 0 { - format!("{} — fully constrained", ss.name) + crate::i18n::tr("sketch.status_fully_constrained").to_string() + } else if ss.report.dof == 1 { + crate::i18n::tr("ui.1_degree_of_freedom").to_string() } else { - format!("{} — {} degrees of freedom", ss.name, ss.report.dof) + crate::i18n::format("sketch.degrees_of_freedom", &[("count", &ss.report.dof.to_string())]) }; + let msg = format!("{} — {status}", crate::i18n::tr_name(&ss.name)); let c = if ss.report.ok() { v.sketch_accent } else { v.error }; painter.text(pos2(r.left() + 12.0, r.top() + 12.0), Align2::LEFT_TOP, msg, FontId::proportional(t.font_button), c); }