forked from 1b-agent/opencadstudio-upstream
Complete application localization across all supported languages
This commit is contained in:
1 parent
96c794c072
commit
d66e89ca19
78 files changed
+26043
-877
No files matched your search
@@ -529,7 +529,7 @@ impl OpenCADStudio {
|
||||
let sel: Vec<_> = self.tabs[i].scene.selected.iter().copied().collect();
|
||||
if sel.is_empty() {
|
||||
self.command_line.push_error(
|
||||
"WBLOCK Select entities first, or: WBLOCK <block name> or WBLOCK *",
|
||||
crate::t!("WBLOCK Select entities first, or: WBLOCK <block name> or WBLOCK *").as_ref(),
|
||||
);
|
||||
} else {
|
||||
return Some(Task::done(Message::WblockSave("*".to_string())));
|
||||
|
||||
@@ -130,7 +130,7 @@ impl OpenCADStudio {
|
||||
}
|
||||
if opt.is_empty() {
|
||||
self.command_line.push_info(
|
||||
"Usage: JUSTIFYTEXT <Left|Center|Right|Middle|TL|TC|TR|ML|MC|MR|BL|BC|BR>",
|
||||
crate::t!("Usage: JUSTIFYTEXT <Left|Center|Right|Middle|TL|TC|TR|ML|MC|MR|BL|BC|BR>").as_ref(),
|
||||
);
|
||||
return Some(Task::none());
|
||||
}
|
||||
@@ -401,7 +401,7 @@ impl OpenCADStudio {
|
||||
Some(v) if v > 0.0 => v,
|
||||
_ => {
|
||||
self.command_line.push_info(
|
||||
"Usage: TEXTFIT <target width> (fits selected text to that width)",
|
||||
crate::t!("Usage: TEXTFIT <target width> (fits selected text to that width)").as_ref(),
|
||||
);
|
||||
return Some(Task::none());
|
||||
}
|
||||
@@ -1311,7 +1311,7 @@ impl OpenCADStudio {
|
||||
let text = cmd.strip_prefix("ARCTEXT").unwrap_or("").trim().to_string();
|
||||
if text.is_empty() {
|
||||
self.command_line.push_info(
|
||||
"Usage: ARCTEXT <text> (select an arc first; the text follows it)",
|
||||
crate::t!("Usage: ARCTEXT <text> (select an arc first; the text follows it)").as_ref(),
|
||||
);
|
||||
return None;
|
||||
}
|
||||
|
||||
+16
-16
@@ -429,11 +429,11 @@ impl OpenCADStudio {
|
||||
self.tabs[i].scene.set_drawing_limit_check(enabled);
|
||||
self.tabs[i].dirty = true;
|
||||
}
|
||||
self.command_line.push_output(if enabled {
|
||||
self.command_line.push_output(crate::t!(if enabled {
|
||||
"Limits checking ON."
|
||||
} else {
|
||||
"Limits checking OFF."
|
||||
});
|
||||
}).as_ref());
|
||||
}
|
||||
cmd if cmd.starts_with("LIMITS SET ") => {
|
||||
let tokens: Vec<&str> = cmd["LIMITS SET ".len()..].split_whitespace().collect();
|
||||
@@ -492,14 +492,14 @@ impl OpenCADStudio {
|
||||
"REDRAW" => {
|
||||
use crate::scene::ViewportRefreshScope;
|
||||
self.tabs[i].scene.request_refresh(ViewportRefreshScope::Active);
|
||||
self.command_line.push_output("REDRAW: viewport refreshed.");
|
||||
self.command_line.push_output(crate::t!("REDRAW: viewport refreshed.").as_ref());
|
||||
return Some(Task::none());
|
||||
}
|
||||
// REDRAWALL — force re-rasterize of every generated viewport.
|
||||
"REDRAWALL" => {
|
||||
use crate::scene::ViewportRefreshScope;
|
||||
self.tabs[i].scene.request_refresh(ViewportRefreshScope::All);
|
||||
self.command_line.push_output("REDRAWALL: viewports refreshed.");
|
||||
self.command_line.push_output(crate::t!("REDRAWALL: viewports refreshed.").as_ref());
|
||||
return Some(Task::none());
|
||||
}
|
||||
// REGEN — full model regeneration (bump_geometry: geometry_epoch AND
|
||||
@@ -509,7 +509,7 @@ impl OpenCADStudio {
|
||||
// REGENALL is functionally identical (C5).
|
||||
"REGEN" | "REGENALL" => {
|
||||
self.tabs[i].scene.bump_geometry();
|
||||
self.command_line.push_output("REGEN: regenerated model.");
|
||||
self.command_line.push_output(crate::t!("REGEN: regenerated model.").as_ref());
|
||||
return Some(Task::none());
|
||||
}
|
||||
|
||||
@@ -877,8 +877,8 @@ impl OpenCADStudio {
|
||||
let active = self
|
||||
.active_plot_style
|
||||
.as_ref()
|
||||
.map(|t| format!("Active: {}", t.name))
|
||||
.unwrap_or_else(|| "No plot style loaded.".into());
|
||||
.map(|t| crate::tf!("Active: {}", t.name).into_owned())
|
||||
.unwrap_or_else(|| crate::t!("No plot style loaded.").into_owned());
|
||||
self.command_line.push_info(&active);
|
||||
return Some(Task::done(Message::PlotStyleLoad));
|
||||
}
|
||||
@@ -887,13 +887,13 @@ impl OpenCADStudio {
|
||||
.active_plot_style
|
||||
.as_ref()
|
||||
.map(|t| {
|
||||
format!(
|
||||
crate::tf!(
|
||||
"Plot style: {} ({} color overrides)",
|
||||
t.name,
|
||||
t.aci_entries.iter().filter(|e| e.color.is_some()).count()
|
||||
)
|
||||
).into_owned()
|
||||
})
|
||||
.unwrap_or_else(|| "No plot style table loaded.".into());
|
||||
.unwrap_or_else(|| crate::t!("No plot style table loaded.").into_owned());
|
||||
self.command_line.push_output(&msg);
|
||||
}
|
||||
_ => {
|
||||
@@ -1215,7 +1215,7 @@ impl OpenCADStudio {
|
||||
.push_output(crate::tf!("ADJUST: {action} = {v} on {changed} image(s).").as_ref());
|
||||
} else {
|
||||
self.command_line.push_error(
|
||||
"ADJUST: no raster images selected, or unknown property (use BRIGHTNESS|CONTRAST|FADE).",
|
||||
crate::t!("ADJUST: no raster images selected, or unknown property (use BRIGHTNESS|CONTRAST|FADE).").as_ref(),
|
||||
);
|
||||
}
|
||||
} else {
|
||||
@@ -1274,7 +1274,7 @@ impl OpenCADStudio {
|
||||
match value.parse::<i8>() {
|
||||
Ok(mode @ -4..=4) => self.annotation_auto_scale = mode,
|
||||
_ => self.command_line.push_error(
|
||||
"ANNOAUTOSCALE: enter an integer from -4 through 4.",
|
||||
crate::t!("ANNOAUTOSCALE: enter an integer from -4 through 4.").as_ref(),
|
||||
),
|
||||
}
|
||||
}
|
||||
@@ -1461,7 +1461,7 @@ impl OpenCADStudio {
|
||||
let path = cmd.trim_start_matches("DATALINK").trim();
|
||||
if path.is_empty() {
|
||||
self.command_line.push_info(
|
||||
"Usage: DATALINK <path-to-.csv>",
|
||||
crate::t!("Usage: DATALINK <path-to-.csv>").as_ref(),
|
||||
);
|
||||
return Some(Task::none());
|
||||
}
|
||||
@@ -1574,7 +1574,7 @@ impl OpenCADStudio {
|
||||
}
|
||||
if jobs.is_empty() {
|
||||
self.command_line
|
||||
.push_error("DATALINKUPDATE: no linked tables found.");
|
||||
.push_error(crate::t!("DATALINKUPDATE: no linked tables found.").as_ref());
|
||||
return Some(Task::none());
|
||||
}
|
||||
if write_back {
|
||||
@@ -1606,7 +1606,7 @@ impl OpenCADStudio {
|
||||
.collect();
|
||||
if updates.is_empty() {
|
||||
self.command_line
|
||||
.push_error("DATALINKUPDATE: linked sources could not be read.");
|
||||
.push_error(crate::t!("DATALINKUPDATE: linked sources could not be read.").as_ref());
|
||||
return Some(Task::none());
|
||||
}
|
||||
self.push_undo_snapshot(i, "DATALINKUPDATE");
|
||||
@@ -1675,7 +1675,7 @@ impl OpenCADStudio {
|
||||
let path = cmd.trim_start_matches("LANDXMLIMPORT").trim();
|
||||
if path.is_empty() {
|
||||
self.command_line.push_info(
|
||||
"Usage: LANDXMLIMPORT <path-to-.xml> (imports CgPoint survey points)",
|
||||
crate::t!("Usage: LANDXMLIMPORT <path-to-.xml> (imports CgPoint survey points)").as_ref(),
|
||||
);
|
||||
return Some(Task::none());
|
||||
}
|
||||
|
||||
@@ -526,7 +526,7 @@ impl OpenCADStudio {
|
||||
self.tabs[i].dirty = true;
|
||||
}
|
||||
self.command_line
|
||||
.push_output(&format!("CENTERRESET: {count} center object(s) updated."));
|
||||
.push_output(&crate::tf!("CENTERRESET: {count} center object(s) updated."));
|
||||
}
|
||||
|
||||
"CENTERREASSOCIATE" => {
|
||||
@@ -549,7 +549,7 @@ impl OpenCADStudio {
|
||||
self.tabs[i].dirty = true;
|
||||
}
|
||||
self.command_line
|
||||
.push_output(&format!("CENTERREASSOCIATE: {count} center object(s) associated."));
|
||||
.push_output(&crate::tf!("CENTERREASSOCIATE: {count} center object(s) associated."));
|
||||
}
|
||||
|
||||
"CENTERDISASSOCIATE" => {
|
||||
@@ -561,7 +561,7 @@ impl OpenCADStudio {
|
||||
self.tabs[i].dirty = true;
|
||||
}
|
||||
self.command_line
|
||||
.push_output(&format!("CENTERDISASSOCIATE: {count} center object(s) detached."));
|
||||
.push_output(&crate::tf!("CENTERDISASSOCIATE: {count} center object(s) detached."));
|
||||
}
|
||||
|
||||
"DIMCENTER" => {
|
||||
@@ -1159,7 +1159,7 @@ impl OpenCADStudio {
|
||||
match parts.get(val_idx).and_then(|s| s.parse::<f64>().ok()) {
|
||||
Some(v) => return Some(self.solid_section(axis, v)),
|
||||
None => self.command_line.push_info(
|
||||
"Usage: SECTION [X|Y|Z] <value> (cross-sections the selected solid)",
|
||||
crate::t!("Usage: SECTION [X|Y|Z] <value> (cross-sections the selected solid)").as_ref(),
|
||||
),
|
||||
}
|
||||
}
|
||||
@@ -1185,7 +1185,7 @@ impl OpenCADStudio {
|
||||
return Some(self.solid_align3d(src, dst));
|
||||
}
|
||||
self.command_line.push_info(
|
||||
"Usage: 3DALIGN <sx1 sy1 sz1 … sx3 sy3 sz3 dx1 dy1 dz1 … dx3 dy3 dz3> (18 numbers: 3 source then 3 destination points)",
|
||||
crate::t!("Usage: 3DALIGN <sx1 sy1 sz1 … sx3 sy3 sz3 dx1 dy1 dz1 … dx3 dy3 dz3> (18 numbers: 3 source then 3 destination points)").as_ref(),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -1214,7 +1214,7 @@ impl OpenCADStudio {
|
||||
Some("Z") => 2,
|
||||
_ => {
|
||||
self.command_line.push_info(
|
||||
"Usage: 3DMIRROR [X|Y|Z] (mirrors the selected solid across that plane)",
|
||||
crate::t!("Usage: 3DMIRROR [X|Y|Z] (mirrors the selected solid across that plane)").as_ref(),
|
||||
);
|
||||
return None;
|
||||
}
|
||||
@@ -1254,7 +1254,7 @@ impl OpenCADStudio {
|
||||
match angle {
|
||||
Some(a) => return Some(self.solid_rotate3d(axis, a)),
|
||||
None => self.command_line.push_info(
|
||||
"Usage: 3DROTATE [X|Y|Z] <angle> (rotates the selected solid)",
|
||||
crate::t!("Usage: 3DROTATE [X|Y|Z] <angle> (rotates the selected solid)").as_ref(),
|
||||
),
|
||||
}
|
||||
}
|
||||
@@ -1294,7 +1294,7 @@ impl OpenCADStudio {
|
||||
match value {
|
||||
Some(v) => return Some(self.solid_slice(axis, v, keep_low)),
|
||||
None => self.command_line.push_info(
|
||||
"Usage: SLICE [X|Y|Z] <value> [TOP|BOTTOM] (cuts the selected solid)",
|
||||
crate::t!("Usage: SLICE [X|Y|Z] <value> [TOP|BOTTOM] (cuts the selected solid)").as_ref(),
|
||||
),
|
||||
}
|
||||
}
|
||||
|
||||
@@ -54,7 +54,7 @@ impl OpenCADStudio {
|
||||
self.command_line.push_output(crate::tf!(
|
||||
"SAVEALL: saved {saved} drawing(s){}.",
|
||||
if skipped > 0 {
|
||||
format!("; {skipped} need SAVEAS (no file path yet)")
|
||||
crate::tf!("; {skipped} need SAVEAS (no file path yet)").into_owned()
|
||||
} else {
|
||||
String::new()
|
||||
}
|
||||
@@ -130,10 +130,10 @@ impl OpenCADStudio {
|
||||
let style = cmd.split_whitespace().nth(1).unwrap_or("");
|
||||
let Some(mode) = visual_style::mode_for_keyword(style) else {
|
||||
self.command_line
|
||||
.push_error(visual_style::keyword_prompt());
|
||||
.push_error(crate::t!(visual_style::keyword_prompt()).as_ref());
|
||||
return Some(Task::none());
|
||||
};
|
||||
let label = visual_style::label_for(mode);
|
||||
let label = crate::t!(visual_style::label_for(mode));
|
||||
self.command_line
|
||||
.push_output(crate::tf!("Visual style: {label}.").as_ref());
|
||||
return Some(Task::done(Message::SetRenderMode(mode)));
|
||||
@@ -220,11 +220,11 @@ impl OpenCADStudio {
|
||||
"PERF" => {
|
||||
self.perf_hud = !self.perf_hud;
|
||||
crate::perf::set_ui_enabled(self.perf_hud);
|
||||
self.command_line.push_info(if self.perf_hud {
|
||||
self.command_line.push_info(crate::t!(if self.perf_hud {
|
||||
"PERF panel on — tracing render and interaction costs"
|
||||
} else {
|
||||
"PERF panel off"
|
||||
});
|
||||
}).as_ref());
|
||||
return Some(Task::none());
|
||||
}
|
||||
|
||||
@@ -299,7 +299,7 @@ impl OpenCADStudio {
|
||||
rgb[2]
|
||||
).as_ref());
|
||||
} else {
|
||||
self.command_line.push_info("Usage: BACKGROUND DESK <r> <g> <b> | DEFAULT");
|
||||
self.command_line.push_info(crate::t!("Usage: BACKGROUND DESK <r> <g> <b> | DEFAULT").as_ref());
|
||||
}
|
||||
} else if let Some(rgba) = parse_background_color(&args) {
|
||||
let [r, g, b, _] = rgba;
|
||||
@@ -322,7 +322,7 @@ impl OpenCADStudio {
|
||||
).as_ref());
|
||||
} else {
|
||||
self.command_line.push_info(
|
||||
"Usage: BACKGROUND <r> <g> <b> (0–255) | THEME|CLASSIC|DEFAULT|DESK|BLACK|DARKGRAY|GRAY|LIGHTGRAY|WHITE",
|
||||
crate::t!("Usage: BACKGROUND <r> <g> <b> (0–255) | THEME|CLASSIC|DEFAULT|DESK|BLACK|DARKGRAY|GRAY|LIGHTGRAY|WHITE").as_ref(),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
+37
-37
@@ -119,9 +119,9 @@ impl OpenCADStudio {
|
||||
} else {
|
||||
use std::collections::BTreeMap;
|
||||
let space = if scene.current_layout == "Model" {
|
||||
"Model space".to_string()
|
||||
crate::t!("Model space").into_owned()
|
||||
} else {
|
||||
format!("Paper space '{}'", scene.current_layout)
|
||||
crate::tf!("Paper space '{}'", scene.current_layout).into_owned()
|
||||
};
|
||||
let mut handles: Vec<u64> = Vec::with_capacity(selected.len());
|
||||
let mut type_counts: BTreeMap<&'static str, usize> = BTreeMap::new();
|
||||
@@ -139,18 +139,18 @@ impl OpenCADStudio {
|
||||
let types: Vec<String> =
|
||||
type_counts.iter().map(|(t, n)| format!("{t}×{n}")).collect();
|
||||
let list: Vec<String> = handles.iter().map(|h| format!("{:X}", h)).collect();
|
||||
let mut msg = format!(
|
||||
let mut msg = crate::tf!(
|
||||
"SELHANDLES: {} selected in {}\n Types: {}",
|
||||
handles.len(),
|
||||
space,
|
||||
types.join(", ")
|
||||
);
|
||||
).into_owned();
|
||||
if !block_counts.is_empty() {
|
||||
let blocks: Vec<String> =
|
||||
block_counts.iter().map(|(b, n)| format!("{b}×{n}")).collect();
|
||||
msg.push_str(&format!("\n Blocks: {}", blocks.join(", ")));
|
||||
msg.push_str(&crate::tf!("\n Blocks: {}", blocks.join(", ")).into_owned());
|
||||
}
|
||||
msg.push_str(&format!("\n Handles: {}", list.join(",")));
|
||||
msg.push_str(&crate::tf!("\n Handles: {}", list.join(",")).into_owned());
|
||||
self.command_line.push_output(&msg);
|
||||
}
|
||||
}
|
||||
@@ -180,10 +180,10 @@ impl OpenCADStudio {
|
||||
};
|
||||
let details = entity_list_details(entity);
|
||||
format!(
|
||||
"{type_name} Handle:{:X} Layer:{} Color:{} LT:{}{}",
|
||||
common.handle.value(),
|
||||
common.layer,
|
||||
color_str,
|
||||
"{type_name} {}:{:X} {}:{} {}:{} LT:{}{}",
|
||||
crate::t!("Handle"), common.handle.value(),
|
||||
crate::t!("Layer"), common.layer,
|
||||
crate::t!("Color"), color_str,
|
||||
linetype,
|
||||
if details.is_empty() {
|
||||
String::new()
|
||||
@@ -1360,7 +1360,7 @@ impl OpenCADStudio {
|
||||
// Use the first selected object as the template.
|
||||
let Some(handle) = self.tabs[i].scene.selected.iter().next().copied() else {
|
||||
self.command_line.push_info(
|
||||
"ADDSELECTED: select an object first, then run ADDSELECTED to draw a new one like it.",
|
||||
crate::t!("ADDSELECTED: select an object first, then run ADDSELECTED to draw a new one like it.").as_ref(),
|
||||
);
|
||||
return Task::none();
|
||||
};
|
||||
@@ -1558,7 +1558,7 @@ fn add_selected_verb(entity: &acadrust::EntityType) -> Option<&'static str> {
|
||||
fn entity_list_details(entity: &acadrust::EntityType) -> String {
|
||||
use std::f64::consts::PI;
|
||||
match entity {
|
||||
acadrust::EntityType::Line(l) => format!(
|
||||
acadrust::EntityType::Line(l) => crate::tf!(
|
||||
"from ({:.4},{:.4},{:.4}) to ({:.4},{:.4},{:.4}) len={:.4}",
|
||||
l.start.x,
|
||||
l.start.y,
|
||||
@@ -1570,16 +1570,16 @@ fn entity_list_details(entity: &acadrust::EntityType) -> String {
|
||||
+ (l.end.y - l.start.y).powi(2)
|
||||
+ (l.end.z - l.start.z).powi(2))
|
||||
.sqrt()
|
||||
),
|
||||
acadrust::EntityType::Circle(c) => format!(
|
||||
).into_owned(),
|
||||
acadrust::EntityType::Circle(c) => crate::tf!(
|
||||
"center ({:.4},{:.4},{:.4}) r={:.4} area={:.4}",
|
||||
c.center.x,
|
||||
c.center.y,
|
||||
c.center.z,
|
||||
c.radius,
|
||||
PI * c.radius * c.radius
|
||||
),
|
||||
acadrust::EntityType::Arc(a) => format!(
|
||||
).into_owned(),
|
||||
acadrust::EntityType::Arc(a) => crate::tf!(
|
||||
"center ({:.4},{:.4},{:.4}) r={:.4} start={:.2}° end={:.2}°",
|
||||
a.center.x,
|
||||
a.center.y,
|
||||
@@ -1587,25 +1587,25 @@ fn entity_list_details(entity: &acadrust::EntityType) -> String {
|
||||
a.radius,
|
||||
a.start_angle.to_degrees(),
|
||||
a.end_angle.to_degrees()
|
||||
),
|
||||
acadrust::EntityType::LwPolyline(p) => format!(
|
||||
).into_owned(),
|
||||
acadrust::EntityType::LwPolyline(p) => crate::tf!(
|
||||
"{} vertices closed={} elevation={:.4}",
|
||||
p.vertices.len(),
|
||||
p.is_closed,
|
||||
p.elevation
|
||||
),
|
||||
acadrust::EntityType::Text(t) => format!(
|
||||
).into_owned(),
|
||||
acadrust::EntityType::Text(t) => crate::tf!(
|
||||
"\"{}\" h={:.4} at ({:.4},{:.4})",
|
||||
t.value, t.height, t.insertion_point.x, t.insertion_point.y
|
||||
),
|
||||
acadrust::EntityType::MText(t) => format!(
|
||||
).into_owned(),
|
||||
acadrust::EntityType::MText(t) => crate::tf!(
|
||||
"\"{}\" h={:.4} at ({:.4},{:.4})",
|
||||
t.value.chars().take(40).collect::<String>(),
|
||||
t.height,
|
||||
t.insertion_point.x,
|
||||
t.insertion_point.y
|
||||
),
|
||||
acadrust::EntityType::Insert(ins) => format!(
|
||||
).into_owned(),
|
||||
acadrust::EntityType::Insert(ins) => crate::tf!(
|
||||
"block=\"{}\" at ({:.4},{:.4},{:.4}) scale=({:.4},{:.4},{:.4}) rot={:.2}°",
|
||||
ins.block_name,
|
||||
ins.insert_point.x,
|
||||
@@ -1615,20 +1615,20 @@ fn entity_list_details(entity: &acadrust::EntityType) -> String {
|
||||
ins.y_scale(),
|
||||
ins.z_scale(),
|
||||
ins.rotation.to_degrees()
|
||||
),
|
||||
acadrust::EntityType::Spline(s) => format!(
|
||||
).into_owned(),
|
||||
acadrust::EntityType::Spline(s) => crate::tf!(
|
||||
"{} ctrl pts degree={} closed={}",
|
||||
s.control_points.len(),
|
||||
s.degree,
|
||||
s.flags.closed
|
||||
),
|
||||
acadrust::EntityType::Ellipse(e) => format!(
|
||||
).into_owned(),
|
||||
acadrust::EntityType::Ellipse(e) => crate::tf!(
|
||||
"center ({:.4},{:.4}) major_len={:.4} ratio={:.4}",
|
||||
e.center.x,
|
||||
e.center.y,
|
||||
e.major_axis_length(),
|
||||
e.minor_axis_ratio
|
||||
),
|
||||
).into_owned(),
|
||||
_ => String::new(),
|
||||
}
|
||||
}
|
||||
@@ -1967,13 +1967,13 @@ fn entity_extra_info(entity: &acadrust::EntityType) -> String {
|
||||
"BLK={} @({:.3},{:.3})",
|
||||
e.block_name, e.insert_point.x, e.insert_point.y
|
||||
),
|
||||
EntityType::LwPolyline(e) => format!("{} vertices", e.vertices.len()),
|
||||
EntityType::Polyline(e) => format!("{} vertices", e.vertices.len()),
|
||||
EntityType::Polyline2D(e) => format!("{} vertices", e.vertices.len()),
|
||||
EntityType::Polyline3D(e) => format!("{} vertices", e.vertices.len()),
|
||||
EntityType::LwPolyline(e) => crate::tf!("{} vertices", e.vertices.len()).into_owned(),
|
||||
EntityType::Polyline(e) => crate::tf!("{} vertices", e.vertices.len()).into_owned(),
|
||||
EntityType::Polyline2D(e) => crate::tf!("{} vertices", e.vertices.len()).into_owned(),
|
||||
EntityType::Polyline3D(e) => crate::tf!("{} vertices", e.vertices.len()).into_owned(),
|
||||
EntityType::Hatch(e) => format!("PAT={}", e.pattern.name),
|
||||
EntityType::Dimension(e) => format!("{:.3}", e.base().actual_measurement),
|
||||
EntityType::Spline(e) => format!("{} ctrl pts", e.control_points.len()),
|
||||
EntityType::Spline(e) => crate::tf!("{} ctrl pts", e.control_points.len()).into_owned(),
|
||||
_ => String::new(),
|
||||
}
|
||||
}
|
||||
@@ -1997,7 +1997,7 @@ fn arith_eval(expr: &str) -> Result<f64, String> {
|
||||
};
|
||||
let v = p.expr()?;
|
||||
if p.pos != p.chars.len() {
|
||||
return Err(format!("unexpected '{}'", p.chars[p.pos]));
|
||||
return Err(crate::tf!("unexpected '{}'", p.chars[p.pos]).into_owned());
|
||||
}
|
||||
Ok(v)
|
||||
}
|
||||
@@ -2101,7 +2101,7 @@ impl ArithParser {
|
||||
Ok(v)
|
||||
}
|
||||
Some(c) if c.is_ascii_digit() || c == '.' => self.number(),
|
||||
Some(c) => Err(format!("unexpected '{c}'")),
|
||||
Some(c) => Err(crate::tf!("unexpected '{c}'").into_owned()),
|
||||
None => Err("unexpected end of expression".into()),
|
||||
}
|
||||
}
|
||||
@@ -2116,7 +2116,7 @@ impl ArithParser {
|
||||
}
|
||||
}
|
||||
let s: String = self.chars[start..self.pos].iter().collect();
|
||||
s.parse::<f64>().map_err(|_| format!("bad number '{s}'"))
|
||||
s.parse::<f64>().map_err(|_| crate::tf!("bad number '{s}'").into_owned())
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -706,10 +706,10 @@ impl OpenCADStudio {
|
||||
}
|
||||
})
|
||||
.map(|s| {
|
||||
format!(
|
||||
crate::tf!(
|
||||
"{} (h_margin:{:.2} v_margin:{:.2})",
|
||||
s.name, s.horizontal_margin, s.vertical_margin
|
||||
)
|
||||
).into_owned()
|
||||
})
|
||||
.collect();
|
||||
if styles.is_empty() {
|
||||
@@ -909,7 +909,7 @@ impl OpenCADStudio {
|
||||
.document
|
||||
.dim_styles
|
||||
.iter()
|
||||
.map(|s| format!("{}(txt:{:.2} asz:{:.2})", s.name, s.dimtxt, s.dimasz))
|
||||
.map(|s| crate::tf!("{}(txt:{:.2} asz:{:.2})", s.name, s.dimtxt, s.dimasz).into_owned())
|
||||
.collect();
|
||||
if styles.is_empty() {
|
||||
self.command_line.push_output(crate::t!("No dim styles defined.").as_ref());
|
||||
@@ -1019,7 +1019,7 @@ impl OpenCADStudio {
|
||||
}
|
||||
_ => {
|
||||
self.command_line.push_info(
|
||||
"Usage: DIMSTYLE LIST | NEW <name> | SET <name> <prop> <val>",
|
||||
crate::t!("Usage: DIMSTYLE LIST | NEW <name> | SET <name> <prop> <val>").as_ref(),
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -1043,10 +1043,10 @@ impl OpenCADStudio {
|
||||
.values()
|
||||
.filter_map(|o| {
|
||||
if let ObjectType::MultiLeaderStyle(s) = o {
|
||||
Some(format!(
|
||||
Some(crate::tf!(
|
||||
"{}(txt:{:.2} asz:{:.2})",
|
||||
s.name, s.text_height, s.arrowhead_size
|
||||
))
|
||||
).into_owned())
|
||||
} else {
|
||||
None
|
||||
}
|
||||
@@ -1206,13 +1206,13 @@ impl OpenCADStudio {
|
||||
.text_styles
|
||||
.iter()
|
||||
.map(|s| {
|
||||
format!(
|
||||
crate::tf!(
|
||||
"{} (font: {}, w: {:.2}, oblique: {:.1}°)",
|
||||
s.name,
|
||||
s.font_file,
|
||||
s.width_factor,
|
||||
s.oblique_angle.to_degrees()
|
||||
)
|
||||
).into_owned()
|
||||
})
|
||||
.collect();
|
||||
if styles.is_empty() {
|
||||
|
||||
@@ -91,21 +91,10 @@ impl OpenCADStudio {
|
||||
.filter(|&(code, _)| code != 0)
|
||||
.map(|(code, label)| (label, units::short(code), None))
|
||||
.collect();
|
||||
// Built once: the table it comes from never changes, and
|
||||
// `KeywordCommand` wants a `&'static str`.
|
||||
static PROMPT: std::sync::OnceLock<String> = std::sync::OnceLock::new();
|
||||
let prompt = PROMPT.get_or_init(|| {
|
||||
let listed = units::all()
|
||||
.filter(|&(code, _)| code != 0)
|
||||
.map(|(code, label)| format!("{label}({})", units::short(code)))
|
||||
.collect::<Vec<_>>()
|
||||
.join(" / ");
|
||||
format!("DWGUNITS convert to [{listed}]:")
|
||||
});
|
||||
let current = units::label(self.tabs[i].scene.document.header.insertion_units);
|
||||
let current = crate::t!(units::label(self.tabs[i].scene.document.header.insertion_units));
|
||||
self.command_line
|
||||
.push_info(crate::tf!("DWGUNITS current unit: {current}").as_ref());
|
||||
let c = KeywordCommand::new("DWGUNITS", prompt.as_str(), choices);
|
||||
let c = KeywordCommand::new("DWGUNITS", "DWGUNITS Convert drawing to:", choices);
|
||||
self.command_line.push_info(&c.prompt());
|
||||
self.tabs[i].active_cmd = Some(Box::new(c));
|
||||
}
|
||||
@@ -157,7 +146,7 @@ impl OpenCADStudio {
|
||||
}
|
||||
if layer.eq_ignore_ascii_case(&self.tabs[i].active_layer) {
|
||||
self.command_line.push_error(
|
||||
"LAYDEL: cannot delete the current layer. Make another layer current first.",
|
||||
crate::t!("LAYDEL: cannot delete the current layer. Make another layer current first.").as_ref(),
|
||||
);
|
||||
return Some(Task::none());
|
||||
}
|
||||
@@ -234,7 +223,7 @@ impl OpenCADStudio {
|
||||
}
|
||||
if src.eq_ignore_ascii_case(&self.tabs[i].active_layer) {
|
||||
self.command_line.push_error(
|
||||
"LAYMRG: cannot merge the current layer. Make another layer current first.",
|
||||
crate::t!("LAYMRG: cannot merge the current layer. Make another layer current first.").as_ref(),
|
||||
);
|
||||
return Some(Task::none());
|
||||
}
|
||||
@@ -280,7 +269,7 @@ impl OpenCADStudio {
|
||||
let states = self.tabs[i].scene.document.layer_states();
|
||||
if states.is_empty() {
|
||||
self.command_line.push_info(
|
||||
"LAYERSTATE: no saved states. Use LAYERSTATE SAVE <name>.",
|
||||
crate::t!("LAYERSTATE: no saved states. Use LAYERSTATE SAVE <name>.").as_ref(),
|
||||
);
|
||||
} else {
|
||||
let mut names: Vec<&str> =
|
||||
|
||||
@@ -29,7 +29,7 @@ impl OpenCADStudio {
|
||||
let describe = |c: &Color| match c {
|
||||
Color::ByLayer => "ByLayer".to_string(),
|
||||
Color::ByBlock => "ByBlock".to_string(),
|
||||
Color::Index(n) => format!("index {n}"),
|
||||
Color::Index(n) => crate::tf!("index {n}").into_owned(),
|
||||
_ => "(custom)".to_string(),
|
||||
};
|
||||
let arg = if cmd == "BYLAYER" {
|
||||
@@ -65,7 +65,7 @@ impl OpenCADStudio {
|
||||
}
|
||||
None => {
|
||||
self.command_line.push_error(
|
||||
"Usage: COLOR <ByLayer|ByBlock|1-255|red|yellow|green|cyan|blue|magenta|white>",
|
||||
crate::t!("Usage: COLOR <ByLayer|ByBlock|1-255|red|yellow|green|cyan|blue|magenta|white>").as_ref(),
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -486,19 +486,19 @@ impl OpenCADStudio {
|
||||
// Per-type breakdown so the user sees exactly what went.
|
||||
let mut parts: Vec<String> = Vec::new();
|
||||
if n_layers > 0 {
|
||||
parts.push(format!("{n_layers} layer(s)"));
|
||||
parts.push(crate::tf!("{n_layers} layer(s)").into_owned());
|
||||
}
|
||||
if n_styles > 0 {
|
||||
parts.push(format!("{n_styles} text style(s)"));
|
||||
parts.push(crate::tf!("{n_styles} text style(s)").into_owned());
|
||||
}
|
||||
if n_lts > 0 {
|
||||
parts.push(format!("{n_lts} linetype(s)"));
|
||||
parts.push(crate::tf!("{n_lts} linetype(s)").into_owned());
|
||||
}
|
||||
if n_blocks > 0 {
|
||||
parts.push(format!("{n_blocks} block(s)"));
|
||||
parts.push(crate::tf!("{n_blocks} block(s)").into_owned());
|
||||
}
|
||||
if n_sortents > 0 {
|
||||
parts.push(format!("{n_sortents} stale draw-order table(s)"));
|
||||
parts.push(crate::tf!("{n_sortents} stale draw-order table(s)").into_owned());
|
||||
}
|
||||
self.command_line.push_output(crate::tf!(
|
||||
"PURGE: {} item(s) removed — {}.",
|
||||
@@ -539,7 +539,7 @@ impl OpenCADStudio {
|
||||
|
||||
if prop.is_empty() {
|
||||
self.command_line.push_info(
|
||||
"Usage: CHPROP <prop> <val> (props: LAYER COLOR LINETYPE LTSCALE)",
|
||||
crate::t!("Usage: CHPROP <prop> <val> (props: LAYER COLOR LINETYPE LTSCALE)").as_ref(),
|
||||
);
|
||||
} else {
|
||||
let handles: Vec<_> = self.tabs[i]
|
||||
@@ -940,7 +940,7 @@ impl OpenCADStudio {
|
||||
let value = it.next().map(|s| s.trim().to_string());
|
||||
if name.is_empty() || name == "?" {
|
||||
self.command_line.push_info(
|
||||
"SETVAR: LTSCALE CELTSCALE PDMODE PDSIZE TEXTSIZE ORTHOMODE FILLMODE MIRRTEXT FRAME IMAGEFRAME PDFFRAME WIPEOUTFRAME XCLIPFRAME POINTCLOUDCLIPFRAME ZOOMWHEEL ZOOMFACTOR CURSORSIZE PICKBOX CURSORTYPE SNAPANG TEXTFILL CLIPROMPTLINES COMMANDLINEFADETIME ATTREQ ATTDIA DIMASSOC DIMCONTINUEMODE ANGBASE ANGDIR SKETCHINC SKPOLY SKTOLERANCE DONUTID DONUTOD CENTEREXE CENTERLAYER CENTERLTYPE CENTERLTSCALE CENTERLTYPEFILE CENTERCROSSSIZE CENTERCROSSGAP CENTERMARKEXE COLORTHEME SELECTIONAREA SELECTIONAREAOPACITY SELECTIONEFFECT SELECTIONEFFECTCOLOR WINDOWSAREACOLOR CROSSINGAREACOLOR SELECTIONPREVIEW GRIPSIZE GRIPCOLOR GRIPHOT GRIPHOVER | CLAYER CELTYPE TEXTSTYLE (read-only)",
|
||||
crate::t!("SETVAR: LTSCALE CELTSCALE PDMODE PDSIZE TEXTSIZE ORTHOMODE FILLMODE MIRRTEXT FRAME IMAGEFRAME PDFFRAME WIPEOUTFRAME XCLIPFRAME POINTCLOUDCLIPFRAME ZOOMWHEEL ZOOMFACTOR CURSORSIZE PICKBOX CURSORTYPE SNAPANG TEXTFILL CLIPROMPTLINES COMMANDLINEFADETIME ATTREQ ATTDIA DIMASSOC DIMCONTINUEMODE ANGBASE ANGDIR SKETCHINC SKPOLY SKTOLERANCE DONUTID DONUTOD CENTEREXE CENTERLAYER CENTERLTYPE CENTERLTSCALE CENTERLTYPEFILE CENTERCROSSSIZE CENTERCROSSGAP CENTERMARKEXE COLORTHEME SELECTIONAREA SELECTIONAREAOPACITY SELECTIONEFFECT SELECTIONEFFECTCOLOR WINDOWSAREACOLOR CROSSINGAREACOLOR SELECTIONPREVIEW GRIPSIZE GRIPCOLOR GRIPHOT GRIPHOVER | CLAYER CELTYPE TEXTSTYLE (read-only)").as_ref(),
|
||||
);
|
||||
} else {
|
||||
if matches!(name.as_str(), "SHOWHIST" | "SOLIDHIST") {
|
||||
@@ -964,12 +964,12 @@ impl OpenCADStudio {
|
||||
self.tabs[i].dirty = true;
|
||||
self.refresh_properties();
|
||||
}
|
||||
self.command_line.push_output(&format!("{name} = {mode}"));
|
||||
self.command_line.push_output(&crate::tf!("{name} = {mode}"));
|
||||
}
|
||||
None => self.command_line.push_error(&format!("{name}: expected an integer from 0 to {maximum}.")),
|
||||
None => self.command_line.push_error(&crate::tf!("{name}: expected an integer from 0 to {maximum}.")),
|
||||
}
|
||||
} else {
|
||||
self.command_line.push_output(&format!("Enter new value for {name} <{current}>:"));
|
||||
self.command_line.push_output(&crate::tf!("Enter new value for {name} <{current}>:"));
|
||||
self.pending_setvar = Some(name.clone());
|
||||
}
|
||||
return Some(self.finish_dispatch(cmd));
|
||||
@@ -1033,7 +1033,7 @@ impl OpenCADStudio {
|
||||
self.tabs[i].dirty = true;
|
||||
}
|
||||
self.command_line
|
||||
.push_output(&format!("{name} = {mode}"));
|
||||
.push_output(&crate::tf!("{name} = {mode}"));
|
||||
}
|
||||
_ => self.command_line.push_error(
|
||||
crate::tf!("SETVAR: {name} requires 0, 1, or 2.").as_ref(),
|
||||
@@ -1095,10 +1095,10 @@ impl OpenCADStudio {
|
||||
self.dimension_continue_mode = mode;
|
||||
self.persist_settings_if_changed();
|
||||
self.command_line
|
||||
.push_output(&format!("DIMCONTINUEMODE = {mode}"));
|
||||
.push_output(&crate::tf!("DIMCONTINUEMODE = {mode}"));
|
||||
}
|
||||
_ => self.command_line.push_error(
|
||||
"SETVAR: DIMCONTINUEMODE requires 0 or 1.",
|
||||
crate::t!("SETVAR: DIMCONTINUEMODE requires 0 or 1.").as_ref(),
|
||||
),
|
||||
}
|
||||
} else {
|
||||
@@ -1136,13 +1136,13 @@ impl OpenCADStudio {
|
||||
crate::modules::draw::defaults::set_donut_outer_diameter(number);
|
||||
}
|
||||
self.command_line
|
||||
.push_output(&format!("{name} = {number}"));
|
||||
.push_output(&crate::tf!("{name} = {number}"));
|
||||
} else {
|
||||
self.command_line.push_error(if name == "DONUTID" {
|
||||
self.command_line.push_error(crate::t!(if name == "DONUTID" {
|
||||
"SETVAR: DONUTID requires a finite value greater than or equal to zero."
|
||||
} else {
|
||||
"SETVAR: DONUTOD requires a finite value greater than zero."
|
||||
});
|
||||
}).as_ref());
|
||||
}
|
||||
} else {
|
||||
self.command_line.push_output(crate::tf!(
|
||||
@@ -2097,7 +2097,7 @@ impl OpenCADStudio {
|
||||
false,
|
||||
)),
|
||||
},
|
||||
_ => Err(format!("SETVAR: unknown variable \"{name}\".")),
|
||||
_ => Err(crate::tf!("SETVAR: unknown variable \"{name}\".").into_owned()),
|
||||
}
|
||||
};
|
||||
match outcome {
|
||||
@@ -2501,7 +2501,7 @@ impl OpenCADStudio {
|
||||
self.command_line.push_output(crate::tf!("PDMODE set to {v}").as_ref());
|
||||
} else {
|
||||
self.command_line.push_error(
|
||||
"Usage: PDMODE [value] (0=dot 1=none 2=+ 3=x 4=tick; +32 circle, +64 square)",
|
||||
crate::t!("Usage: PDMODE [value] (0=dot 1=none 2=+ 3=x 4=tick; +32 circle, +64 square)").as_ref(),
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -2569,7 +2569,7 @@ impl OpenCADStudio {
|
||||
self.persist_settings_if_changed();
|
||||
match crate::io::file_association::register_as_handler() {
|
||||
Ok(()) => self.command_line.push_output(
|
||||
"FILEASSOC set to 1 — registered as a .dwg/.dxf/.bak handler",
|
||||
crate::t!("FILEASSOC set to 1 — registered as a .dwg/.dxf/.bak handler").as_ref(),
|
||||
),
|
||||
Err(e) => self
|
||||
.command_line
|
||||
@@ -2614,7 +2614,7 @@ impl OpenCADStudio {
|
||||
let msg = if v == 0 {
|
||||
"SAVETIME set to 0 (autosave off)".to_string()
|
||||
} else {
|
||||
format!("SAVETIME set to {v} minute(s)")
|
||||
crate::tf!("SAVETIME set to {v} minute(s)").into_owned()
|
||||
};
|
||||
self.command_line.push_output(&msg);
|
||||
}
|
||||
@@ -2646,7 +2646,7 @@ impl OpenCADStudio {
|
||||
.push_output(crate::tf!("PDSIZE set to {v:.4}").as_ref());
|
||||
} else {
|
||||
self.command_line.push_error(
|
||||
"Usage: PDSIZE [value] (>0 absolute size, <0 percent of viewport, 0 default)",
|
||||
crate::t!("Usage: PDSIZE [value] (>0 absolute size, <0 percent of viewport, 0 default)").as_ref(),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
+14
-14
@@ -257,7 +257,7 @@ impl OpenCADStudio {
|
||||
let path = cmd.trim_start_matches("CUIEXPORT").trim();
|
||||
if path.is_empty() {
|
||||
self.command_line.push_info(
|
||||
"Usage: CUIEXPORT <path> — save the keyboard shortcuts to a file.",
|
||||
crate::t!("Usage: CUIEXPORT <path> — save the keyboard shortcuts to a file.").as_ref(),
|
||||
);
|
||||
return Some(Task::none());
|
||||
}
|
||||
@@ -290,7 +290,7 @@ impl OpenCADStudio {
|
||||
.trim();
|
||||
if path.is_empty() {
|
||||
self.command_line.push_info(
|
||||
"Usage: CUIIMPORT <path> — load keyboard shortcuts from a file.",
|
||||
crate::t!("Usage: CUIIMPORT <path> — load keyboard shortcuts from a file.").as_ref(),
|
||||
);
|
||||
return Some(Task::none());
|
||||
}
|
||||
@@ -381,12 +381,12 @@ impl OpenCADStudio {
|
||||
"COLORSCHEME",
|
||||
"COLORSCHEME Enter theme name (or ? to list):",
|
||||
);
|
||||
self.command_line.push_output(
|
||||
"Available themes: DARK LIGHT DRACULA NORD SOLARIZED_LIGHT SOLARIZED_DARK \
|
||||
self.command_line.push_output(&crate::tf!("Available themes: {}",
|
||||
"DARK LIGHT DRACULA NORD SOLARIZED_LIGHT SOLARIZED_DARK \
|
||||
GRUVBOX_LIGHT GRUVBOX_DARK TOKYONIGHT TOKYONIGHTSTORM TOKYONIGHTLIGHT \
|
||||
KANAGAWAWAVE KANAGAWADRAGON KANAGAWALOTUS MOONFLY NIGHTFLY OXOCARBON FERRA",
|
||||
);
|
||||
self.command_line.push_info(&format!(
|
||||
));
|
||||
self.command_line.push_info(&crate::tf!(
|
||||
"Current color scheme: <{}>",
|
||||
self.ui_theme.name
|
||||
));
|
||||
@@ -398,23 +398,23 @@ impl OpenCADStudio {
|
||||
let sub = cmd.split_once(' ').map(|(_, r)| r.trim()).unwrap_or("");
|
||||
let upper_sub = sub.to_ascii_uppercase();
|
||||
if upper_sub.is_empty() {
|
||||
self.command_line.push_output(&format!(
|
||||
self.command_line.push_output(&crate::tf!(
|
||||
"Current color scheme: <{}>",
|
||||
self.ui_theme.name
|
||||
));
|
||||
return Some(Task::none());
|
||||
}
|
||||
if upper_sub == "LIST" || upper_sub == "?" {
|
||||
self.command_line.push_output(
|
||||
"Available themes: DARK LIGHT DRACULA NORD SOLARIZED_LIGHT SOLARIZED_DARK \
|
||||
self.command_line.push_output(&crate::tf!("Available themes: {}",
|
||||
"DARK LIGHT DRACULA NORD SOLARIZED_LIGHT SOLARIZED_DARK \
|
||||
GRUVBOX_LIGHT GRUVBOX_DARK TOKYONIGHT TOKYONIGHTSTORM TOKYONIGHTLIGHT \
|
||||
KANAGAWAWAVE KANAGAWADRAGON KANAGAWALOTUS MOONFLY NIGHTFLY OXOCARBON FERRA",
|
||||
);
|
||||
));
|
||||
return Some(Task::none());
|
||||
}
|
||||
if sub == "0" || sub == "1" {
|
||||
self.command_line.push_error(
|
||||
"COLORSCHEME: 0 and 1 are COLORTHEME options. Enter a theme name (e.g. DARK, LIGHT, DRACULA) or use COLORTHEME.",
|
||||
crate::t!("COLORSCHEME: 0 and 1 are COLORTHEME options. Enter a theme name (e.g. DARK, LIGHT, DRACULA) or use COLORTHEME.").as_ref(),
|
||||
);
|
||||
return Some(Task::none());
|
||||
}
|
||||
@@ -630,7 +630,7 @@ impl OpenCADStudio {
|
||||
}
|
||||
_ => {
|
||||
self.command_line.push_error(
|
||||
"VPORTS: unknown option. Use VPORTS 2H | 2V | 4 | SINGLE",
|
||||
crate::t!("VPORTS: unknown option. Use VPORTS 2H | 2V | 4 | SINGLE").as_ref(),
|
||||
);
|
||||
vec![]
|
||||
}
|
||||
@@ -1161,7 +1161,7 @@ impl OpenCADStudio {
|
||||
.collect();
|
||||
if vps.len() < 2 {
|
||||
self.command_line.push_error(
|
||||
"SYNCPVIEWPORTS: select two or more viewports (the first is the master).",
|
||||
crate::t!("SYNCPVIEWPORTS: select two or more viewports (the first is the master).").as_ref(),
|
||||
);
|
||||
return Some(Task::none());
|
||||
}
|
||||
@@ -1215,7 +1215,7 @@ impl OpenCADStudio {
|
||||
// that work.
|
||||
None => self
|
||||
.command_line
|
||||
.push_info(visual_style::keyword_prompt()),
|
||||
.push_info(crate::t!(visual_style::keyword_prompt()).as_ref()),
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user