Document Info: Brushes shows brush types in the interface language

The Brushes rows name each type as the New Brush dialog does (Art Brush,
Scatter Brush) and say "missing from the Brushes panel" for a brush the
panel does not hold. The panel now shows these values through the
catalogs, so a localized interface no longer shows them in English.
document.info and the saved report keep them in English. Every catalog
gets a row for "missing from the Brushes panel"; the type names already
had rows.
This commit is contained in:
dotCooCoo
2026-11-12 14:40:14 -08:00
parent efaa9afb9a
commit c7900a9705
30 changed files with 77 additions and 7 deletions
+7 -6
View File
@@ -629,14 +629,15 @@ fn info(s: &mut Session, p: &Value) -> Result<Value> {
}
let font_names: Vec<String> = fonts.iter().map(super::fonts::font_label).collect();
// Each brush the art uses with its type, found by name in the Brushes panel as the renderer finds it (the last of two
// brushes with one name); a brush the panel does not hold draws as a plain stroke and has no type.
// brushes with one name); a brush the panel does not hold draws as a plain stroke and has no type. A row names the type
// as the New Brush dialog does (`Art Brush`), and the panel translates these values when it shows them.
let kinds: HashMap<&str, &vectorcraft_brush::BrushKind> = library.iter().map(|b| (b.name.as_str(), &b.kind)).collect();
let brush_entries: Vec<Value> =
brushes.iter().map(|name| json!({ "name": name, "type": kinds.get(name.as_str()).map(|k| k.type_id()) })).collect();
let brush_rows: Vec<(String, String)> = brushes
.iter()
.map(|name| {
(name.clone(), kinds.get(name.as_str()).map_or_else(|| "missing from the Brushes panel".to_string(), |k| format!("{} brush", k.label())))
(name.clone(), kinds.get(name.as_str()).map_or_else(|| "missing from the Brushes panel".to_string(), |k| format!("{} Brush", k.label())))
})
.collect();
let mut out = json!({
@@ -805,10 +806,10 @@ mod tests {
let i = brushes(&mut s, json!({"category": "brushes"}));
assert_eq!(i["brushNames"], json!(["Charcoal", "Dots"]));
assert_eq!(i["brushes"], json!([{"name": "Charcoal", "type": "art"}, {"name": "Dots", "type": "scatter"}]));
assert_eq!(i["sections"][0]["rows"], json!([["Charcoal", "Art brush"], ["Dots", "Scatter brush"]]));
assert_eq!(i["sections"][0]["rows"], json!([["Charcoal", "Art Brush"], ["Dots", "Scatter Brush"]]));
assert!(panel.contains(&json!("3 pt. Round")) && i["panelBrushNames"] == json!(panel));
let text = brushes(&mut s, json!({"category": "brushes", "format": "text"}))["text"].as_str().unwrap().to_string();
assert!(text.contains("\nBRUSHES\nCharcoal: Art brush\nDots: Scatter brush\n") && !text.contains("3 pt. Round"), "{text}");
assert!(text.contains("\nBRUSHES\nCharcoal: Art Brush\nDots: Scatter Brush\n") && !text.contains("3 pt. Round"), "{text}");
assert!(!text.contains("OBJECTS"), "{text}");
// Selection Only: the brushes the selected objects' strokes use.
let selected = |s: &mut Session| brushes(s, json!({"selectionOnly": true, "category": "brushes"}));
@@ -818,10 +819,10 @@ mod tests {
let i = selected(&mut s);
assert_eq!(
(i["brushes"].clone(), i["sections"][0]["rows"].clone()),
(json!([{"name": "Dots", "type": "scatter"}]), json!([["Dots", "Scatter brush"]]))
(json!([{"name": "Dots", "type": "scatter"}]), json!([["Dots", "Scatter Brush"]]))
);
let text = brushes(&mut s, json!({"selectionOnly": true, "category": "brushes", "format": "text"}))["text"].as_str().unwrap().to_string();
assert!(text.contains("\nBRUSHES\nDots: Scatter brush\n") && !text.contains("Charcoal"), "{text}");
assert!(text.contains("\nBRUSHES\nDots: Scatter Brush\n") && !text.contains("Charcoal"), "{text}");
// A stroke without a brush lists none.
let plain = s.execute("shape.rectangle", &json!({"x": 60, "y": 0, "width": 10, "height": 10})).unwrap()["id"].clone();
s.execute("select.set", &json!({"ids": [plain]})).unwrap();
+1
View File
@@ -2103,6 +2103,7 @@ font-technology Variable Променливи
Art Brush Артистична четка
Bristle Brush Четка с косъм
Pattern Brush Четка с мостра
missing from the Brushes panel липсва в панела „Четки“
Select art to make a scatter, art or pattern brush. Изберете графика, за да създадете разпръсната четка, артистична четка или четка с мостра.
Brush Art Графика на четка
New Calligraphic Brush Нова калиграфска четка
Can't render this file because it contains an unexpected character in line 2 and column 73.
+1
View File
@@ -3322,6 +3322,7 @@ theme Appearance Izgled
Art Brush Umjetnička četkica
Bristle Brush Četkica s čekinjama
Pattern Brush Četkica uzorka
missing from the Brushes panel nedostaje u panelu Četkice
Select art to make a scatter, art or pattern brush. Odaberite crtež da napravite raspršenu, umjetničku četkicu ili četkicu uzorka.
Brush Art Crtež četkice
New Symbol Novi simbol
Can't render this file because it contains an unexpected character in line 2 and column 73.
+1
View File
@@ -3090,6 +3090,7 @@ digits Malayalam Malaiàlam
Pattern Motiu
Pattern Borders Vores de motiu
Pattern Brush Pinzell de motiu
missing from the Brushes panel absent del tauler Pinzells
Pattern Brush Options Opcions del pinzell de motiu
Pattern Editing Edició de motius
Pattern Options Opcions del motiu
Can't render this file because it contains an unexpected character in line 2 and column 73.
+1
View File
@@ -3372,6 +3372,7 @@ theme Appearance Motiv
Art Brush Obrazový štětec
Bristle Brush Štětinový štětec
Pattern Brush Vzorkový štětec
missing from the Brushes panel chybí v panelu Štětce
Select art to make a scatter, art or pattern brush. Vyberte kresbu, abyste mohli vytvořit rozptylový, obrazový nebo vzorkový štětec.
Brush Art Kresba štětce
New Symbol Nový symbol
Can't render this file because it contains an unexpected character in line 2 and column 73.
+1
View File
@@ -3107,6 +3107,7 @@ theme Appearance Udseende
Art Brush Grafikpensel
Bristle Brush Børstepensel
Pattern Brush Mønsterpensel
missing from the Brushes panel mangler i panelet Pensler
Select art to make a scatter, art or pattern brush. Markér grafik for at oprette en spredningspensel, grafikpensel eller mønsterpensel.
Brush Art Penselgrafik
New Symbol Nyt symbol
Can't render this file because it contains an unexpected character in line 2 and column 73.
+1
View File
@@ -2137,6 +2137,7 @@ file-filter Templates Vorlagen
Art Brush Bildpinsel
Bristle Brush Borstenpinsel
Pattern Brush Musterpinsel
missing from the Brushes panel fehlt im Bedienfeld „Pinsel“
Select art to make a scatter, art or pattern brush. Wählen Sie eine Grafik aus, um einen Spezial-, Bild- oder Musterpinsel zu erstellen.
Brush Art Pinselgrafik
New Calligraphic Brush Neuer Kalligrafiepinsel
Can't render this file because it contains an unexpected character in line 2 and column 73.
+1
View File
@@ -1814,6 +1814,7 @@ font-technology Variable Μεταβλητές
Art Brush Πινέλο σχεδίου
Bristle Brush Πινέλο με τρίχες
Pattern Brush Πινέλο μοτίβου
missing from the Brushes panel λείπει από τον πίνακα Πινέλα
Select art to make a scatter, art or pattern brush. Επιλέξτε σχέδιο για να δημιουργήσετε πινέλο διασποράς, σχεδίου ή μοτίβου.
Brush Art Σχέδιο πινέλου
New Layer… Νέο επίπεδο…
Can't render this file because it is too large.
+1
View File
@@ -2175,6 +2175,7 @@ font-technology Variable Variables
Art Brush Pincel de arte
Bristle Brush Pincel de cerdas
Pattern Brush Pincel de motivo
missing from the Brushes panel falta en el panel Pinceles
Select art to make a scatter, art or pattern brush. Selecciona una ilustración para crear un pincel de dispersión, de arte o de motivo.
Brush Art Ilustración del pincel
New Calligraphic Brush Nuevo pincel caligráfico
Can't render this file because it contains an unexpected character in line 2 and column 73.
+1
View File
@@ -3311,6 +3311,7 @@ theme Appearance Ulkoasu
Art Brush Taidesivellin
Bristle Brush Harjassivellin
Pattern Brush Kuviosivellin
missing from the Brushes panel puuttuu Siveltimet-paneelista
Select art to make a scatter, art or pattern brush. Valitse kuvitus, jotta voit luoda sirote-, taide- tai kuviosiveltimen.
Brush Art Siveltimen kuvitus
New Symbol Uusi symboli
Can't render this file because it contains an unexpected character in line 2 and column 73.
+1
View File
@@ -2167,6 +2167,7 @@ font-technology Variable Variables
Art Brush Forme artistique
Bristle Brush Forme Soies
Pattern Brush Forme de motif
missing from the Brushes panel absente du panneau Formes
Select art to make a scatter, art or pattern brush. Sélectionnez une illustration pour créer une forme diffuse, artistique ou de motif.
Brush Art Illustration de la forme
New Calligraphic Brush Nouvelle forme calligraphique
Can't render this file because it contains an unexpected character in line 2 and column 73.
+1
View File
@@ -3356,6 +3356,7 @@ antiAlias Sharp शार्प
Pattern पैटर्न
Pattern Borders पैटर्न सीमा
Pattern Brush पैटर्न ब्रश
missing from the Brushes panel ब्रश पैनल में अनुपलब्ध
Pattern Brush Options पैटर्न ब्रश ऑप्शन्स
Pattern Editing पैटर्न संपादन
Pattern Options पैटर्न ऑप्शन्स
Can't render this file because it is too large.
+1
View File
@@ -2984,6 +2984,7 @@ file-filter Templates Sablonok
Paths: {paths} Anchors: {anchors} Colors: {colors} Útvonalak: {paths} Horgonypontok: {anchors} Színek: {colors}
Pattern Mintázat
Pattern Brush Mintázatecset
missing from the Brushes panel hiányzik az Ecsetek panelről
Pattern Brush Options Mintázatecset beállításai
Pattern Editing Mintázatszerkesztés
Pattern Options Mintázat beállításai
Can't render this file because it contains an unexpected character in line 2 and column 73.
+1
View File
@@ -3107,6 +3107,7 @@ theme Appearance Tampilan
Art Brush Kuas seni
Bristle Brush Kuas bristle
Pattern Brush Kuas pola
missing from the Brushes panel tidak ada di panel Kuas
Select art to make a scatter, art or pattern brush. Pilih karya seni untuk membuat kuas sebar, seni, atau pola.
Brush Art Karya seni kuas
New Symbol Simbol baru
Can't render this file because it contains an unexpected character in line 2403 and column 5.
+1
View File
@@ -2213,6 +2213,7 @@ file-filter Templates Modelli
Art Brush Pennello artistico
Bristle Brush Pennello a setole
Pattern Brush Pennello motivo
missing from the Brushes panel mancante nel pannello Pennelli
Select art to make a scatter, art or pattern brush. Seleziona la grafica per creare un pennello a dispersione, artistico o motivo.
Brush Art Grafica del pennello
New Calligraphic Brush Nuovo pennello calligrafico
Can't render this file because it contains an unexpected character in line 2 and column 73.
+1
View File
@@ -2420,6 +2420,7 @@ antiAlias Sharp シャープ
Art Brush アートブラシ
Bristle Brush 剛毛ブラシ
Pattern Brush パターンブラシ
missing from the Brushes panel ブラシパネルにありません
Select art to make a scatter, art or pattern brush. 散布ブラシ、アートブラシ、パターンブラシを作成するには、アートを選択します。
Brush Art ブラシのアート
New Calligraphic Brush 新規絵筆ブラシ
Can't render this file because it contains an unexpected character in line 2 and column 73.
+1
View File
@@ -2950,6 +2950,7 @@ theme Appearance იერსახე
Art Brush მხატვრული ფუნჯი
Bristle Brush ჯაგრის ფუნჯი
Pattern Brush პატერნის ფუნჯი
missing from the Brushes panel ფუნჯების პანელში არ არის
Select art to make a scatter, art or pattern brush. მონიშნეთ ნახატი გაფანტვის, მხატვრული ან პატერნის ფუნჯის შესაქმნელად.
Brush Art ფუნჯის ნახატი
New Symbol ახალი სიმბოლო
Can't render this file because it is too large.
+1
View File
@@ -2410,6 +2410,7 @@ antiAlias Sharp 날카롭게
Art Brush 아트 브러시
Bristle Brush 강모 브러시
Pattern Brush 패턴 브러시
missing from the Brushes panel 브러시 패널에 없음
Select art to make a scatter, art or pattern brush. 흩뿌리기, 아트 또는 패턴 브러시를 만들려면 아트웍을 선택하세요.
Brush Art 브러시 아트
New Calligraphic Brush 새 캘리그래피 브러시
Can't render this file because it contains an unexpected character in line 2 and column 73.
+1
View File
@@ -3121,6 +3121,7 @@ theme Appearance Vormgeving
Art Brush Artpenseel
Bristle Brush Borstelpenseel
Pattern Brush Patroonpenseel
missing from the Brushes panel ontbreekt in het deelvenster Penselen
Select art to make a scatter, art or pattern brush. Selecteer illustratie om een verspreidings-, art- of patroonpenseel te maken.
Brush Art Penseelillustratie
New Symbol Nieuw symbool
Can't render this file because it contains an unexpected character in line 2 and column 73.
+1
View File
@@ -3251,6 +3251,7 @@ theme Appearance Wygląd
Art Brush Pędzel artystyczny
Bristle Brush Pędzel włosiankowy
Pattern Brush Pędzel wzorka
missing from the Brushes panel brak w panelu Pędzle
Select art to make a scatter, art or pattern brush. Zaznacz kompozycję, aby utworzyć pędzel rozproszony, artystyczny lub wzorka.
Brush Art Kompozycja pędzla
New Symbol Nowy symbol
Can't render this file because it contains an unexpected character in line 2 and column 73.
+1
View File
@@ -1788,6 +1788,7 @@ antiAlias Sharp Nítido
Art Brush Pincel de Arte
Bristle Brush Pincel de Cerdas
Pattern Brush Pincel de Padrão
missing from the Brushes panel ausente do painel Pincéis
Select art to make a scatter, art or pattern brush. Selecione arte para criar um pincel de dispersão, de arte ou de padrão.
Brush Art Arte do Pincel
New Calligraphic Brush Novo Pincel Caligráfico
Can't render this file because it contains an unexpected character in line 6 and column 47.
+1
View File
@@ -2200,6 +2200,7 @@ file-filter Templates Шаблоны
Art Brush Художественная кисть
Bristle Brush Щетинная кисть
Pattern Brush Узорная кисть
missing from the Brushes panel отсутствует в панели «Кисти»
Select art to make a scatter, art or pattern brush. Выделите рисунок, чтобы создать кисть-распыление, художественную или узорную кисть.
Brush Art Рисунок кисти
New Calligraphic Brush Новая каллиграфическая кисть
Can't render this file because it is too large.
+1
View File
@@ -2114,6 +2114,7 @@ font-technology Variable Variabla
Art Brush Konstpensel
Bristle Brush Borstpensel
Pattern Brush Mönsterpensel
missing from the Brushes panel saknas i panelen Penslar
Select art to make a scatter, art or pattern brush. Markera grafik för att skapa en spridnings-, konst- eller mönsterpensel.
Brush Art Penselgrafik
New Calligraphic Brush Ny kalligrafisk pensel
Can't render this file because it contains an unexpected character in line 5 and column 25.
+1
View File
@@ -5916,6 +5916,7 @@ theme Appearance Görünüm
Long Uzun
New Brush Yeni Fırça
Pattern Brush Desen Fırçası
missing from the Brushes panel Fırçalar panelinde yok
Pick Color From: Rengi Buradan Al:
Scatter Brush Serpme Fırçası
Select art to make a scatter, art or pattern brush. Bir serpme, resim veya desen fırçası oluşturmak için çizim seçin.
Can't render this file because it contains an unexpected character in line 5 and column 25.
+1
View File
@@ -2205,6 +2205,7 @@ file-filter Templates Шаблони
Art Brush Художній пензель
Bristle Brush Щетинний пензель
Pattern Brush Візерунковий пензель
missing from the Brushes panel відсутній у панелі «Пензлі»
Select art to make a scatter, art or pattern brush. Виділіть малюнок, щоб створити пензель-розпорошення, художній або візерунковий пензель.
Brush Art Малюнок пензля
New Calligraphic Brush Новий каліграфічний пензель
Can't render this file because it is too large.
+1
View File
@@ -2801,6 +2801,7 @@ digits Hindi Hindi
Paths: {paths} Anchors: {anchors} Colors: {colors} Đường dẫn: {paths} Điểm neo: {anchors} Màu: {colors}
Pattern Họa tiết
Pattern Brush Cọ họa tiết
missing from the Brushes panel không có trong bảng Cọ
Pattern Brush Options Tùy chọn cọ họa tiết
Pattern Editing Chỉnh sửa họa tiết
Pattern Options Tùy chọn họa tiết
Can't render this file because it contains an unexpected character in line 204 and column 5.
+1
View File
@@ -2074,6 +2074,7 @@ file-filter Templates 模板
Art Brush 艺术画笔
Bristle Brush 鬃毛画笔
Pattern Brush 图案画笔
missing from the Brushes panel “画笔”面板中没有
Select art to make a scatter, art or pattern brush. 选择图稿以创建散布画笔、艺术画笔或图案画笔。
Brush Art 画笔图稿
New Calligraphic Brush 新建书法画笔
Can't render this file because it contains an unexpected character in line 2 and column 73.
+1
View File
@@ -3177,6 +3177,7 @@ file-filter Templates 範本
Art Brush 藝術筆刷
Bristle Brush 鬃毛筆刷
Pattern Brush 圖樣筆刷
missing from the Brushes panel 「筆刷」面板中沒有
Select art to make a scatter, art or pattern brush. 選取圖稿以製作散佈筆刷、藝術筆刷或圖樣筆刷。
Brush Art 筆刷圖稿
New Calligraphic Brush 新增書法筆刷
Can't render this file because it contains an unexpected character in line 6 and column 47.
+42
View File
@@ -78,6 +78,8 @@ pub fn show(app: &mut VectorcraftApp, ui: &mut Ui) {
let label = super::label_or_name(label, !named.contains(&k));
if value.is_empty() {
widgets::dim_name(ui, label);
} else if s["id"] == "brushes" {
row(ui, label, brush_value(value).into());
} else {
row(ui, label, value.into());
}
@@ -86,6 +88,20 @@ pub fn show(app: &mut VectorcraftApp, ui: &mut Ui) {
});
}
/// A Brushes row's value in the interface language: the brush's type (`Art Brush`), or that the
/// Brushes panel does not hold the brush. `document.info` and the text report keep them in English.
fn brush_value(value: &str) -> &str {
match value {
"Calligraphic Brush" => tl!("Calligraphic Brush"),
"Scatter Brush" => tl!("Scatter Brush"),
"Art Brush" => tl!("Art Brush"),
"Pattern Brush" => tl!("Pattern Brush"),
"Bristle Brush" => tl!("Bristle Brush"),
"missing from the Brushes panel" => tl!("missing from the Brushes panel"),
_ => value,
}
}
/// The rows of Document Info section `id` labelled by a name (an artboard, a style, a swatch, a
/// font, an image, a repeat object) rather than an interface label: every row of the lists, and in Document the
/// artboards, which follow the Artboards count. Names are shown as they are.
@@ -295,4 +311,30 @@ mod tests {
let err = app.run("docInfo.save", json!({"path": "/tmp/info.txt", "category": "colors"})).unwrap_err();
assert!(err.contains("category `colors`"), "{err}");
}
/// Brushes shows each brush's type, and a brush the Brushes panel does not hold, in the
/// interface language; the saved report keeps them in English.
#[test]
fn brush_types_show_in_the_interface_language() {
let mut app = VectorcraftApp::new(vectorcraft_engine::Session::new(), Default::default());
app.session.execute("file.new", &json!({"width": 100, "height": 100})).unwrap();
let r = app.session.execute("shape.rectangle", &json!({"x": 10, "y": 10, "width": 30, "height": 20})).unwrap()["id"].clone();
app.session.execute("brush.apply", &json!({"ids": [r], "name": "Charcoal"})).unwrap();
let brushes = |app: &mut VectorcraftApp| {
crate::tests_labels::painted_text(app, |app, ui| {
set_pstate(ui.ctx(), "docinfo-category", "brushes".to_string());
show(app, ui);
})
};
let english = brushes(&mut app);
assert!(english.contains("Charcoal") && english.contains("Art Brush"), "{english}");
let Some(de) = crate::i18n::Lang::from_code("de") else { panic!("no German catalog") };
crate::i18n::set_current(de);
let (german, missing) = (brushes(&mut app), brush_value("missing from the Brushes panel").to_string());
crate::i18n::set_current(crate::i18n::Lang::EN);
assert!(german.contains("Charcoal") && german.contains("Bildpinsel") && !german.contains("Art Brush"), "{german}");
assert_eq!(missing, "fehlt im Bedienfeld „Pinsel“");
let report = app.session.execute("document.info", &json!({"category": "brushes", "format": "text"})).unwrap()["text"].to_string();
assert!(report.contains("Charcoal: Art Brush"), "{report}");
}
}
+1 -1
View File
@@ -6508,7 +6508,7 @@ paint or width, guides, paths with no segment, type that draws no characters, a
shape left out; with `selectionOnly`, the brushes the selected
objects' strokes use), `brushes` (`[{name, type}]`: those brushes with their types, `calligraphic`, `scatter`, `art`,
`pattern` or `bristle`, and `null` for a brush the Brushes panel does not hold; the brushes category's rows give each
name with its type, such as `Art brush`, or `missing from the Brushes panel`), `panelBrushNames` (the Brushes panel's brushes, whether art uses them or not), `repeatObjects` (`[{id, name, type, instances, rows?, cols?}]`: every Repeat object, those in
name with its type, such as `Art Brush`, or `missing from the Brushes panel`, in English; the Document Info panel shows them in the interface language), `panelBrushNames` (the Brushes panel's brushes, whether art uses them or not), `repeatObjects` (`[{id, name, type, instances, rows?, cols?}]`: every Repeat object, those in
groups and in other repeats included, with its type `radial`, `grid` or `mirror` and the number of instances it makes,
and a grid's `rows` and `cols`; with `selectionOnly`, the Repeat objects in the selection), `patternObjects`
(`[{id, name, patterns}]`: every object filled or stroked with a pattern, once each, those in groups and type objects