i18n: file pickers show file types in the interface language

The save panel and the Tracing Presets Import... picker passed each file
type's English label to the picker. They now name it with its
file-filter row, falling back to the plain row and then to English.
This commit is contained in:
dotCooCoo
2026-11-24 23:46:51 -08:00
parent cf1712e034
commit c6b92415f9
4 changed files with 31 additions and 4 deletions
@@ -251,7 +251,8 @@ fn run(app: &mut VectorcraftApp, act: Action, current: &str) -> Result<(), Strin
select(app, next.as_deref().unwrap_or("Default"));
}
Action::Import => {
let request = PickRequest::open("tracingPresets").filter("Tracing presets", TRACE_PRESET_EXTS);
let name = file_asks::filter_name(crate::i18n::current(), "Tracing presets");
let request = PickRequest::open("tracingPresets").filter(name, TRACE_PRESET_EXTS);
// The answer, or its failure, reaches the status bar from the continuation; nothing is pending here.
let _ = file_asks::ask(app, request, Owner::Free, picked);
}
+14 -2
View File
@@ -201,9 +201,21 @@ pub(crate) fn answer_path(app: &mut VectorcraftApp, dialog: DialogId, key: Strin
});
}
/// The file types of `list`, `(label, extensions)` as the engine lists them, as a picker offers them.
/// The file types of `list`, `(label, extensions)` as the engine lists them, as a picker offers them,
/// named in the interface language.
pub(crate) fn filters(list: &[(&str, &[&str])]) -> Vec<FileFilter> {
list.iter().map(|&(name, extensions)| FileFilter::new(name, extensions)).collect()
filters_in(crate::i18n::current(), list)
}
/// [`filters`] with the names in `lang`: a label's `file-filter` row, else its plain row, else the
/// English label.
pub(crate) fn filters_in(lang: crate::i18n::Lang, list: &[(&str, &[&str])]) -> Vec<FileFilter> {
list.iter().map(|&(name, extensions)| FileFilter::new(filter_name(lang, name), extensions)).collect()
}
/// The name a picker shows for the file type labeled `name` in `lang`.
pub(crate) fn filter_name(lang: crate::i18n::Lang, name: &str) -> &str {
crate::i18n::tr_ctx(lang, "file-filter", name)
}
/// The first file of an Open answer as the params of an open command: `path`, or the bytes with the
+14
View File
@@ -2288,6 +2288,20 @@ fn save_panel_file_types_are_in_complete_catalogs() {
assert!(missing.is_empty(), "{missing:?}");
}
/// A picker names its file types with their `file-filter` rows, so the save panel and the Tracing
/// Presets Import… picker show them in the interface language.
#[test]
fn pickers_name_file_types_in_the_interface_language() {
let names = |lang| crate::file_asks::filters_in(lang, crate::io::FILE_TYPES).into_iter().map(|f| f.name).collect::<Vec<_>>();
let (english, german) = (names(Lang::EN), names(lang("de")));
for label in ["Tracing presets", "Action sets", "Composite fonts"] {
assert!(english.iter().any(|n| n == label), "{label}");
assert!(german.iter().any(|n| n == tr_ctx(lang("de"), "file-filter", label)), "{label}");
assert!(!german.iter().any(|n| n == label), "{label} shown in English");
}
assert_eq!(crate::file_asks::filter_name(lang("de"), "Tracing presets"), "Nachzeichnervorgaben");
}
/// (context, English source) of the labels [`untranslated_report`] lists for a language without
/// their rows: the file dialogs' filter names, the status bar's timings, New Document's preset
/// name, the contributor tooltips, the gradient kind in a swatch's description, the printer mark
+1 -1
View File
@@ -1911,7 +1911,7 @@ Moved from the ROADMAP's "Shipped so far" on 2026-10-10. Update it when a featur
- **Image Trace small contours:** closed fits too small to form an editable subpath retain their positioned outline, including holes. Source-generated island, hole/winding and stepped-region regressions cover Corners and Noise; defaults, parity scores and estimates are unchanged.
- **Image Trace, custom presets:** Manage Presets next to the Image Trace panel's Preset dropdown saves the panel's settings as a new preset under a name (Save as New Preset…) and renames or deletes the saved preset shown; built-in presets don't change. Saved presets are kept with the preferences and follow the built-in ones in the panel, Control bar and Properties preset lists. `imageTrace.presets.save` and `imageTrace.presets.delete` save, rename and delete them, `imageTrace.presets` lists them, and `imageTrace.make {preset}` traces with one by name.
- **Image Trace, Edit › Tracing Presets…:** the menu item opens a manager for the same presets, as the [help page](https://help.adobe.com/archive/en_US/illustrator/cs5/illustrator_cs5_help.pdf#page=106) describes: New… makes a preset from the selected one, Edit… and Delete change saved presets only (built-in presets, in brackets, don't change), and Import… and Export… exchange the saved presets through a `.vctracepresets` file (`imageTrace.presets.import` / `.export`, `ui.tracingPresetsDialog`). The file layout, the question before an import replaces saved presets of the same names (Cancel keeps them), the selection after Delete and the editor's Cancel are VectorCraft's own.
- **Image Trace, the Tracing presets file type in every language:** the file pickers of Edit › Tracing Presets… Import… and Export… name the Tracing presets file type in the interface language. The save panel also translates its Action sets and Composite fonts file types in every complete catalog, and Perspective grid presets in Gujarati. Test: `save_panel_file_types_are_in_complete_catalogs` in `crates/ui-egui`.
- **Image Trace, the Tracing presets file type in every language:** the file pickers of Edit › Tracing Presets… Import… and Export… name the Tracing presets file type in the interface language. The save panel also translates its Action sets and Composite fonts file types in every complete catalog, and Perspective grid presets in Gujarati. Tests: `save_panel_file_types_are_in_complete_catalogs` and `pickers_name_file_types_in_the_interface_language` in `crates/ui-egui`.
- **Image Trace, preset buttons:** six buttons above the Image Trace panel's Preset dropdown choose a preset as the dropdown does, for the options the [help page](https://helpx.adobe.com/illustrator/desktop/manage-objects/traces-mockups-symbols/image-trace-panel-options.html) lists before Preset. The presets each button chooses are VectorCraft's own: Auto Color chooses Auto Color, High Color chooses High Fidelity Photo, Low Color chooses Low Fidelity Photo, Grayscale chooses Shades of Gray, Black and White chooses Black and White Logo, and Outline chooses Outline. With Preview on, a click traces the selected Image Trace object again as one undo step; with nothing traced selected, it changes the panel's settings only. The button of the panel's preset shows as selected.
- **Create Strokes baseline (2026-10-17, measured):** the ignored centre-lines class covers 23 exact code-drawn scenes in aa and hard variants, including junctions, crossings, fills meeting strokes and varying widths. [Baseline and metric definitions](image-trace-quality.md#centre-lines). Topology is recovered from emitted geometry; width-profile metrics remain unavailable. No behaviour change or score increase.
- **Image Trace, collapsed loops keep few segments:** a loop whose fit collapses to one cubic keeps the fewest segments that hold its area and course, so a higher Paths gives no fewer segments; a code-drawn Paths sweep in `crates/trace` (see [quality notes](image-trace-quality.md#collapsed-loops-keep-few-segments)).