Timeline: the feature menu's suppress item follows the reader's language (#8301) (#8383)

* claim: #8301

* Timeline: the feature menu's suppress item follows the reader's language (#8301)

Suppress Features / Unsuppress Features were raw literals. Menu::label()
translates a label only when a catalog entry carries it, and none did, so the
item stayed English in every language, the Japanese UI included.

The two labels are now the messages timeline.suppress_features and
timeline.unsuppress_features in a new assets/locales/pending file: the English
wording is unchanged, and the complete catalogs (ar, he, ja, vi, zh) plus de and
ko carry the translations.

cargo test --profile ci -p solidcraft-ui-egui --lib -- timeline::tests::the_feature_menu_suppress_item_follows_the_language
fails on the claim commit (the Japanese menu paints the English literal) and
passes with the change.
This commit is contained in:
Colin Faulkingham
2026-10-28 18:55:37 +00:00
committed by GitHub
parent 94d23338fe
commit c2e69ed724
2 changed files with 73 additions and 1 deletions
@@ -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"
}
}
+39 -1
View File
@@ -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::{