Merge pull request #16560

Co-authored-by: autocraft-bot[bot] <354215646+autocraft-bot[bot]@users.noreply.github.com>
This commit is contained in:
davidmann4andautocraft-bot[bot] authored and autocraft-bot[bot] committed 2026-12-02 08:06:59 +00:00
commit 5f23d8bd83
2 files changed
+30 -1

No files matched your search

@@ -271,3 +271,10 @@ fn monitor_color_follows_a_monitor_profile_change() {
let c = &app.session.color().settings;
assert_eq!((c.preset.as_str(), c.working_rgb.as_str(), c.monitor_profile.as_str()), ("Monitor Color", "display-p3", "display-p3"));
}
#[test]
fn every_setup_has_a_spelled_out_label_that_reads_its_name_in_english() {
for name in COLOR_SETTINGS_PRESETS {
assert_eq!(preset_label(name), Some(name), "a setup missing from `preset_label`, or a misspelled key, shows untranslated");
}
}
@@ -49,7 +49,8 @@ pub(super) fn row(label: Label) -> Param {
let name = label.clone();
Param::custom(KEY, label, move |ui, fields, _| {
let mut entries = Vec::new();
let named = COLOR_SETTINGS_PRESETS.iter().map(|n| (*n, *n));
// The labels are translated; the values stay the English names scripts and saved settings use.
let named = COLOR_SETTINGS_PRESETS.iter().map(|n| (*n, preset_label(n).unwrap_or(n)));
for (value, label) in [(CUSTOM_SETTINGS, tl!("Custom")), (OTHER, tl!("Other"))].into_iter().chain(named) {
if GROUP_STARTS.contains(&value) {
entries.push(Entry::separator());
@@ -64,6 +65,27 @@ pub(super) fn row(label: Label) -> Param {
})
}
/// A named setup's translated label, spelled out so `cargo xtask i18n-coverage` lists each one;
/// `None` for a name the menu doesn't have.
fn preset_label(name: &str) -> Option<&'static str> {
Some(match name {
"Europe General Purpose 3" => tl!("Europe General Purpose 3"),
"Europe Prepress 3" => tl!("Europe Prepress 3"),
"Europe Web/Internet 2" => tl!("Europe Web/Internet 2"),
"Monitor Color" => tl!("Monitor Color"),
"Japan Color for Newspaper" => tl!("Japan Color for Newspaper"),
"Japan General Purpose 2" => tl!("Japan General Purpose 2"),
"Japan Magazine Advertisement Color" => tl!("Japan Magazine Advertisement Color"),
"Japan Prepress 2" => tl!("Japan Prepress 2"),
"Japan Web/Internet" => tl!("Japan Web/Internet"),
"North America General Purpose 2" => tl!("North America General Purpose 2"),
"North America Newspaper" => tl!("North America Newspaper"),
"North America Prepress 2" => tl!("North America Prepress 2"),
"North America Web/Internet" => tl!("North America Web/Internet"),
_ => return None,
})
}
/// Blend Text Colors Using Gamma, in place of the spec's two rows: the checkbox, with the field
/// beside it. The field shows two decimals, 1.00 to 3.00, and stays editable while the box is off;
/// a value typed or stepped into it checks the box. A value typed out of range is held to the