i18n: the viewer toolbar and the solid dialog ask the catalog for the text they draw

Text a helper draws for a panel was handed to that helper as a bare literal, so the catalog lookup
never happened and parts of the interface stayed English with a Chinese language chosen:

- the Composition panel's toolbar tooltips - Choose grid and guide options, Toggle Transparency
  Grid, Toggle Mask and Shape Path Visibility, Region of Interest, Show Channel and Color
  Management Settings, Reset Exposure, Take Snapshot, Show Snapshot (hold);
- the items of its four popups (grid and guides, resolution, magnification, channel) - Grid,
  Guides, Rulers, Proportional Grid, 3D Reference Axes, Full, Half, Third, Quarter, Custom...,
  Fit, Fit up to 100%, Colorize;
- the solid dialog's "Affect all layers that use this solid" checkbox and its disabled hint
  "Only this layer uses this solid.".

`tog` and `popup` now look the label up themselves, so every current and future call site is
covered by one change each; the automation ids and labels stay English, as the rest of the panels
keep them for scripts and tests. `resolution_label` composes its words from the catalog, so the
closed resolution dropdown reads Chinese too, and the viewer's item now reuses the panel's existing
"Title/action safe" row instead of a second spelling of the same concept.

21 rows join the Simplified catalog. The same keys join the Traditional one with the English source
as their value: the tests require the two lists to match, and the Traditional wording is the
translator's call rather than this change's.

Tests: the row-completeness check now also accepts a row that a helper draws (its English source
appears as a literal there), and a new check refuses a bare `Checkbox::new` / `RadioButton::new`
label - the shape that hid the solid dialog, and the one the literal scan cannot see because the
label is the call's second argument.

This also corrects two Simplified rows #398 left wrong (`Channel` read 色版 in a Simplified
catalog, `Motion Blur: {}` read 动态模糊 while the menu catalog's own Motion Blur is 运动模糊).
This commit is contained in:
WaWu
2026-10-10 13:33:35 +08:00
parent 813c7c4650
commit 1ab6eb963f
3 changed files with 89 additions and 12 deletions
+2 -2
View File
@@ -418,8 +418,8 @@ fn solid(app: &mut EffectcraftApp, ctx: &egui::Context, t: &Tokens) {
if editing.is_some() {
ui.add_space(8.0);
let r = ui
.add_enabled(shared, egui::Checkbox::new(&mut affect_all, "Affect all layers that use this solid"))
.on_disabled_hover_text("Only this layer uses this solid.");
.add_enabled(shared, egui::Checkbox::new(&mut affect_all, tr("Affect all layers that use this solid")))
.on_disabled_hover_text(tr("Only this layer uses this solid."));
auto.add("dialog.solid.affectAll", r.rect, "Affect all layers that use this solid");
if shared && !affect_all {
ui.label(egui::RichText::new(tr("This change will create a new solid for this layer.")).color(t.text_dim).size(11.0));
+10 -6
View File
@@ -486,7 +486,9 @@ fn popup(app: &mut EffectcraftApp, ui: &mut egui::Ui, id: &str, anchor: Rect, it
ui.separator();
continue;
}
let r = ui.selectable_label(*on, label.as_str());
// The item is the English source: the drawn text is looked up in the catalog, while
// the automation label stays English for scripts and tests.
let r = ui.selectable_label(*on, crate::i18n::tr(label));
app.auto.add(&format!("viewer.{auto}.{i}"), r.rect, label);
if r.clicked() {
chosen = Some(i);
@@ -520,10 +522,10 @@ pub(crate) fn resolution_label(res: Resolution, scale: f64) -> String {
} else {
"Quarter"
};
format!("({r})")
format!("({})", crate::i18n::tr(r))
}
Resolution::Custom(n) => format!("Custom ({n})"),
r => r.label().to_string(),
Resolution::Custom(n) => format!("{} ({n})", crate::i18n::tr("Custom")),
r => crate::i18n::tr(r.label()).to_string(),
}
}
@@ -602,7 +604,9 @@ pub(crate) fn bottom_bar(app: &mut EffectcraftApp, ui: &mut egui::Ui, bar: Rect,
let tog = |ui: &mut egui::Ui, auto: &mut crate::automation::Registry, x: &mut f32, icon: Icon, on: bool, id: &str, tip: &str| -> (bool, Rect) {
let r = Rect::from_min_size(pos2(*x, cy - 11.0), vec2(22.0, 22.0));
let resp = widgets::icon_button(ui, r, icon, on, &t, egui::Id::new(("vw-btn", id))).on_hover_text(tip);
// The tip is the English source: the tooltip is looked up in the catalog, while the
// automation label stays English for scripts and tests.
let resp = widgets::icon_button(ui, r, icon, on, &t, egui::Id::new(("vw-btn", id))).on_hover_text(crate::i18n::tr(tip));
auto.add(&format!("viewer.{id}"), r, tip);
*x += 24.0;
(resp.clicked(), r)
@@ -632,7 +636,7 @@ pub(crate) fn bottom_bar(app: &mut EffectcraftApp, ui: &mut egui::Ui, bar: Rect,
}
let v = &app.ui.viewer;
let items = vec![
("Title/Action Safe".to_string(), v.safe_margins),
("Title/action safe".to_string(), v.safe_margins),
("Proportional Grid".to_string(), v.proportional_grid),
("Grid".to_string(), v.grid),
("Guides".to_string(), v.guides),