SolidCraft: an open-source parametric 3D CAD application built in pure Rust. Desktop, web, and automation through MCP.
Timeline: the feature menu's suppress item follows the reader's language (#8301) (#8383)
Colin Faulkinghamc2e69ed724b5
diff --git a/assets/locales/pending/timeline-suppress-labels.json b/assets/locales/pending/timeline-suppress-labels.jsonnew file mode 100644index 0000000000..de4e4eca32--- /dev/null+++ b/assets/locales/pending/timeline-suppress-labels.json@@ -0,0 +1,34 @@+{+ "en": {+ "timeline.suppress_features": "Suppress Features",+ "timeline.unsuppress_features": "Unsuppress Features"+ },+ "ja": {+ "timeline.suppress_features": "フィーチャーを抑制",+ "timeline.unsuppress_features": "フィーチャーの抑制を解除"+ },+ "zh": {+ "timeline.suppress_features": "抑制特征",+ "timeline.unsuppress_features": "取消抑制特征"+ },+ "de": {+ "timeline.suppress_features": "Merkmale unterdrücken",+ "timeline.unsuppress_features": "Unterdrückung der Merkmale aufheben"+ },+ "ko": {+ "timeline.suppress_features": "특성 비활성화",+ "timeline.unsuppress_features": "특성 비활성화 해제"+ },+ "ar": {+ "timeline.suppress_features": "تعطيل الميزات",+ "timeline.unsuppress_features": "إلغاء تعطيل الميزات"+ },+ "he": {+ "timeline.suppress_features": "השבתת פיצ'רים",+ "timeline.unsuppress_features": "ביטול השבתת פיצ'רים"+ },+ "vi": {+ "timeline.suppress_features": "Bỏ kích hoạt các tính năng",+ "timeline.unsuppress_features": "Kích hoạt lại các tính năng"+ }+}diff --git a/crates/ui-egui/src/timeline.rs b/crates/ui-egui/src/timeline.rsindex 0c82e48a2f..7eadd82ae2 100644--- a/crates/ui-egui/src/timeline.rs+++ b/crates/ui-egui/src/timeline.rs@@ -652,7 +652,10 @@ fn timeline_contents(app: &mut SolveApp, ui: &mut egui::Ui, floating: bool) {app.dialog = Some(crate::dialogs::Dialog::rename(*id, name));ui.close();}- if crate::context_menu::button(ui, if *suppressed { "Unsuppress Features" } else { "Suppress Features" }, "suppress").clicked() {+ // Its own message, not a literal: no catalog held the literal, so the item+ // stayed English in every language (#8301).+ let suppress = if *suppressed { "timeline.unsuppress_features" } else { "timeline.suppress_features" };+ if crate::context_menu::button(ui, crate::i18n::tr(suppress), "suppress").clicked() {let _ = app.run_heavy("timeline.suppress", json!({"feature": id}));ui.close();}@@ -825,6 +828,41 @@ mod tests {}}+ /// #8301: the feature menu's suppress item is drawn from the catalog, so it follows the+ /// reader's language. The literals it used were in no catalog and stayed English in every+ /// language, the Japanese UI included.+ #[test]+ fn the_feature_menu_suppress_item_follows_the_language() {+ let mut h = two_boxes(false);+ h.app.preferences.language = "ja".into();+ h.frames(2);+ let painted = |h: &Harness| -> Vec<String> {+ let output = egui::FullOutput { shapes: h.shapes.clone(), ..Default::default() };+ crate::test_support::text_shapes(&output).map(|t| t.galley.text().to_string()).collect()+ };+ // No English on screen: the item shows the reader's language.+ h.step(&json!({"click": {"handle": "timeline:First"}, "button": "right"})).unwrap();+ let texts = painted(&h);+ assert!(!texts.iter().any(|t| t == "Suppress Features"), "the English literal is painted in the Japanese UI: {texts:?}");+ let ja = crate::i18n::Locale::for_language("ja").text("timeline.suppress_features").to_string();+ let ja_unsuppress = crate::i18n::Locale::for_language("ja").text("timeline.unsuppress_features").to_string();+ assert!(texts.contains(&ja), "the item must read {ja}: {texts:?}");+ h.step(&json!({"key": "Escape"})).unwrap();+ // A suppressed feature offers the other way round.+ let first = h.app.session.doc.find_feature("First").map(|f| f.id).unwrap();+ h.app.run("timeline.suppress", json!({"feature": first, "suppressed": true})).unwrap();+ h.frames(2);+ h.step(&json!({"click": {"handle": "timeline:First"}, "button": "right"})).unwrap();+ let texts = painted(&h);+ assert!(!texts.iter().any(|t| t == "Unsuppress Features"), "the English literal is painted in the Japanese UI: {texts:?}");+ assert!(texts.contains(&ja_unsuppress), "the item must read {ja_unsuppress}: {texts:?}");+ h.step(&json!({"key": "Escape"})).unwrap();+ // The English wording is the one the menu always showed: the change adds messages, it+ // does not reword the item.+ assert_eq!(crate::i18n::Locale::for_language("en").text("timeline.suppress_features"), "Suppress Features");+ assert_eq!(crate::i18n::Locale::for_language("en").text("timeline.unsuppress_features"), "Unsuppress Features");+ }+#[test]fn construction_history_matches_the_tool_that_created_it() {use solidcraft_engine::doc::{