Primitive dialogs: label the size fields in words, not with the parameter names (#7995)
The Box, Cylinder, Cone, Sphere, Torus and Coil dialogs labelled their size rows with the command's parameter names (length, top_diameter, section_size), in every language. Each row now takes a message: Length, Top diameter, Major radius, Section size, translated as the rest of the dialog is. Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,225 @@
|
||||
{
|
||||
"en": {
|
||||
"ui.length": "Length",
|
||||
"ui.width": "Width",
|
||||
"ui.height": "Height",
|
||||
"ui.pitch": "Pitch",
|
||||
"ui.top_diameter": "Top diameter",
|
||||
"ui.top_radius": "Top radius",
|
||||
"ui.major_radius": "Major radius",
|
||||
"ui.minor_radius": "Minor radius",
|
||||
"ui.revolutions": "Revolutions",
|
||||
"ui.section_size": "Section size"
|
||||
},
|
||||
"ar": {
|
||||
"ui.length": "الطول",
|
||||
"ui.width": "العرض",
|
||||
"ui.height": "الارتفاع",
|
||||
"ui.pitch": "الخطوة",
|
||||
"ui.top_diameter": "القطر العلوي",
|
||||
"ui.top_radius": "نصف القطر العلوي",
|
||||
"ui.major_radius": "نصف القطر الأكبر",
|
||||
"ui.minor_radius": "نصف القطر الأصغر",
|
||||
"ui.revolutions": "عدد اللفات",
|
||||
"ui.section_size": "حجم المقطع"
|
||||
},
|
||||
"cs": {
|
||||
"ui.length": "Délka",
|
||||
"ui.width": "Šířka",
|
||||
"ui.height": "Výška"
|
||||
},
|
||||
"da": {
|
||||
"ui.length": "Længde",
|
||||
"ui.width": "Bredde",
|
||||
"ui.height": "Højde",
|
||||
"ui.pitch": "Stigning"
|
||||
},
|
||||
"de": {
|
||||
"ui.length": "Länge",
|
||||
"ui.width": "Breite",
|
||||
"ui.height": "Höhe",
|
||||
"ui.pitch": "Steigung",
|
||||
"ui.top_diameter": "Oberer Durchmesser",
|
||||
"ui.top_radius": "Oberer Radius",
|
||||
"ui.major_radius": "Großer Radius",
|
||||
"ui.minor_radius": "Kleiner Radius",
|
||||
"ui.revolutions": "Windungen",
|
||||
"ui.section_size": "Querschnittsgröße"
|
||||
},
|
||||
"es": {
|
||||
"ui.length": "Longitud",
|
||||
"ui.width": "Anchura",
|
||||
"ui.height": "Altura",
|
||||
"ui.top_diameter": "Diámetro superior",
|
||||
"ui.top_radius": "Radio superior",
|
||||
"ui.major_radius": "Radio mayor",
|
||||
"ui.minor_radius": "Radio menor",
|
||||
"ui.revolutions": "Vueltas",
|
||||
"ui.section_size": "Tamaño de la sección"
|
||||
},
|
||||
"fr": {
|
||||
"ui.length": "Longueur",
|
||||
"ui.width": "Largeur",
|
||||
"ui.height": "Hauteur",
|
||||
"ui.pitch": "Pas",
|
||||
"ui.top_diameter": "Diamètre supérieur",
|
||||
"ui.top_radius": "Rayon supérieur",
|
||||
"ui.major_radius": "Grand rayon",
|
||||
"ui.minor_radius": "Petit rayon",
|
||||
"ui.revolutions": "Tours",
|
||||
"ui.section_size": "Taille de la section"
|
||||
},
|
||||
"gl": {
|
||||
"ui.length": "Lonxitude",
|
||||
"ui.width": "Largura",
|
||||
"ui.height": "Altura"
|
||||
},
|
||||
"he": {
|
||||
"ui.length": "אורך",
|
||||
"ui.width": "רוחב",
|
||||
"ui.height": "גובה",
|
||||
"ui.pitch": "פסיעה",
|
||||
"ui.top_diameter": "קוטר עליון",
|
||||
"ui.top_radius": "רדיוס עליון",
|
||||
"ui.major_radius": "רדיוס גדול",
|
||||
"ui.minor_radius": "רדיוס קטן",
|
||||
"ui.revolutions": "סיבובים",
|
||||
"ui.section_size": "גודל החתך"
|
||||
},
|
||||
"hu": {
|
||||
"ui.length": "Hossz",
|
||||
"ui.width": "Szélesség",
|
||||
"ui.height": "Magasság"
|
||||
},
|
||||
"id": {
|
||||
"ui.length": "Panjang",
|
||||
"ui.width": "Lebar",
|
||||
"ui.height": "Tinggi"
|
||||
},
|
||||
"it": {
|
||||
"ui.length": "Lunghezza",
|
||||
"ui.width": "Larghezza",
|
||||
"ui.height": "Altezza",
|
||||
"ui.pitch": "Passo",
|
||||
"ui.top_diameter": "Diametro superiore",
|
||||
"ui.top_radius": "Raggio superiore",
|
||||
"ui.major_radius": "Raggio maggiore",
|
||||
"ui.minor_radius": "Raggio minore",
|
||||
"ui.revolutions": "Giri",
|
||||
"ui.section_size": "Dimensione della sezione"
|
||||
},
|
||||
"ja": {
|
||||
"ui.length": "長さ",
|
||||
"ui.width": "幅",
|
||||
"ui.height": "高さ",
|
||||
"ui.pitch": "ピッチ",
|
||||
"ui.top_diameter": "上面の直径",
|
||||
"ui.top_radius": "上面の半径",
|
||||
"ui.major_radius": "大半径",
|
||||
"ui.minor_radius": "小半径",
|
||||
"ui.revolutions": "巻き数",
|
||||
"ui.section_size": "断面サイズ"
|
||||
},
|
||||
"ko": {
|
||||
"ui.length": "길이",
|
||||
"ui.width": "너비",
|
||||
"ui.height": "높이",
|
||||
"ui.pitch": "피치",
|
||||
"ui.top_diameter": "윗면 지름",
|
||||
"ui.top_radius": "윗면 반지름",
|
||||
"ui.major_radius": "큰 반지름",
|
||||
"ui.minor_radius": "작은 반지름",
|
||||
"ui.revolutions": "권수",
|
||||
"ui.section_size": "단면 크기"
|
||||
},
|
||||
"ms": {
|
||||
"ui.length": "Panjang",
|
||||
"ui.width": "Lebar",
|
||||
"ui.height": "Ketinggian"
|
||||
},
|
||||
"nb": {
|
||||
"ui.length": "Lengde",
|
||||
"ui.width": "Bredde",
|
||||
"ui.height": "Høyde",
|
||||
"ui.pitch": "Stigning"
|
||||
},
|
||||
"nl": {
|
||||
"ui.length": "Lengte",
|
||||
"ui.width": "Breedte",
|
||||
"ui.height": "Hoogte"
|
||||
},
|
||||
"pl": {
|
||||
"ui.length": "Długość",
|
||||
"ui.width": "Szerokość",
|
||||
"ui.height": "Wysokość",
|
||||
"ui.pitch": "Skok"
|
||||
},
|
||||
"pt-BR": {
|
||||
"ui.length": "Comprimento",
|
||||
"ui.width": "Largura",
|
||||
"ui.height": "Altura",
|
||||
"ui.pitch": "Passo"
|
||||
},
|
||||
"ro": {
|
||||
"ui.length": "Lungime",
|
||||
"ui.width": "Lățime",
|
||||
"ui.height": "Înălțime"
|
||||
},
|
||||
"ru": {
|
||||
"ui.length": "Длина",
|
||||
"ui.width": "Ширина",
|
||||
"ui.height": "Высота"
|
||||
},
|
||||
"sv": {
|
||||
"ui.length": "Längd",
|
||||
"ui.width": "Bredd",
|
||||
"ui.height": "Höjd"
|
||||
},
|
||||
"tr": {
|
||||
"ui.length": "Uzunluk",
|
||||
"ui.width": "Genişlik",
|
||||
"ui.height": "Yükseklik",
|
||||
"ui.pitch": "Adım"
|
||||
},
|
||||
"uk": {
|
||||
"ui.length": "Довжина",
|
||||
"ui.width": "Ширина",
|
||||
"ui.height": "Висота",
|
||||
"ui.pitch": "Крок"
|
||||
},
|
||||
"vi": {
|
||||
"ui.length": "Chiều dài",
|
||||
"ui.width": "Bề rộng",
|
||||
"ui.height": "Chiều cao",
|
||||
"ui.pitch": "Bước xoắn",
|
||||
"ui.top_diameter": "Đường kính đỉnh",
|
||||
"ui.top_radius": "Bán kính đỉnh",
|
||||
"ui.major_radius": "Bán kính lớn",
|
||||
"ui.minor_radius": "Bán kính nhỏ",
|
||||
"ui.revolutions": "Số vòng",
|
||||
"ui.section_size": "Kích thước mặt cắt"
|
||||
},
|
||||
"zh": {
|
||||
"ui.length": "长度",
|
||||
"ui.width": "宽度",
|
||||
"ui.height": "高度",
|
||||
"ui.pitch": "螺距",
|
||||
"ui.top_diameter": "顶部直径",
|
||||
"ui.top_radius": "顶部半径",
|
||||
"ui.major_radius": "大半径",
|
||||
"ui.minor_radius": "小半径",
|
||||
"ui.revolutions": "圈数",
|
||||
"ui.section_size": "截面尺寸"
|
||||
},
|
||||
"zh-TW": {
|
||||
"ui.length": "長度",
|
||||
"ui.width": "寬度",
|
||||
"ui.height": "高度",
|
||||
"ui.top_diameter": "頂部直徑",
|
||||
"ui.top_radius": "頂部半徑",
|
||||
"ui.major_radius": "大半徑",
|
||||
"ui.minor_radius": "小半徑",
|
||||
"ui.revolutions": "圈數",
|
||||
"ui.section_size": "截面尺寸"
|
||||
}
|
||||
}
|
||||
@@ -26,6 +26,8 @@ use crate::viewport::Hit;
|
||||
|
||||
#[path = "dialogs_dense.rs"]
|
||||
mod dense;
|
||||
#[cfg(test)]
|
||||
pub(crate) use dense::primitive_label;
|
||||
|
||||
const SELECT_ONLY: &[Scope] = &[Scope::Selection, Scope::FeaturePreview];
|
||||
const SELECT_MANIP: &[Scope] = &[Scope::Selection, Scope::Manipulator, Scope::FeaturePreview];
|
||||
|
||||
@@ -366,12 +366,12 @@ form_case!(pipe, "solid.pipe", ["Diameter", "Wall", "Operation"]);
|
||||
form_case!(stock, "solid.bounding_solid", ["Margin"]);
|
||||
form_case!(frame_member, "frame.member", ["All Lines", "Anchor", "Angle", "Mirror", "Name"]);
|
||||
form_case!(thread, "solid.thread", ["Profile", "Size", "Pitch", "Designation"]);
|
||||
form_case!(primitive_box, "solid.box", ["length", "width", "height", "Operation"]);
|
||||
form_case!(cylinder, "solid.cylinder", ["diameter", "height", "Operation"]);
|
||||
form_case!(sphere, "solid.sphere", ["diameter", "Operation"]);
|
||||
form_case!(torus, "solid.torus", ["major", "minor", "Operation"]);
|
||||
form_case!(cone, "solid.cone", ["diameter", "top_diameter", "height", "Operation"]);
|
||||
form_case!(coil, "solid.coil", ["diameter", "revolutions", "pitch", "section_size", "Operation"]);
|
||||
form_case!(primitive_box, "solid.box", ["ui.length", "ui.width", "ui.height", "Operation"]);
|
||||
form_case!(cylinder, "solid.cylinder", ["ui.diameter", "ui.height", "Operation"]);
|
||||
form_case!(sphere, "solid.sphere", ["ui.diameter", "Operation"]);
|
||||
form_case!(torus, "solid.torus", ["ui.major_radius", "ui.minor_radius", "Operation"]);
|
||||
form_case!(cone, "solid.cone", ["ui.diameter", "ui.top_diameter", "ui.height", "Operation"]);
|
||||
form_case!(coil, "solid.coil", ["ui.diameter", "ui.revolutions", "ui.pitch", "ui.section_size", "Operation"]);
|
||||
form_case!(combine, "solid.combine", ["Operation"]);
|
||||
form_case!(surface_extrude, "surface.extrude", ["Distance", "Direction"]);
|
||||
form_case!(surface_revolve, "surface.revolve", ["Angle", "Direction"]);
|
||||
|
||||
@@ -575,6 +575,26 @@ fn extra_options(ui: &mut egui::Ui, id: &str, extra: &mut serde_json::Map<String
|
||||
}
|
||||
}
|
||||
|
||||
/// The message a primitive's size field is labelled with, by its parameter name: "Section size",
|
||||
/// not `section_size`.
|
||||
pub(crate) fn primitive_label(key: &str) -> &str {
|
||||
match key {
|
||||
"length" => "ui.length",
|
||||
"width" => "ui.width",
|
||||
"height" => "ui.height",
|
||||
"diameter" => "ui.diameter",
|
||||
"radius" => "ui.radius",
|
||||
"top_diameter" => "ui.top_diameter",
|
||||
"top_radius" => "ui.top_radius",
|
||||
"major" => "ui.major_radius",
|
||||
"minor" => "ui.minor_radius",
|
||||
"revolutions" => "ui.revolutions",
|
||||
"pitch" => "ui.pitch",
|
||||
"section_size" => "ui.section_size",
|
||||
_ => key,
|
||||
}
|
||||
}
|
||||
|
||||
/// The coil's section, where the section sits on the diameter, the way it turns and where it
|
||||
/// starts (#3862). A default stays out of the parameters, so OK on an unchanged edit keeps the coil.
|
||||
fn coil_rows(ui: &mut egui::Ui, extra: &mut serde_json::Map<String, Value>) -> bool {
|
||||
@@ -799,7 +819,7 @@ fn additional_rows(app: &mut SolveApp, d: &mut Dialog, ui: &mut egui::Ui) -> boo
|
||||
if from_sketch && (*k == "diameter" || *k == "section_size") {
|
||||
continue;
|
||||
}
|
||||
enter |= expr_row(ui, k, v);
|
||||
enter |= expr_row(ui, primitive_label(k), v);
|
||||
}
|
||||
if *cmd == "solid.coil" {
|
||||
enter |= coil_rows(ui, &mut d.extra);
|
||||
|
||||
@@ -283,7 +283,7 @@ fn switching_from_a_sketch_to_a_feature_applies_with_one_undo_and_redo() {
|
||||
let undo = h.app.session.undo.len();
|
||||
until_settled(&mut h);
|
||||
h.frames(2);
|
||||
h.step(&json!({"click":{"handle":"dialog:length"}})).unwrap();
|
||||
h.step(&json!({"click":{"handle":"dialog:ui.length"}})).unwrap();
|
||||
h.step(&json!({"key":"A","cmd":true})).unwrap();
|
||||
h.step(&json!({"text":"12 mm"})).unwrap();
|
||||
h.step(&json!({"click":{"handle":"dialog:OK"}})).unwrap();
|
||||
|
||||
@@ -268,7 +268,7 @@ mod delete {
|
||||
crate::dialogs_assembly::pick_joint(&mut h.app, hinge, false);
|
||||
assert!(h.app.dialog.is_some());
|
||||
assert_eq!(h.app.tree.picked_joints, [hinge], "the dialog guard must protect an actual joint selection");
|
||||
click(&mut h, "dialog:length");
|
||||
click(&mut h, "dialog:ui.length");
|
||||
h.step(&json!({"key": "Delete"})).unwrap();
|
||||
assert_eq!(h.app.session.doc.assembly.joints.len(), 2, "Delete belongs to the focused field");
|
||||
assert_eq!(h.app.tree.picked_joints, [hinge]);
|
||||
|
||||
@@ -37,20 +37,23 @@ fn fields(h: &Harness) -> Vec<(&'static str, String)> {
|
||||
}
|
||||
}
|
||||
|
||||
/// Every field shows its text in its row, as a person sees it.
|
||||
/// Every field shows its text in its row, as a person sees it, under a label in words
|
||||
/// ("Section size"), not the command's parameter name.
|
||||
fn assert_shown(h: &Harness, fields: &[(&str, String)]) {
|
||||
for (label, text) in fields {
|
||||
for (key, text) in fields {
|
||||
let label = crate::i18n::tr(crate::dialogs::primitive_label(key));
|
||||
assert!(label.starts_with(char::is_uppercase) && !label.contains('_'), "the {key} row is labelled {label:?}");
|
||||
let nodes = &h.output.accesskit_update.as_ref().unwrap().nodes;
|
||||
assert!(
|
||||
nodes.iter().any(|(_, n)| n.role() == egui::accesskit::Role::TextInput && n.label() == Some(*label) && n.value() == Some(text)),
|
||||
nodes.iter().any(|(_, n)| n.role() == egui::accesskit::Role::TextInput && n.label() == Some(label) && n.value() == Some(text)),
|
||||
"the {label} editor shows {text:?}"
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
/// Replace a field's text by typing, as a person does.
|
||||
fn type_into(h: &mut Harness, label: &str, text: &str) {
|
||||
h.step(&json!({"click": {"handle": format!("dialog:{label}")}})).unwrap();
|
||||
fn type_into(h: &mut Harness, key: &str, text: &str) {
|
||||
h.step(&json!({"click": {"handle": format!("dialog:{}", crate::dialogs::primitive_label(key))}})).unwrap();
|
||||
h.step(&json!({"key": "A", "cmd": true})).unwrap();
|
||||
h.step(&json!({"text": text})).unwrap();
|
||||
}
|
||||
@@ -423,6 +426,7 @@ fn cone_dialog_makes_a_cone_and_edits_it_into_a_frustum() {
|
||||
h.frames(3);
|
||||
let shown = fields(&h);
|
||||
assert_eq!(shown, vec![("radius", "(20 mm) / 2".to_string()), ("top_radius", "(0 mm) / 2".to_string()), ("height", "20 mm".to_string())]);
|
||||
assert_shown(&h, &shown);
|
||||
type_into(&mut h, "top_radius", "4");
|
||||
h.frames(2);
|
||||
ok(&mut h);
|
||||
|
||||
Reference in New Issue
Block a user