From 1387eb70b89756eee0d098dc5302eeb0a7183ed8 Mon Sep 17 00:00:00 2001 From: dotCooCoo Date: Tue, 17 Nov 2026 21:52:33 -0800 Subject: [PATCH] Save PDF: the saved Summary writes each option line with the interface language's colon The Summary section shows option lines with the colon the language uses (a no-break space before it in French, a full-width colon in Japanese and Chinese). The saved Summary file wrote a plain colon. Both now build the line with one helper. --- crates/ui-egui/src/dialogs/save_pdf.rs | 8 ++++---- crates/ui-egui/src/dialogs/save_pdf/tests.rs | 14 ++++++++++++++ 2 files changed, 18 insertions(+), 4 deletions(-) diff --git a/crates/ui-egui/src/dialogs/save_pdf.rs b/crates/ui-egui/src/dialogs/save_pdf.rs index 96c62858b6..53518c82c7 100644 --- a/crates/ui-egui/src/dialogs/save_pdf.rs +++ b/crates/ui-egui/src/dialogs/save_pdf.rs @@ -1041,8 +1041,7 @@ fn write_summary(app: &mut VectorcraftApp, path: Option, text: &str) -> pub(super) fn option_rows<'a>(ui: &mut egui::Ui, changed: impl IntoIterator, label: impl Fn(&str) -> String) { let t = Tokens::get(ui.ctx()); for c in changed { - let value = option_value(c); - ui.label(egui::RichText::new(format!("{} {value}", crate::i18n::colon(&label(c["option"].as_str().unwrap_or_default())))).color(t.text)); + ui.label(egui::RichText::new(option_line(c, &label)).color(t.text)); } } @@ -1056,9 +1055,10 @@ fn option_value(c: &Value) -> String { } } -/// The Summary's line for the changed option `c` (`{option, value}`), labeled by `label`. +/// The Summary's line for the changed option `c` (`{option, value}`), labeled by `label`, with the +/// colon the interface language writes. fn option_line(c: &Value, label: impl Fn(&str) -> String) -> String { - format!("{}: {}", label(c["option"].as_str().unwrap_or_default()), option_value(c)) + format!("{} {}", crate::i18n::colon(&label(c["option"].as_str().unwrap_or_default())), option_value(c)) } /// The Summary's warnings ("None." without any). diff --git a/crates/ui-egui/src/dialogs/save_pdf/tests.rs b/crates/ui-egui/src/dialogs/save_pdf/tests.rs index 7cd0e23eba..7dad436d42 100644 --- a/crates/ui-egui/src/dialogs/save_pdf/tests.rs +++ b/crates/ui-egui/src/dialogs/save_pdf/tests.rs @@ -389,6 +389,20 @@ fn the_save_summary_button_writes_the_summary() { assert!(String::from_utf8(d[0].1.clone()).unwrap().starts_with("Options\n")); } +/// The saved Summary writes each option line with the colon the interface language uses, as the +/// Summary section shows it: French puts a no-break space before the colon, Japanese writes a +/// full-width colon. +#[test] +fn the_summary_text_uses_the_languages_colon() { + let changed = json!({"option": "thumbnails", "value": true}); + for (code, colon) in [("en", ":"), ("fr", "\u{a0}:"), ("ja", ":")] { + crate::i18n::set_current(crate::i18n::Lang::from_code(code).expect("registered")); + let line = option_line(&changed, |_| "X".to_string()); + crate::i18n::set_current(crate::i18n::Lang::EN); + assert!(line.starts_with(&format!("X{colon} ")), "{code}: {line:?}"); + } +} + /// Click the Summary section's Save Summary… button in frames of the dialog layer (the dialog's /// window draws nothing in its first frame, which sizes it). fn click_save_summary(app: &mut VectorcraftApp, ctx: &egui::Context) {