feat(locale): localize full interface

This commit is contained in:
Hakan Seven committed 2026-08-02 22:09:25 +03:00
1 parent b90b3e3ecf
commit 3e6693b93f
205 files changed
+32369 -3810

No files matched your search

+2 -1
View File
@@ -4,6 +4,7 @@
// receives the dispatched `COPYBASE_AT <x> <y> <z>` token.
use glam::DVec3;
use crate::t;
use crate::command::{CadCommand, CmdResult};
@@ -21,7 +22,7 @@ impl CadCommand for CopyBaseCommand {
}
fn prompt(&self) -> String {
"COPYBASE Specify base point:".to_string()
t!("COPYBASE Specify base point:").into_owned()
}
fn on_point(&mut self, pt: DVec3) -> CmdResult {
+2 -1
View File
@@ -17,6 +17,7 @@ pub const MENU_ITEMS: &[(&str, &str, IconKind)] = &[
use acadrust::Handle;
use glam::{DVec3, Vec3};
use crate::t;
use crate::command::{CadCommand, CmdResult};
use crate::scene::model::wire_model::WireModel;
@@ -103,7 +104,7 @@ impl CadCommand for PasteCommand {
}
fn prompt(&self) -> String {
"PASTECLIP Pick insertion point:".into()
t!("PASTECLIP Pick insertion point:").into_owned()
}
fn on_point(&mut self, pt: DVec3) -> CmdResult {
+74 -46
View File
@@ -15,6 +15,7 @@
use acadrust::types::Vector3;
use acadrust::{Arc as CadArc, EntityType};
use crate::t;
use crate::command::{CadCommand, CmdResult};
use crate::modules::IconKind;
@@ -312,12 +313,20 @@ impl CadCommand for ArcCommand {
}
fn prompt(&self) -> String {
match self.step {
0 => "ARC Specify center:".into(),
1 => "ARC Specify start point:".into(),
_ => format!(
"ARC Specify end point [c=({:.2},{:.2}) r={:.3}]:",
self.c.x, self.c.y, self.r
),
0 => t!("ARC Specify center:").into_owned(),
1 => t!("ARC Specify start point:").into_owned(),
_ => {
let cx = format!("{:.2}", self.c.x);
let cy = format!("{:.2}", self.c.y);
let r = format!("{:.3}", self.r);
t!(
"ARC Specify end point [c=(%{cx},%{cy}) r=%{r}]:",
cx = cx,
cy = cy,
r = r
)
.into_owned()
}
}
}
@@ -437,9 +446,9 @@ impl CadCommand for Arc3PCommand {
}
fn prompt(&self) -> String {
match self.pts.len() {
0 => "ARC 3P Specify start point:".into(),
1 => "ARC 3P Specify second point on arc:".into(),
_ => "ARC 3P Specify end point:".into(),
0 => t!("ARC 3P Specify start point:").into_owned(),
1 => t!("ARC 3P Specify second point on arc:").into_owned(),
_ => t!("ARC 3P Specify end point:").into_owned(),
}
}
fn on_point(&mut self, pt: DVec3) -> CmdResult {
@@ -537,9 +546,12 @@ impl CadCommand for ArcSCECommand {
}
fn prompt(&self) -> String {
match self.step {
0 => "ARC SCE Specify start point:".into(),
1 => "ARC SCE Specify center:".into(),
_ => format!("ARC SCE Specify end point [r={:.3}]:", self.r),
0 => t!("ARC SCE Specify start point:").into_owned(),
1 => t!("ARC SCE Specify center:").into_owned(),
_ => {
let r = format!("{:.3}", self.r);
t!("ARC SCE Specify end point [r=%{r}]:", r = r).into_owned()
}
}
}
fn on_point(&mut self, pt: DVec3) -> CmdResult {
@@ -637,12 +649,16 @@ impl CadCommand for ArcSCACommand {
}
fn prompt(&self) -> String {
match self.step {
0 => "ARC SCA Specify start point:".into(),
1 => "ARC SCA Specify center:".into(),
_ => format!(
"ARC SCA Click end direction or type arc span in degrees [start={:.1}°]:",
self.sa.to_degrees()
),
0 => t!("ARC SCA Specify start point:").into_owned(),
1 => t!("ARC SCA Specify center:").into_owned(),
_ => {
let sa = format!("{:.1}°", self.sa.to_degrees());
t!(
"ARC SCA Click end direction or type arc span in degrees [start=%{sa}]:",
sa = sa
)
.into_owned()
}
}
}
fn on_point(&mut self, pt: DVec3) -> CmdResult {
@@ -767,12 +783,16 @@ impl CadCommand for ArcSCLCommand {
}
fn prompt(&self) -> String {
match self.step {
0 => "ARC SCL Specify start point:".into(),
1 => "ARC SCL Specify center:".into(),
_ => format!(
"ARC SCL Click chord end or type chord length [r={:.3}]:",
self.r
),
0 => t!("ARC SCL Specify start point:").into_owned(),
1 => t!("ARC SCL Specify center:").into_owned(),
_ => {
let r = format!("{:.3}", self.r);
t!(
"ARC SCL Click chord end or type chord length [r=%{r}]:",
r = r
)
.into_owned()
}
}
}
fn on_point(&mut self, pt: DVec3) -> CmdResult {
@@ -871,9 +891,9 @@ impl CadCommand for ArcSEACommand {
}
fn prompt(&self) -> String {
match self.step {
0 => "ARC SEA Specify start point:".into(),
1 => "ARC SEA Specify end point:".into(),
_ => "ARC SEA Specify angle (move cursor perpendicular to chord):".into(),
0 => t!("ARC SEA Specify start point:").into_owned(),
1 => t!("ARC SEA Specify end point:").into_owned(),
_ => t!("ARC SEA Specify angle (move cursor perpendicular to chord):").into_owned(),
}
}
fn on_point(&mut self, pt: DVec3) -> CmdResult {
@@ -949,9 +969,9 @@ impl CadCommand for ArcSERCommand {
}
fn prompt(&self) -> String {
match self.step {
0 => "ARC SER Specify start point:".into(),
1 => "ARC SER Specify end point:".into(),
_ => "ARC SER Click radius point or type radius value:".into(),
0 => t!("ARC SER Specify start point:").into_owned(),
1 => t!("ARC SER Specify end point:").into_owned(),
_ => t!("ARC SER Click radius point or type radius value:").into_owned(),
}
}
fn on_point(&mut self, pt: DVec3) -> CmdResult {
@@ -1065,9 +1085,9 @@ impl CadCommand for ArcSEDCommand {
}
fn prompt(&self) -> String {
match self.step {
0 => "ARC SED Specify start point:".into(),
1 => "ARC SED Specify end point:".into(),
_ => "ARC SED Specify tangent direction at start:".into(),
0 => t!("ARC SED Specify start point:").into_owned(),
1 => t!("ARC SED Specify end point:").into_owned(),
_ => t!("ARC SED Specify tangent direction at start:").into_owned(),
}
}
fn on_point(&mut self, pt: DVec3) -> CmdResult {
@@ -1149,12 +1169,16 @@ impl CadCommand for ArcCSACommand {
}
fn prompt(&self) -> String {
match self.step {
0 => "ARC CSA Specify center:".into(),
1 => "ARC CSA Specify start point:".into(),
_ => format!(
"ARC CSA Click end direction or type arc span in degrees [start={:.1}°]:",
self.sa.to_degrees()
),
0 => t!("ARC CSA Specify center:").into_owned(),
1 => t!("ARC CSA Specify start point:").into_owned(),
_ => {
let sa = format!("{:.1}°", self.sa.to_degrees());
t!(
"ARC CSA Click end direction or type arc span in degrees [start=%{sa}]:",
sa = sa
)
.into_owned()
}
}
}
fn on_point(&mut self, pt: DVec3) -> CmdResult {
@@ -1274,12 +1298,16 @@ impl CadCommand for ArcCSLCommand {
}
fn prompt(&self) -> String {
match self.step {
0 => "ARC CSL Specify center:".into(),
1 => "ARC CSL Specify start point:".into(),
_ => format!(
"ARC CSL Click chord end or type chord length [r={:.3}]:",
self.r
),
0 => t!("ARC CSL Specify center:").into_owned(),
1 => t!("ARC CSL Specify start point:").into_owned(),
_ => {
let r = format!("{:.3}", self.r);
t!(
"ARC CSL Click chord end or type chord length [r=%{r}]:",
r = r
)
.into_owned()
}
}
}
fn on_point(&mut self, pt: DVec3) -> CmdResult {
@@ -1386,7 +1414,7 @@ impl CadCommand for ArcContCommand {
"ARC_CONT"
}
fn prompt(&self) -> String {
"ARC Continue Specify end point [Ctrl = flip direction]:".into()
t!("ARC Continue Specify end point [Ctrl = flip direction]:").into_owned()
}
fn set_ctrl(&mut self, ctrl: bool) {
self.ctrl = ctrl;
+17 -6
View File
@@ -10,6 +10,7 @@ use acadrust::entities::AttributeDefinition;
use acadrust::types::Vector3;
use acadrust::EntityType;
use glam::DVec3;
use crate::t;
use crate::command::{CadCommand, CmdResult};
use crate::scene::model::wire_model::WireModel;
@@ -52,12 +53,22 @@ impl CadCommand for AttdefCommand {
fn prompt(&self) -> String {
match &self.step {
Step::Tag => "ATTDEF Enter attribute tag (no spaces):".into(),
Step::Prompt { tag } => format!("ATTDEF Enter prompt for '{tag}' (Enter=use tag):"),
Step::Default { tag, .. } => {
format!("ATTDEF Enter default value for '{tag}' (Enter=blank):")
}
Step::Insertion { tag, .. } => format!("ATTDEF Specify insertion point for '{tag}':"),
Step::Tag => t!("ATTDEF Enter attribute tag (no spaces):").into_owned(),
Step::Prompt { tag } => t!(
"ATTDEF Enter prompt for '%{tag}' (Enter=use tag):",
tag = tag
)
.into_owned(),
Step::Default { tag, .. } => t!(
"ATTDEF Enter default value for '%{tag}' (Enter=blank):",
tag = tag
)
.into_owned(),
Step::Insertion { tag, .. } => t!(
"ATTDEF Specify insertion point for '%{tag}':",
tag = tag
)
.into_owned(),
}
}
+3 -2
View File
@@ -17,6 +17,7 @@
use acadrust::types::Vector3;
use acadrust::{EntityType, Handle, Line};
use glam::DVec3;
use crate::t;
use crate::command::{CadCommand, CmdResult};
use crate::modules::{IconKind, ModuleEvent, ToolDef};
@@ -216,9 +217,9 @@ impl CadCommand for CenterLineCommand {
fn prompt(&self) -> String {
if self.first.is_none() {
"CENTERLINE Select first line:".to_string()
t!("CENTERLINE Select first line:").into_owned()
} else {
"CENTERLINE Select second line:".to_string()
t!("CENTERLINE Select second line:").into_owned()
}
}
+30 -20
View File
@@ -10,6 +10,7 @@
use acadrust::types::Vector3;
use acadrust::{Circle, EntityType};
use crate::t;
use crate::command::{CadCommand, CmdResult, DynField, TangentObject};
use crate::modules::draw::defaults;
@@ -135,11 +136,19 @@ impl CadCommand for CircleCommand {
}
fn prompt(&self) -> String {
match &self.step {
StepCR::Center => "CIRCLE Specify center point:".into(),
StepCR::Radius(c) => format!(
"CIRCLE Specify radius or type value <{:.4}> [center ({:.3},{:.3})]:",
self.default_r, c.x, c.y
),
StepCR::Center => t!("CIRCLE Specify center point:").into_owned(),
StepCR::Radius(c) => {
let r = format!("{:.4}", self.default_r);
let cx = format!("{:.3}", c.x);
let cy = format!("{:.3}", c.y);
t!(
"CIRCLE Specify radius or type value <%{r}> [center (%{cx},%{cy})]:",
r = r,
cx = cx,
cy = cy
)
.into_owned()
}
}
}
@@ -151,7 +160,7 @@ impl CadCommand for CircleCommand {
CmdOption::new("2P", "2P"),
CmdOption::new("Ttr", "TTR"),
CmdOption::new("Ttt", "TTT"),
CmdOption::new("Diameter", "D"),
CmdOption::new(t!("Diameter").as_ref(), "D"),
],
StepCR::Radius(_) => vec![],
}
@@ -259,11 +268,12 @@ impl CadCommand for CircleCDCommand {
}
fn prompt(&self) -> String {
match &self.step {
StepCR::Center => "CIRCLE CD Specify center point:".into(),
StepCR::Radius(c) => format!(
StepCR::Center => t!("CIRCLE CD Specify center point:").into_owned(),
StepCR::Radius(c) => crate::tf!(
"CIRCLE CD Specify diameter or type value <{:.4}> [center ({:.3},{:.3})]:",
self.default_d, c.x, c.y
),
)
.into_owned(),
}
}
fn on_point(&mut self, pt: DVec3) -> CmdResult {
@@ -343,9 +353,9 @@ impl CadCommand for Circle2PCommand {
}
fn prompt(&self) -> String {
if self.p1.is_none() {
"CIRCLE 2P Specify first end of diameter:".into()
crate::t!("CIRCLE 2P Specify first end of diameter:").into_owned()
} else {
"CIRCLE 2P Specify second end of diameter:".into()
crate::t!("CIRCLE 2P Specify second end of diameter:").into_owned()
}
}
fn on_point(&mut self, pt: DVec3) -> CmdResult {
@@ -393,9 +403,9 @@ impl CadCommand for Circle3PCommand {
}
fn prompt(&self) -> String {
match self.pts.len() {
0 => "CIRCLE 3P Specify first point:".into(),
1 => "CIRCLE 3P Specify second point:".into(),
_ => "CIRCLE 3P Specify third point:".into(),
0 => crate::t!("CIRCLE 3P Specify first point:").into_owned(),
1 => crate::t!("CIRCLE 3P Specify second point:").into_owned(),
_ => crate::t!("CIRCLE 3P Specify third point:").into_owned(),
}
}
fn on_point(&mut self, pt: DVec3) -> CmdResult {
@@ -897,9 +907,9 @@ impl CadCommand for CircleTTRCommand {
fn prompt(&self) -> String {
match &self.step {
StepTTR::First => "CIRCLE TTR Select first tangent object:".into(),
StepTTR::Second { .. } => "CIRCLE TTR Select second tangent object:".into(),
StepTTR::Radius { .. } => "CIRCLE TTR Specify radius:".into(),
StepTTR::First => crate::t!("CIRCLE TTR Select first tangent object:").into_owned(),
StepTTR::Second { .. } => crate::t!("CIRCLE TTR Select second tangent object:").into_owned(),
StepTTR::Radius { .. } => crate::t!("CIRCLE TTR Specify radius:").into_owned(),
}
}
@@ -992,9 +1002,9 @@ impl CadCommand for CircleTTTCommand {
fn prompt(&self) -> String {
match self.objs.len() {
0 => "CIRCLE TTT Select first tangent object:".into(),
1 => "CIRCLE TTT Select second tangent object:".into(),
_ => "CIRCLE TTT Select third tangent object:".into(),
0 => crate::t!("CIRCLE TTT Select first tangent object:").into_owned(),
1 => crate::t!("CIRCLE TTT Select second tangent object:").into_owned(),
_ => crate::t!("CIRCLE TTT Select third tangent object:").into_owned(),
}
}
+2 -1
View File
@@ -10,6 +10,7 @@
use acadrust::types::Vector3;
use acadrust::{EntityType, Handle, Line};
use glam::DVec3;
use crate::t;
use crate::command::{CadCommand, CmdResult};
use crate::modules::{IconKind, ModuleEvent, ToolDef};
@@ -72,7 +73,7 @@ impl CadCommand for DimCenterCommand {
}
fn prompt(&self) -> String {
"DIMCENTER Select arc or circle:".to_string()
t!("DIMCENTER Select arc or circle:").into_owned()
}
fn needs_entity_pick(&self) -> bool {
+6 -3
View File
@@ -13,6 +13,7 @@
use acadrust::entities::{LwPolyline, LwVertex};
use acadrust::EntityType;
use glam::DVec3;
use crate::t;
use crate::command::{CadCommand, CmdResult};
@@ -45,9 +46,11 @@ impl CadCommand for DonutCommand {
fn prompt(&self) -> String {
match &self.state {
DonutState::AskInner => "DONUT Specify inside diameter <0>:".into(),
DonutState::AskOuter => "DONUT Specify outside diameter:".into(),
DonutState::PlaceCenter => "DONUT Specify center of donut (Enter to exit):".into(),
DonutState::AskInner => t!("DONUT Specify inside diameter <0>:").into_owned(),
DonutState::AskOuter => t!("DONUT Specify outside diameter:").into_owned(),
DonutState::PlaceCenter => {
t!("DONUT Specify center of donut (Enter to exit):").into_owned()
}
}
}
+34 -19
View File
@@ -7,6 +7,7 @@
use acadrust::types::Vector3;
use acadrust::{Ellipse, EntityType};
use crate::t;
use crate::command::{CadCommand, CmdResult};
use crate::modules::IconKind;
@@ -126,12 +127,13 @@ impl CadCommand for EllipseCommand {
fn prompt(&self) -> String {
match &self.step {
CtrStep::Center => "ELLIPSE Specify center:".into(),
CtrStep::MajorAxis { .. } => "ELLIPSE Specify major axis endpoint:".into(),
CtrStep::MinorRatio { major, .. } => format!(
CtrStep::Center => t!("ELLIPSE Specify center:").into_owned(),
CtrStep::MajorAxis { .. } => t!("ELLIPSE Specify major axis endpoint:").into_owned(),
CtrStep::MinorRatio { major, .. } => crate::tf!(
"ELLIPSE Specify minor axis point or type half-length [major r={:.3}]:",
major.length()
),
)
.into_owned(),
}
}
@@ -265,12 +267,17 @@ impl CadCommand for EllipseAxisCommand {
fn prompt(&self) -> String {
match &self.step {
AxisStep::Pt1 => "ELLIPSE (Axis) Specify first endpoint of major axis:".into(),
AxisStep::Pt2 { .. } => "ELLIPSE (Axis) Specify second endpoint of major axis:".into(),
AxisStep::MinorRatio { major, .. } => format!(
AxisStep::Pt1 => {
t!("ELLIPSE (Axis) Specify first endpoint of major axis:").into_owned()
}
AxisStep::Pt2 { .. } => {
t!("ELLIPSE (Axis) Specify second endpoint of major axis:").into_owned()
}
AxisStep::MinorRatio { major, .. } => crate::tf!(
"ELLIPSE (Axis) Specify minor axis point or type half-length [major r={:.3}]:",
major.length()
),
)
.into_owned(),
}
}
@@ -397,19 +404,27 @@ impl CadCommand for EllipseArcCommand {
fn prompt(&self) -> String {
match &self.step {
ArcStep::Center => "ELLIPSE ARC Specify center:".into(),
ArcStep::MajorAxis { .. } => "ELLIPSE ARC Specify major axis endpoint:".into(),
ArcStep::MinorRatio { major, .. } => format!(
"ELLIPSE ARC Specify minor axis point or type half-length [major r={:.3}]:",
major.length()
),
ArcStep::Center => t!("ELLIPSE ARC Specify center:").into_owned(),
ArcStep::MajorAxis { .. } => t!("ELLIPSE ARC Specify major axis endpoint:").into_owned(),
ArcStep::MinorRatio { major, .. } => {
let r = format!("{:.3}", major.length());
t!(
"ELLIPSE ARC Specify minor axis point or type half-length [major r=%{r}]:",
r = r
)
.into_owned()
}
ArcStep::StartAngle { .. } => {
"ELLIPSE ARC Specify start angle point or type degrees:".into()
t!("ELLIPSE ARC Specify start angle point or type degrees:").into_owned()
}
ArcStep::EndAngle { t_start, .. } => {
let sa = format!("{:.1}°", t_start.to_degrees());
t!(
"ELLIPSE ARC Specify end angle point or type degrees [start=%{sa}]:",
sa = sa
)
.into_owned()
}
ArcStep::EndAngle { t_start, .. } => format!(
"ELLIPSE ARC Specify end angle point or type degrees [start={:.1}°]:",
t_start.to_degrees()
),
}
}
+27 -18
View File
@@ -14,6 +14,7 @@ use crate::modules::IconKind;
use crate::scene::model::hatch_model::{HatchModel, HatchPattern, PatFamily};
use crate::scene::model::wire_model::WireModel;
use glam::DVec3;
use crate::t;
// ── Icons ──────────────────────────────────────────────────────────────────
@@ -258,17 +259,18 @@ impl CadCommand for HatchCommand {
match &self.mode {
Mode::PickInside => {
let miss = if self.missed {
" ⚠ No closed boundary found."
t!(" ⚠ No closed boundary found.").into_owned()
} else {
""
String::new()
};
format!("HATCH Pick internal point:{miss}")
t!("HATCH Pick internal point:%{miss}", miss = miss).into_owned()
}
Mode::Manual => {
if self.manual_pts.is_empty() {
"HATCH Boundary point 1:".into()
t!("HATCH Boundary point 1:").into_owned()
} else {
format!("HATCH Point {}:", self.manual_pts.len() + 1)
let n = self.manual_pts.len() + 1;
t!("HATCH Point %{n}:", n = n).into_owned()
}
}
}
@@ -277,11 +279,11 @@ impl CadCommand for HatchCommand {
fn options(&self) -> Vec<crate::command::CmdOption> {
use crate::command::CmdOption;
match &self.mode {
Mode::PickInside => vec![CmdOption::new("Draw manually", "S")],
Mode::PickInside => vec![CmdOption::new(t!("Draw manually").as_ref(), "S")],
Mode::Manual => {
// Enter accepts the boundary once at least 3 points are picked.
if self.manual_pts.len() >= 3 {
vec![CmdOption::enter("Accept")]
vec![CmdOption::enter(t!("Accept").as_ref())]
} else {
vec![]
}
@@ -427,21 +429,28 @@ impl CadCommand for GradientCommand {
match &self.mode {
Mode::PickInside => {
let miss = if self.missed {
" ⚠ No closed boundary found."
t!(" ⚠ No closed boundary found.")
} else {
""
std::borrow::Cow::Borrowed("")
};
format!(
"GRADIENT ({}{}) Pick internal point:{miss}",
self.kind.label(),
if self.invert { ", inverted" } else { "" }
let invert = if self.invert {
t!(", inverted")
} else {
std::borrow::Cow::Borrowed("")
};
t!(
"GRADIENT (%{kind}%{invert}) Pick internal point:%{miss}",
kind = t!(self.kind.label()),
invert = invert,
miss = miss
)
.into_owned()
}
Mode::Manual => {
if self.manual_pts.is_empty() {
"GRADIENT Boundary point 1:".into()
t!("GRADIENT Boundary point 1:").into_owned()
} else {
format!("GRADIENT Point {}:", self.manual_pts.len() + 1)
t!("GRADIENT Point %{n}:", n = self.manual_pts.len() + 1).into_owned()
}
}
}
@@ -592,11 +601,11 @@ impl CadCommand for BoundaryCommand {
fn prompt(&self) -> String {
let miss = if self.missed {
" ⚠ No closed boundary found."
t!(" ⚠ No closed boundary found.").into_owned()
} else {
""
String::new()
};
format!("BOUNDARY Pick internal point:{miss}")
t!("BOUNDARY Pick internal point:%{miss}", miss = miss).into_owned()
}
fn on_point(&mut self, pt: DVec3) -> CmdResult {
+13 -5
View File
@@ -10,6 +10,7 @@
use acadrust::Handle;
use glam::DVec3;
use crate::t;
use crate::command::{CadCommand, CmdResult};
@@ -53,13 +54,20 @@ impl CadCommand for HatcheditCommand {
fn prompt(&self) -> String {
match &self.step {
HatcheditStep::PickHatch => "HATCHEDIT Select hatch:".into(),
HatcheditStep::PickHatch => t!("HATCHEDIT Select hatch:").into_owned(),
HatcheditStep::EditOptions {
name, scale, angle, ..
} => format!(
"HATCHEDIT Pattern:{name} Scale:{scale:.4} Angle:{angle:.1} \
[P <pat> / S <scale> / A <angle> | Enter to apply]:"
),
} => {
let scale = format!("{scale:.4}");
let angle = format!("{angle:.1}");
t!(
"HATCHEDIT Pattern:%{name} Scale:%{scale} Angle:%{angle} [P <pat> / S <scale> / A <angle> | Enter to apply]:",
name = name,
scale = scale,
angle = angle
)
.into_owned()
}
}
}
+6 -5
View File
@@ -15,6 +15,7 @@
use acadrust::entities::Polyline3D;
use acadrust::types::Vector3;
use acadrust::EntityType;
use crate::t;
use crate::command::{CadCommand, CmdResult, DynField};
use crate::modules::{IconKind, ModuleEvent, ToolDef};
@@ -115,11 +116,11 @@ impl CadCommand for HelixCommand {
fn prompt(&self) -> String {
match self.step {
Step::Center => "HELIX Specify centre point of base:".to_string(),
Step::BaseRadius => "HELIX Specify base radius:".to_string(),
Step::TopRadius => "HELIX Specify top radius <same as base>:".to_string(),
Step::Height => "HELIX Specify helix height:".to_string(),
Step::Turns => "HELIX Enter number of turns <3>:".to_string(),
Step::Center => t!("HELIX Specify centre point of base:").into_owned(),
Step::BaseRadius => t!("HELIX Specify base radius:").into_owned(),
Step::TopRadius => t!("HELIX Specify top radius <same as base>:").into_owned(),
Step::Height => t!("HELIX Specify helix height:").into_owned(),
Step::Turns => t!("HELIX Enter number of turns <3>:").into_owned(),
}
}
+4 -3
View File
@@ -8,6 +8,7 @@
use acadrust::types::Vector3;
use acadrust::{EntityType, Line};
use crate::t;
use crate::command::{CadCommand, CmdResult, TangentObject};
use crate::modules::{IconKind, ModuleEvent, ToolDef};
@@ -64,9 +65,9 @@ impl CadCommand for LineCommand {
fn prompt(&self) -> String {
match self.points.len() {
0 => "LINE Specify first point:".to_string(),
1 => "LINE Specify next point [Undo]:".to_string(),
_ => "LINE Specify next point [Close/Undo]:".to_string(),
0 => t!("LINE Specify first point:").into_owned(),
1 => t!("LINE Specify next point [Undo]:").into_owned(),
_ => t!("LINE Specify next point [Close/Undo]:").into_owned(),
}
}
+12 -6
View File
@@ -9,6 +9,7 @@ use acadrust::entities::MLine;
use acadrust::types::Vector3;
use acadrust::EntityType;
use glam::DVec3;
use crate::t;
use crate::command::{CadCommand, CmdResult};
use crate::scene::model::wire_model::WireModel;
@@ -48,14 +49,19 @@ impl CadCommand for MlineCommand {
fn prompt(&self) -> String {
if self.waiting_scale {
"MLINE Enter scale factor:".into()
t!("MLINE Enter scale factor:").into_owned()
} else if self.points.is_empty() {
format!("MLINE Specify start point (scale={:.2}):", self.scale)
} else {
format!(
"MLINE Specify next point ({} pts, Enter to finish, C to close, S to set scale):",
self.points.len()
t!(
"MLINE Specify start point (scale=%{scale}):",
scale = format!("{:.2}", self.scale)
)
.into_owned()
} else {
t!(
"MLINE Specify next point (%{count} pts, Enter to finish, C to close, S to set scale):",
count = self.points.len()
)
.into_owned()
}
}
+3 -2
View File
@@ -5,6 +5,7 @@
use acadrust::types::Vector3;
use acadrust::{EntityType, Point as CadPoint};
use crate::t;
use crate::command::{CadCommand, CmdResult};
use crate::modules::{IconKind, ModuleEvent, ToolDef};
@@ -34,12 +35,12 @@ impl CadCommand for PointCommand {
"POINT"
}
fn prompt(&self) -> String {
"POINT Specify point:".into()
crate::t!("POINT Specify point:").into_owned()
}
fn options(&self) -> Vec<crate::command::CmdOption> {
use crate::command::CmdOption;
vec![CmdOption::enter("Done")]
vec![CmdOption::enter(t!("Done").as_ref())]
}
fn on_point(&mut self, pt: DVec3) -> CmdResult {
+4 -3
View File
@@ -10,6 +10,7 @@
use acadrust::entities::Polyline3D;
use acadrust::types::Vector3;
use acadrust::EntityType;
use crate::t;
use crate::command::{CadCommand, CmdResult};
use crate::modules::{IconKind, ModuleEvent, ToolDef};
@@ -65,9 +66,9 @@ impl CadCommand for Poly3dCommand {
fn prompt(&self) -> String {
match self.points.len() {
0 => "3DPOLY Specify start point of polyline:".to_string(),
1 => "3DPOLY Specify next point [Undo]:".to_string(),
_ => "3DPOLY Specify next point [Close/Undo]:".to_string(),
0 => t!("3DPOLY Specify start point of polyline:").into_owned(),
1 => t!("3DPOLY Specify next point [Undo]:").into_owned(),
_ => t!("3DPOLY Specify next point [Close/Undo]:").into_owned(),
}
}
+14 -11
View File
@@ -13,6 +13,7 @@ use acadrust::entities::LwVertex;
use acadrust::types::Vector2;
use acadrust::{EntityType, Handle, LwPolyline};
use glam::{DVec2, DVec3, Vec2, Vec3};
use crate::t;
use crate::command::{CadCommand, CmdResult};
use crate::modules::{IconKind, ModuleEvent, ToolDef};
@@ -255,16 +256,18 @@ impl CadCommand for PlineCommand {
fn prompt(&self) -> String {
let mode_tag = match self.mode {
SegMode::Line => "Line",
SegMode::Arc => "Arc",
SegMode::Line => t!("Line"),
SegMode::Arc => t!("Arc"),
};
if self.vertices.is_empty() {
"PLINE Specify start point:".into()
t!("PLINE Specify start point:").into_owned()
} else {
format!(
"PLINE [{mode_tag}] Next pt [{}pts]:",
self.vertices.len()
t!(
"PLINE [%{mode}] Next pt [%{count}pts]:",
mode = mode_tag,
count = self.vertices.len()
)
.into_owned()
}
}
@@ -276,11 +279,11 @@ impl CadCommand for PlineCommand {
Vec::new()
} else {
vec![
CmdOption::new("Arc", "A"),
CmdOption::new("Line", "L"),
CmdOption::new("Close", "C"),
CmdOption::new("Undo", "U"),
CmdOption::enter("Done"),
CmdOption::new(t!("Arc").as_ref(), "A"),
CmdOption::new(t!("Line").as_ref(), "L"),
CmdOption::new(t!("Close").as_ref(), "C"),
CmdOption::new(t!("Undo").as_ref(), "U"),
CmdOption::enter(t!("Done").as_ref()),
]
}
}
+6 -4
View File
@@ -10,6 +10,7 @@ use acadrust::entities::RasterImage;
use acadrust::types::Vector3;
use acadrust::EntityType;
use glam::DVec3;
use crate::t;
use crate::command::{CadCommand, CmdResult};
use crate::scene::model::wire_model::WireModel;
@@ -66,12 +67,13 @@ impl CadCommand for ImageCommand {
fn prompt(&self) -> String {
if self.origin.is_none() {
format!(
"IMAGE Specify insertion point ({}): ",
short_name(&self.file_path)
t!(
"IMAGE Specify insertion point (%{name}): ",
name = short_name(&self.file_path)
)
.into_owned()
} else {
"IMAGE Specify width (drag right):".into()
t!("IMAGE Specify width (drag right):").into_owned()
}
}
+7 -6
View File
@@ -7,6 +7,7 @@
use acadrust::entities::{Ray as RayEnt, XLine as XLineEnt};
use acadrust::types::Vector3;
use acadrust::EntityType;
use crate::t;
use crate::command::{CadCommand, CmdResult};
use crate::scene::model::wire_model::WireModel;
@@ -33,16 +34,16 @@ impl CadCommand for RayCommand {
fn prompt(&self) -> String {
if self.base.is_none() {
"RAY Specify start point:".into()
crate::t!("RAY Specify start point:").into_owned()
} else {
"RAY Specify through point:".into()
crate::t!("RAY Specify through point:").into_owned()
}
}
fn options(&self) -> Vec<crate::command::CmdOption> {
use crate::command::CmdOption;
if self.base.is_some() {
vec![CmdOption::enter("Done")]
vec![CmdOption::enter(t!("Done").as_ref())]
} else {
vec![]
}
@@ -132,16 +133,16 @@ impl CadCommand for XLineCommand {
fn prompt(&self) -> String {
if self.base.is_none() {
"XLINE Specify a point:".into()
t!("XLINE Specify a point:").into_owned()
} else {
"XLINE Specify through point:".into()
t!("XLINE Specify through point:").into_owned()
}
}
fn options(&self) -> Vec<crate::command::CmdOption> {
use crate::command::CmdOption;
if self.base.is_some() {
vec![CmdOption::enter("Done")]
vec![CmdOption::enter(t!("Done").as_ref())]
} else {
vec![]
}
+9 -6
View File
@@ -8,6 +8,7 @@ use acadrust::entities::LwPolyline;
use acadrust::types::Vector2;
use acadrust::{entities::LwVertex, EntityType};
use glam::DVec3;
use crate::t;
use crate::command::{CadCommand, CmdResult};
use crate::modules::{IconKind, ModuleEvent, ToolDef};
@@ -47,15 +48,17 @@ impl CadCommand for RevCloudCommand {
fn prompt(&self) -> String {
if self.points.is_empty() {
format!(
"REVCLOUD Specify start point (arc length = {:.2}):",
self.arc_length
t!(
"REVCLOUD Specify start point (arc length = %{arc_length}):",
arc_length = format!("{:.2}", self.arc_length)
)
.into_owned()
} else {
format!(
"REVCLOUD Specify next point ({} pts, Enter to close):",
self.points.len()
t!(
"REVCLOUD Specify next point (%{count} pts, Enter to close):",
count = self.points.len()
)
.into_owned()
}
}
+38 -24
View File
@@ -13,6 +13,7 @@
use acadrust::entities::LwVertex;
use acadrust::types::Vector2;
use acadrust::{EntityType, LwPolyline};
use crate::t;
use crate::command::{CadCommand, CmdResult};
use crate::modules::IconKind;
@@ -165,9 +166,9 @@ impl CadCommand for RectCommand {
}
fn prompt(&self) -> String {
if self.a.is_none() {
"RECT Specify first corner:".into()
crate::t!("RECT Specify first corner:").into_owned()
} else {
"RECT Specify opposite corner:".into()
crate::t!("RECT Specify opposite corner:").into_owned()
}
}
@@ -278,9 +279,9 @@ impl CadCommand for RectRotCommand {
}
fn prompt(&self) -> String {
match self.step {
0 => "RECT ROT Specify first corner:".into(),
1 => "RECT ROT Specify adjacent corner (defines edge direction):".into(),
_ => "RECT ROT Specify height (perpendicular pick):".into(),
0 => crate::t!("RECT ROT Specify first corner:").into_owned(),
1 => crate::t!("RECT ROT Specify adjacent corner (defines edge direction):").into_owned(),
_ => crate::t!("RECT ROT Specify height (perpendicular pick):").into_owned(),
}
}
fn on_point(&mut self, pt: DVec3) -> CmdResult {
@@ -386,9 +387,9 @@ impl CadCommand for RectCenCommand {
}
fn prompt(&self) -> String {
if self.center.is_none() {
"RECT CEN Specify center point:".into()
t!("RECT CEN Specify center point:").into_owned()
} else {
"RECT CEN Specify corner point:".into()
t!("RECT CEN Specify corner point:").into_owned()
}
}
fn on_point(&mut self, pt: DVec3) -> CmdResult {
@@ -530,12 +531,13 @@ impl CadCommand for PolyCommand {
fn prompt(&self) -> String {
match self.step {
0 => format!("POLYGON Enter number of sides <{}>:", self.sides),
1 => format!("POLYGON Specify center [{} sides]:", self.sides),
_ => format!(
0 => crate::tf!("POLYGON Enter number of sides <{}>:", self.sides).into_owned(),
1 => crate::tf!("POLYGON Specify center [{} sides]:", self.sides).into_owned(),
_ => crate::tf!(
"POLYGON Specify vertex on circle [{} sides inscribed]:",
self.sides
),
)
.into_owned(),
}
}
@@ -644,12 +646,13 @@ impl CadCommand for PolyCCommand {
fn prompt(&self) -> String {
match self.step {
0 => format!("POLYGON C Enter number of sides <{}>:", self.sides),
1 => format!("POLYGON C Specify center [{} sides]:", self.sides),
_ => format!(
0 => crate::tf!("POLYGON C Enter number of sides <{}>:", self.sides).into_owned(),
1 => crate::tf!("POLYGON C Specify center [{} sides]:", self.sides).into_owned(),
_ => crate::tf!(
"POLYGON C Specify edge-midpoint radius [{} sides circumscribed]:",
self.sides
),
)
.into_owned(),
}
}
@@ -753,15 +756,26 @@ impl CadCommand for PolyECommand {
fn prompt(&self) -> String {
match self.step {
0 => format!("POLYGON E Enter number of sides <{}>:", self.sides),
1 => format!(
"POLYGON E Specify first endpoint of edge [{} sides]:",
self.sides
),
_ => format!(
"POLYGON E Specify second endpoint of edge [{} sides]:",
self.sides
),
0 => {
let n = self.sides;
t!("POLYGON E Enter number of sides <%{n}>:", n = n).into_owned()
}
1 => {
let n = self.sides;
t!(
"POLYGON E Specify first endpoint of edge [%{n} sides]:",
n = n
)
.into_owned()
}
_ => {
let n = self.sides;
t!(
"POLYGON E Specify second endpoint of edge [%{n} sides]:",
n = n
)
.into_owned()
}
}
}
+3 -2
View File
@@ -15,6 +15,7 @@
use acadrust::entities::{LwPolyline, LwVertex};
use acadrust::types::{Vector2, Vector3};
use acadrust::EntityType;
use crate::t;
use crate::command::{CadCommand, CmdResult};
use crate::modules::{IconKind, ModuleEvent, ToolDef};
@@ -88,9 +89,9 @@ impl CadCommand for SketchCommand {
fn prompt(&self) -> String {
if self.pen_down {
"SKETCH Pen down — move to sketch, click to lift, Enter to record:".to_string()
t!("SKETCH Pen down — move to sketch, click to lift, Enter to record:").into_owned()
} else {
"SKETCH Pen up — click to lower the pen, Enter to record:".to_string()
t!("SKETCH Pen up — click to lower the pen, Enter to record:").into_owned()
}
}
+6 -5
View File
@@ -10,6 +10,7 @@
use acadrust::entities::Solid;
use acadrust::types::Vector3;
use acadrust::EntityType;
use crate::t;
use crate::command::{CadCommand, CmdResult};
use crate::modules::{IconKind, ModuleEvent, ToolDef};
@@ -91,10 +92,10 @@ impl CadCommand for Solid2dCommand {
fn prompt(&self) -> String {
match self.points.len() {
0 => "SOLID Specify first point:".to_string(),
1 => "SOLID Specify second point:".to_string(),
2 => "SOLID Specify third point:".to_string(),
_ => "SOLID Specify fourth point:".to_string(),
0 => t!("SOLID Specify first point:").into_owned(),
1 => t!("SOLID Specify second point:").into_owned(),
2 => t!("SOLID Specify third point:").into_owned(),
_ => t!("SOLID Specify fourth point:").into_owned(),
}
}
@@ -102,7 +103,7 @@ impl CadCommand for Solid2dCommand {
use crate::command::CmdOption;
// After three corners Enter commits a triangle; offer a Done button.
if self.points.len() == 3 {
vec![CmdOption::enter("Done")]
vec![CmdOption::enter(t!("Done").as_ref())]
} else {
Vec::new()
}
+7 -5
View File
@@ -5,6 +5,7 @@
use acadrust::types::Vector3;
use acadrust::{EntityType, Spline};
use crate::t;
use crate::command::{CadCommand, CmdResult};
use crate::modules::{IconKind, ModuleEvent, ToolDef};
@@ -110,9 +111,10 @@ impl CadCommand for SplineCommand {
fn prompt(&self) -> String {
if self.pts.is_empty() {
"SPLINE Specify first control point:".into()
t!("SPLINE Specify first control point:").into_owned()
} else {
format!("SPLINE Specify next point [{} pts]:", self.pts.len())
let n = self.pts.len();
t!("SPLINE Specify next point [%{n} pts]:", n = n).into_owned()
}
}
@@ -121,10 +123,10 @@ impl CadCommand for SplineCommand {
if self.pts.is_empty() {
return Vec::new();
}
let mut opts = vec![CmdOption::new("Close", "C")];
let mut opts = vec![CmdOption::new(t!("Close").as_ref(), "C")];
// Undo only makes sense once a control point exists.
opts.push(CmdOption::new("Undo", "U"));
opts.push(CmdOption::enter("Done"));
opts.push(CmdOption::new(t!("Undo").as_ref(), "U"));
opts.push(CmdOption::enter(t!("Done").as_ref()));
opts
}
+6 -4
View File
@@ -14,6 +14,7 @@
use acadrust::entities::{LwPolyline, LwVertex};
use acadrust::types::{Vector2, Vector3};
use acadrust::EntityType;
use crate::t;
use crate::command::{CadCommand, CmdResult};
use crate::modules::{IconKind, ModuleEvent, ToolDef};
@@ -88,12 +89,13 @@ impl CadCommand for TraceCommand {
fn prompt(&self) -> String {
if !self.width_set {
return format!("TRACE Specify trace width <{:.4}>:", self.width);
let w = format!("{:.4}", self.width);
return t!("TRACE Specify trace width <%{w}>:", w = w).into_owned();
}
match self.points.len() {
0 => "TRACE Specify start point:".to_string(),
1 => "TRACE Specify next point [Undo]:".to_string(),
_ => "TRACE Specify next point [Undo]:".to_string(),
0 => t!("TRACE Specify start point:").into_owned(),
1 => t!("TRACE Specify next point [Undo]:").into_owned(),
_ => t!("TRACE Specify next point [Undo]:").into_owned(),
}
}
+16 -11
View File
@@ -4,6 +4,7 @@ use acadrust::entities::{Wipeout, WipeoutClipType};
use acadrust::types::{Vector2, Vector3};
use acadrust::{EntityType, Handle};
use glam::DVec3;
use crate::t;
use crate::command::{CadCommand, CmdOption, CmdResult};
use crate::modules::{IconKind, ModuleEvent, ToolDef};
@@ -80,20 +81,24 @@ impl CadCommand for WipeoutCommand {
fn prompt(&self) -> String {
match self.mode {
WipeoutMode::Draw if self.points.is_empty() => {
"WIPEOUT Specify first point or [Polyline]:".into()
t!("WIPEOUT Specify first point or [Polyline]:").into_owned()
}
WipeoutMode::Draw => {
let n = self.points.len();
t!(
"WIPEOUT Specify next point or [Undo/Close] (%{n} points):",
n = n
)
.into_owned()
}
WipeoutMode::Draw => format!(
"WIPEOUT Specify next point or [Undo/Close] ({} points):",
self.points.len()
),
WipeoutMode::Polyline => {
"WIPEOUT Polyline Select a closed planar polyline:".into()
t!("WIPEOUT Polyline Select a closed planar polyline:").into_owned()
}
WipeoutMode::Rectangular if self.first.is_none() => {
"WIPEOUT Rectangular Specify first corner:".into()
t!("WIPEOUT Rectangular Specify first corner:").into_owned()
}
WipeoutMode::Rectangular => {
"WIPEOUT Rectangular Specify opposite corner:".into()
t!("WIPEOUT Rectangular Specify opposite corner:").into_owned()
}
}
}
@@ -101,11 +106,11 @@ impl CadCommand for WipeoutCommand {
fn options(&self) -> Vec<CmdOption> {
match self.mode {
WipeoutMode::Draw if self.points.is_empty() => {
vec![CmdOption::new("Polyline", "P")]
vec![CmdOption::new(t!("Polyline").as_ref(), "P")]
}
WipeoutMode::Draw => vec![
CmdOption::new("Undo", "U"),
CmdOption::new("Close", "C"),
CmdOption::new(t!("Undo").as_ref(), "U"),
CmdOption::new(t!("Close").as_ref(), "C"),
],
_ => Vec::new(),
}
+3 -1
View File
@@ -15,6 +15,7 @@ pub fn tool() -> ToolDef {
use acadrust::Handle;
use glam::DVec3;
use crate::t;
use crate::command::{CadCommand, CmdResult};
use crate::scene::model::wire_model::WireModel;
@@ -37,7 +38,8 @@ impl CadCommand for GroupCommand {
}
fn prompt(&self) -> String {
format!("GROUP Enter group name [{}]:", self.auto_name)
let name = self.auto_name.clone();
t!("GROUP Enter group name [%{name}]:", name = name).into_owned()
}
fn wants_text_input(&self) -> bool {
+2 -1
View File
@@ -15,6 +15,7 @@ pub fn tool() -> ToolDef {
use acadrust::Handle;
use glam::DVec3;
use crate::t;
use crate::command::{CadCommand, CmdResult};
use crate::scene::model::wire_model::WireModel;
@@ -33,7 +34,7 @@ impl CadCommand for UngroupCommand {
}
fn prompt(&self) -> String {
"UNGROUP Select grouped objects:".into()
t!("UNGROUP Select grouped objects:").into_owned()
}
fn is_selection_gathering(&self) -> bool {
+15 -5
View File
@@ -2,6 +2,7 @@
// Press Enter to close and calculate.
use glam::DVec3;
use crate::t;
use crate::command::{CadCommand, CmdResult};
use crate::scene::model::wire_model::WireModel;
@@ -23,12 +24,14 @@ impl CadCommand for AreaCommand {
fn prompt(&self) -> String {
if self.points.is_empty() {
"AREA Specify first corner point (Enter to cancel):".into()
t!("AREA Specify first corner point (Enter to cancel):").into_owned()
} else {
format!(
"AREA Specify next point ({} picked, Enter to calculate):",
self.points.len()
let n = self.points.len();
t!(
"AREA Specify next point (%{n} picked, Enter to calculate):",
n = n
)
.into_owned()
}
}
@@ -56,7 +59,14 @@ impl CadCommand for AreaCommand {
perimeter += (self.points[(idx + 1) % n] - self.points[idx]).length();
}
let area = (area_sum * 0.5).abs();
let msg = format!("Area = {area:.4}, Perimeter = {perimeter:.4}");
let area_s = format!("{area:.4}");
let perimeter_s = format!("{perimeter:.4}");
let msg = t!(
"Area = %{area}, Perimeter = %{perimeter}",
area = area_s,
perimeter = perimeter_s
)
.into_owned();
CmdResult::Measurement(msg)
}
+19 -5
View File
@@ -1,6 +1,7 @@
// DIST command — measure distance and angle between two picked points.
use glam::DVec3;
use crate::t;
use crate::command::{CadCommand, CmdResult};
use crate::scene::model::wire_model::WireModel;
@@ -25,9 +26,9 @@ impl CadCommand for DistCommand {
fn prompt(&self) -> String {
if self.first.is_none() {
"DIST Specify first point:".into()
t!("DIST Specify first point:").into_owned()
} else {
"DIST Specify second point:".into()
t!("DIST Specify second point:").into_owned()
}
}
@@ -45,9 +46,22 @@ impl CadCommand for DistCommand {
let dist_xy = dx.hypot(dy);
let angle_z = dz.atan2(dist_xy).to_degrees();
let msg = format!(
"Distance = {dist:.4}, Angle in XY Plane = {angle_xy:.4}°, Angle from XY Plane = {angle_z:.4}°\n Delta X = {dx:.4}, Delta Y = {dy:.4}, Delta Z = {dz:.4}",
);
let dist_s = format!("{dist:.4}");
let angle_xy_s = format!("{angle_xy:.4}");
let angle_z_s = format!("{angle_z:.4}");
let dx_s = format!("{dx:.4}");
let dy_s = format!("{dy:.4}");
let dz_s = format!("{dz:.4}");
let msg = t!(
"Distance = %{dist}, Angle in XY Plane = %{angle_xy}°, Angle from XY Plane = %{angle_z}°\n Delta X = %{dx}, Delta Y = %{dy}, Delta Z = %{dz}",
dist = dist_s,
angle_xy = angle_xy_s,
angle_z = angle_z_s,
dx = dx_s,
dy = dy_s,
dz = dz_s,
)
.into_owned();
CmdResult::Measurement(msg)
} else {
self.first = Some(pt);
+5 -4
View File
@@ -7,6 +7,7 @@ use acadrust::entities::Point as PointEnt;
use acadrust::types::Vector3;
use acadrust::{EntityType, Handle};
use glam::DVec3;
use crate::t;
use crate::command::{CadCommand, CmdResult};
@@ -33,9 +34,9 @@ impl CadCommand for DivideCommand {
fn prompt(&self) -> String {
if self.target.is_none() {
"DIVIDE Select object to divide:".into()
t!("DIVIDE Select object to divide:").into_owned()
} else {
"DIVIDE Enter number of segments:".into()
t!("DIVIDE Enter number of segments:").into_owned()
}
}
@@ -102,9 +103,9 @@ impl CadCommand for MeasureCommand {
fn prompt(&self) -> String {
if self.target.is_none() {
"MEASURE Select object to measure:".into()
t!("MEASURE Select object to measure:").into_owned()
} else {
"MEASURE Specify segment length:".into()
t!("MEASURE Specify segment length:").into_owned()
}
}
+12 -2
View File
@@ -1,6 +1,7 @@
// ID command — report coordinates of a picked point.
use glam::DVec3;
use crate::t;
use crate::command::{CadCommand, CmdResult};
@@ -18,7 +19,7 @@ impl CadCommand for IdCommand {
}
fn prompt(&self) -> String {
"ID Specify point:".into()
t!("ID Specify point:").into_owned()
}
fn on_point(&mut self, pt: DVec3) -> CmdResult {
@@ -26,7 +27,16 @@ impl CadCommand for IdCommand {
let x = pt.x;
let y = pt.y;
let z = pt.z;
let msg = format!("X = {x:.4}, Y = {y:.4}, Z = {z:.4}");
let x_s = format!("{x:.4}");
let y_s = format!("{y:.4}");
let z_s = format!("{z:.4}");
let msg = t!(
"X = %{x}, Y = %{y}, Z = %{z}",
x = x_s,
y = y_s,
z = z_s
)
.into_owned();
CmdResult::Measurement(msg)
}
+48 -19
View File
@@ -16,6 +16,7 @@
use acadrust::{EntityType, Handle};
use glam::DVec3;
use crate::t;
use crate::command::{CadCommand, CmdResult};
use crate::modules::{IconKind, ModuleEvent, ToolDef};
@@ -112,9 +113,20 @@ impl MeasureGeomCommand {
let dy = delta.y; // drawing plane is world XY
let dz = delta.z; // elevation
let angle_xy = dy.atan2(dx).to_degrees();
format!(
"Distance = {dist:.4}, Angle in XY Plane = {angle_xy:.4}°\n Delta X = {dx:.4}, Delta Y = {dy:.4}, Delta Z = {dz:.4}",
let dist_s = format!("{dist:.4}");
let angle_xy_s = format!("{angle_xy:.4}");
let dx_s = format!("{dx:.4}");
let dy_s = format!("{dy:.4}");
let dz_s = format!("{dz:.4}");
t!(
"Distance = %{dist}, Angle in XY Plane = %{angle_xy}°\n Delta X = %{dx}, Delta Y = %{dy}, Delta Z = %{dz}",
dist = dist_s,
angle_xy = angle_xy_s,
dx = dx_s,
dy = dy_s,
dz = dz_s,
)
.into_owned()
}
/// AREA readout: shoelace area (f64, relative to first vertex) + perimeter.
@@ -130,7 +142,14 @@ impl MeasureGeomCommand {
perimeter += (points[(idx + 1) % n] - points[idx]).length();
}
let area = (area_sum * 0.5).abs();
format!("Area = {area:.4}, Perimeter = {perimeter:.4}")
let area_s = format!("{area:.4}");
let perimeter_s = format!("{perimeter:.4}");
t!(
"Area = %{area}, Perimeter = %{perimeter}",
area = area_s,
perimeter = perimeter_s
)
.into_owned()
}
/// ANGLE readout: angle at `vertex` between the rays to `a` and `b`.
@@ -140,11 +159,12 @@ impl MeasureGeomCommand {
let la = va.length();
let lb = vb.length();
if la == 0.0 || lb == 0.0 {
return "Angle = 0.0000° (degenerate rays)".to_string();
return t!("Angle = 0.0000° (degenerate rays)").into_owned();
}
let cos = (va.dot(vb) / (la * lb)).clamp(-1.0, 1.0);
let angle = cos.acos().to_degrees();
format!("Angle = {angle:.4}°")
let angle_s = format!("{angle:.4}");
t!("Angle = %{angle}°", angle = angle_s).into_owned()
}
}
@@ -156,31 +176,33 @@ impl CadCommand for MeasureGeomCommand {
fn prompt(&self) -> String {
match self.mode {
Mode::Choose => {
"MEASUREGEOM Enter an option [Distance/Radius/Angle/ARea]:".into()
t!("MEASUREGEOM Enter an option [Distance/Radius/Angle/ARea]:").into_owned()
}
Mode::Distance => {
if self.points.is_empty() {
"MEASUREGEOM Specify first point:".into()
t!("MEASUREGEOM Specify first point:").into_owned()
} else {
"MEASUREGEOM Specify second point:".into()
t!("MEASUREGEOM Specify second point:").into_owned()
}
}
Mode::Area => {
if self.points.is_empty() {
"MEASUREGEOM Specify first corner point (Enter to cancel):".into()
t!("MEASUREGEOM Specify first corner point (Enter to cancel):").into_owned()
} else {
format!(
"MEASUREGEOM Specify next point ({} picked, Enter to calculate):",
self.points.len()
let n = self.points.len();
t!(
"MEASUREGEOM Specify next point (%{n} picked, Enter to calculate):",
n = n
)
.into_owned()
}
}
Mode::Angle => match self.points.len() {
0 => "MEASUREGEOM Specify vertex point:".into(),
1 => "MEASUREGEOM Specify first ray point:".into(),
_ => "MEASUREGEOM Specify second ray point:".into(),
0 => t!("MEASUREGEOM Specify vertex point:").into_owned(),
1 => t!("MEASUREGEOM Specify first ray point:").into_owned(),
_ => t!("MEASUREGEOM Specify second ray point:").into_owned(),
},
Mode::Radius => "MEASUREGEOM Select arc or circle:".into(),
Mode::Radius => t!("MEASUREGEOM Select arc or circle:").into_owned(),
}
}
@@ -223,9 +245,16 @@ impl CadCommand for MeasureGeomCommand {
match self.picked.as_ref().and_then(Self::radius_of) {
Some(radius) => {
let diameter = radius * 2.0;
CmdResult::Measurement(format!(
"Radius = {radius:.4}, Diameter = {diameter:.4}"
))
let radius_s = format!("{radius:.4}");
let diameter_s = format!("{diameter:.4}");
CmdResult::Measurement(
t!(
"Radius = %{radius}, Diameter = %{diameter}",
radius = radius_s,
diameter = diameter_s
)
.into_owned(),
)
}
// Picked something that is not a circle or arc — keep prompting.
None => CmdResult::NeedPoint,
+2 -2
View File
@@ -38,9 +38,9 @@ impl CadCommand for LayMatchCommand {
fn prompt(&self) -> String {
if self.dest_handles.is_empty() {
"LAYMATCH Select objects to change layer:".into()
crate::t!("LAYMATCH Select objects to change layer:").into_owned()
} else {
"LAYMATCH Select source object to match layer from:".into()
crate::t!("LAYMATCH Select source object to match layer from:").into_owned()
}
}
+15 -9
View File
@@ -11,6 +11,7 @@
use acadrust::Handle;
use glam::DVec3;
use crate::t;
use crate::command::{CadCommand, CmdResult, EntityTransform};
@@ -53,15 +54,20 @@ impl CadCommand for AlignCommand {
fn prompt(&self) -> String {
match self.state {
AlignState::Gathering => format!(
"ALIGN Select objects ({} selected, Enter when done):",
self.handles.len()
),
AlignState::Src1 => "ALIGN Specify 1st source point:".into(),
AlignState::Dst1 => "ALIGN Specify 1st destination point:".into(),
AlignState::Src2 => "ALIGN Specify 2nd source point (Enter = translate only):".into(),
AlignState::Dst2 => "ALIGN Specify 2nd destination point:".into(),
AlignState::AskScale => "ALIGN Scale objects based on alignment points? [Y/N]:".into(),
AlignState::Gathering => t!(
"ALIGN Select objects (%{count} selected, Enter when done):",
count = self.handles.len()
)
.into_owned(),
AlignState::Src1 => t!("ALIGN Specify 1st source point:").into_owned(),
AlignState::Dst1 => t!("ALIGN Specify 1st destination point:").into_owned(),
AlignState::Src2 => {
t!("ALIGN Specify 2nd source point (Enter = translate only):").into_owned()
}
AlignState::Dst2 => t!("ALIGN Specify 2nd destination point:").into_owned(),
AlignState::AskScale => {
t!("ALIGN Scale objects based on alignment points? [Y/N]:").into_owned()
}
}
}
+64 -26
View File
@@ -15,6 +15,7 @@
use acadrust::Handle;
use glam::{DVec3, Mat4};
use crate::t;
use crate::command::{CadCommand, CmdResult, EntityTransform};
use crate::modules::draw::defaults;
@@ -114,19 +115,24 @@ impl CadCommand for ArrayRectCommand {
fn prompt(&self) -> String {
match self.step {
RectStep::Rows => format!("ARRAYRECT Enter row count <{}>:", self.default_rows),
RectStep::Cols { rows } => format!(
RectStep::Rows => {
crate::tf!("ARRAYRECT Enter row count <{}>:", self.default_rows).into_owned()
}
RectStep::Cols { rows } => crate::tf!(
"ARRAYRECT Enter column count <{}> [{rows} rows]:",
self.default_cols
),
RectStep::RowSp { rows, cols } => format!(
)
.into_owned(),
RectStep::RowSp { rows, cols } => crate::tf!(
"ARRAYRECT Row spacing <{:.0}> [{rows}×{cols}]:",
self.default_row_sp
),
RectStep::ColSp { rows, cols, row_sp } => format!(
)
.into_owned(),
RectStep::ColSp { rows, cols, row_sp } => crate::tf!(
"ARRAYRECT Column spacing <{:.0}> [{rows}×{cols}, row={row_sp:.0}]:",
self.default_col_sp
),
)
.into_owned(),
}
}
@@ -277,17 +283,19 @@ impl CadCommand for ArrayPolarCommand {
fn prompt(&self) -> String {
match &self.step {
PolarStep::Center => format!(
PolarStep::Center => crate::tf!(
"ARRAYPOLAR Specify center point [{} objects]:",
self.handles.len()
),
)
.into_owned(),
PolarStep::Count { .. } => {
format!("ARRAYPOLAR Enter item count <{}>:", self.default_count)
crate::tf!("ARRAYPOLAR Enter item count <{}>:", self.default_count).into_owned()
}
PolarStep::Angle { count, .. } => format!(
PolarStep::Angle { count, .. } => crate::tf!(
"ARRAYPOLAR Enter total angle in degrees <{:.0}> [{count} items]:",
self.default_angle
),
)
.into_owned(),
}
}
@@ -699,12 +707,13 @@ impl CadCommand for ArrayPathCommand {
fn prompt(&self) -> String {
match &self.step {
PathStep::SelectPath => format!(
PathStep::SelectPath => crate::tf!(
"ARRAYPATH Select path entity [{} objects]:",
self.handles.len()
),
)
.into_owned(),
PathStep::Count { .. } => {
format!("ARRAYPATH Enter item count <{}>:", self.default_count)
crate::tf!("ARRAYPATH Enter item count <{}>:", self.default_count).into_owned()
}
}
}
@@ -911,29 +920,58 @@ impl CadCommand for Array3DCommand {
fn prompt(&self) -> String {
match self.step {
Array3DStep::Rows => "ARRAY3D Enter row count:".into(),
Array3DStep::Cols { rows } => format!("ARRAY3D Enter column count [{rows} rows]:"),
Array3DStep::Levels { rows, cols } => {
format!("ARRAY3D Enter level count [{rows}×{cols}]:")
}
Array3DStep::RowSp { rows, cols, levels } => {
format!("ARRAY3D Row spacing [{rows}×{cols}×{levels}]:")
Array3DStep::Rows => t!("ARRAY3D Enter row count:").into_owned(),
Array3DStep::Cols { rows } => {
t!("ARRAY3D Enter column count [%{rows} rows]:", rows = rows).into_owned()
}
Array3DStep::Levels { rows, cols } => t!(
"ARRAY3D Enter level count [%{rows}×%{cols}]:",
rows = rows,
cols = cols
)
.into_owned(),
Array3DStep::RowSp { rows, cols, levels } => t!(
"ARRAY3D Row spacing [%{rows}×%{cols}×%{levels}]:",
rows = rows,
cols = cols,
levels = levels
)
.into_owned(),
Array3DStep::ColSp {
rows,
cols,
levels,
row_sp,
} => format!("ARRAY3D Column spacing [{rows}×{cols}×{levels}, row={row_sp:.0}]:"),
} => {
let rs = format!("{:.0}", row_sp);
t!(
"ARRAY3D Column spacing [%{rows}×%{cols}×%{levels}, row=%{rs}]:",
rows = rows,
cols = cols,
levels = levels,
rs = rs
)
.into_owned()
}
Array3DStep::LvlSp {
rows,
cols,
levels,
row_sp,
col_sp,
} => format!(
"ARRAY3D Level spacing [{rows}×{cols}×{levels}, r={row_sp:.0} c={col_sp:.0}]:"
),
} => {
let rs = format!("{:.0}", row_sp);
let cs = format!("{:.0}", col_sp);
t!(
"ARRAY3D Level spacing [%{rows}×%{cols}×%{levels}, r=%{rs} c=%{cs}]:",
rows = rows,
cols = cols,
levels = levels,
rs = rs,
cs = cs
)
.into_owned()
}
}
}
+2 -1
View File
@@ -8,6 +8,7 @@
// directly and never starts this command (see `app::commands::inquiry`).
use glam::DVec3;
use crate::t;
use crate::command::{CadCommand, CmdResult};
use crate::scene::model::wire_model::WireModel;
@@ -29,7 +30,7 @@ impl CadCommand for AtteditCommand {
}
fn prompt(&self) -> String {
"ATTEDIT Select block with attributes:".to_string()
t!("ATTEDIT Select block with attributes:").into_owned()
}
fn needs_entity_pick(&self) -> bool {
+28 -15
View File
@@ -9,6 +9,7 @@ use acadrust::entities::{EntityCommon, Spline};
use acadrust::types::Vector3;
use acadrust::{EntityType, Handle};
use glam::DVec3;
use crate::t;
use truck_modeling::base::{BoundedCurve, ParametricCurve, Vector4};
use truck_modeling::{BSplineCurve, KnotVec, NurbsCurve, Point3};
@@ -103,29 +104,41 @@ impl CadCommand for BlendCommand {
fn prompt(&self) -> String {
match self.step {
BlendStep::First => format!(
"BLEND Select first open curve [Continuity={}]:",
self.continuity.label()
),
BlendStep::Continuity { .. } => format!(
"BLEND Enter continuity [Tangent/Curvature] <{}>:",
self.continuity.label()
),
BlendStep::Second { .. } => format!(
"BLEND Select second open curve [Continuity={}]:",
self.continuity.label()
),
BlendStep::First => {
let c = self.continuity.label();
t!(
"BLEND Select first open curve [Continuity=%{c}]:",
c = c
)
.into_owned()
}
BlendStep::Continuity { .. } => {
let c = self.continuity.label();
t!(
"BLEND Enter continuity [Tangent/Curvature] <%{c}>:",
c = c
)
.into_owned()
}
BlendStep::Second { .. } => {
let c = self.continuity.label();
t!(
"BLEND Select second open curve [Continuity=%{c}]:",
c = c
)
.into_owned()
}
}
}
fn options(&self) -> Vec<CmdOption> {
match self.step {
BlendStep::First | BlendStep::Second { .. } => {
vec![CmdOption::new("Continuity", "C")]
vec![CmdOption::new(t!("Continuity").as_ref(), "C")]
}
BlendStep::Continuity { .. } => vec![
CmdOption::new("Tangent", "T"),
CmdOption::new("Curvature", "C"),
CmdOption::new(t!("Tangent").as_ref(), "T"),
CmdOption::new(t!("Curvature").as_ref(), "C"),
],
}
}
+1 -1
View File
@@ -94,7 +94,7 @@ impl CadCommand for BlockEditPickCommand {
"BEDIT"
}
fn prompt(&self) -> String {
"BEDIT Select block reference to edit:".into()
crate::t!("BEDIT Select block reference to edit:").into_owned()
}
fn needs_entity_pick(&self) -> bool {
true
+6 -5
View File
@@ -16,6 +16,7 @@ use acadrust::entities::{
use acadrust::types::Vector3;
use acadrust::{EntityType, Handle};
use glam::DVec3;
use crate::t;
use truck_modeling::base::{BoundedCurve, Cut};
use crate::command::{CadCommand, CmdResult};
@@ -366,11 +367,11 @@ impl CadCommand for BreakInteractiveCommand {
fn prompt(&self) -> String {
if self.target.is_none() {
"BREAK Select object:".into()
crate::t!("BREAK Select object:").into_owned()
} else if self.p1.is_none() {
"BREAK Specify first break point:".into()
crate::t!("BREAK Specify first break point:").into_owned()
} else {
"BREAK Specify second break point:".into()
crate::t!("BREAK Specify second break point:").into_owned()
}
}
@@ -430,9 +431,9 @@ impl CadCommand for BreakAtPointCommand {
fn prompt(&self) -> String {
if self.target.is_none() {
"BREAKATPOINT Select object:".into()
t!("BREAKATPOINT Select object:").into_owned()
} else {
"BREAKATPOINT Specify break point:".into()
t!("BREAKATPOINT Specify break point:").into_owned()
}
}
+2 -1
View File
@@ -29,6 +29,7 @@ use acadrust::{CadDocument, EntityType, Handle};
use crate::command::{CadCommand, CmdResult};
use crate::modules::{IconKind, ModuleEvent, ToolDef};
use glam::DVec3;
use crate::t;
// ── Ribbon definition ──────────────────────────────────────────────────────
@@ -1302,7 +1303,7 @@ impl CadCommand for ExplodeCommand {
"EXPLODE"
}
fn prompt(&self) -> String {
"EXPLODE Select objects to explode:".into()
t!("EXPLODE Select objects to explode:").into_owned()
}
fn on_point(&mut self, _pt: DVec3) -> CmdResult {
+44 -22
View File
@@ -13,6 +13,7 @@ use acadrust::entities::{Arc as ArcEnt, Line as LineEnt, LwPolyline};
use acadrust::types::Vector3;
use acadrust::{EntityType, Handle};
use glam::DVec3;
use crate::t;
const TAU: f64 = std::f64::consts::TAU;
@@ -1221,18 +1222,20 @@ impl CadCommand for FilletCommand {
fn prompt(&self) -> String {
match &self.step {
FilletStep::First => format!(
FilletStep::First => crate::tf!(
"FILLET Select first object (Line/Arc/LwPolyline) [R={:.4}]:",
self.radius
),
)
.into_owned(),
FilletStep::WaitingForRadius => {
format!("FILLET Enter fillet radius <{:.4}>:", self.radius)
crate::tf!("FILLET Enter fillet radius <{:.4}>:", self.radius).into_owned()
}
FilletStep::Second { .. } => {
format!(
crate::tf!(
"FILLET Select second object (Line/Arc/LwPolyline) [R={:.4}]:",
self.radius
)
.into_owned()
}
}
}
@@ -1604,25 +1607,44 @@ impl CadCommand for ChamferCommand {
fn prompt(&self) -> String {
match &self.step {
ChamferStep::First => format!(
"CHAMFER Select first line [D1={:.4} D2={:.4}]:",
self.dist1, self.dist2
),
ChamferStep::First => {
let d1 = format!("{:.4}", self.dist1);
let d2 = format!("{:.4}", self.dist2);
t!(
"CHAMFER Select first line [D1=%{d1} D2=%{d2}]:",
d1 = d1,
d2 = d2
)
.into_owned()
}
ChamferStep::WaitingForDist1 => {
format!("CHAMFER Enter first chamfer distance <{:.4}>:", self.dist1)
let d1 = format!("{:.4}", self.dist1);
t!("CHAMFER Enter first chamfer distance <%{d1}>:", d1 = d1).into_owned()
}
ChamferStep::WaitingForDist2 => {
let d2 = format!("{:.4}", self.dist2);
t!("CHAMFER Enter second chamfer distance <%{d2}>:", d2 = d2).into_owned()
}
ChamferStep::Second { .. } => {
let d1 = format!("{:.4}", self.dist1);
let d2 = format!("{:.4}", self.dist2);
t!(
"CHAMFER Select second line [D1=%{d1} D2=%{d2}]:",
d1 = d1,
d2 = d2
)
.into_owned()
}
ChamferStep::SecondPoly { .. } => {
let d1 = format!("{:.4}", self.dist1);
let d2 = format!("{:.4}", self.dist2);
t!(
"CHAMFER Select the adjacent polyline segment [D1=%{d1} D2=%{d2}]:",
d1 = d1,
d2 = d2
)
.into_owned()
}
ChamferStep::WaitingForDist2 => format!(
"CHAMFER Enter second chamfer distance <{:.4}>:",
self.dist2
),
ChamferStep::Second { .. } => format!(
"CHAMFER Select second line [D1={:.4} D2={:.4}]:",
self.dist1, self.dist2
),
ChamferStep::SecondPoly { .. } => format!(
"CHAMFER Select the adjacent polyline segment [D1={:.4} D2={:.4}]:",
self.dist1, self.dist2
),
}
}
@@ -1633,7 +1655,7 @@ impl CadCommand for ChamferCommand {
// is already handled by on_text_input.
ChamferStep::First
| ChamferStep::Second { .. }
| ChamferStep::SecondPoly { .. } => vec![CmdOption::new("Distance", "D")],
| ChamferStep::SecondPoly { .. } => vec![CmdOption::new(t!("Distance").as_ref(), "D")],
ChamferStep::WaitingForDist1 | ChamferStep::WaitingForDist2 => vec![],
}
}
+5 -3
View File
@@ -12,6 +12,7 @@
use acadrust::types::{Vector2, Vector3};
use acadrust::{EntityType, Handle};
use glam::DVec3;
use crate::t;
use crate::command::{CadCommand, CmdResult};
@@ -37,10 +38,11 @@ impl CadCommand for JoinCommand {
}
fn prompt(&self) -> String {
format!(
"JOIN Select objects to join ({} selected, Enter to apply):",
self.handles.len()
t!(
"JOIN Select objects to join (%{count} selected, Enter to apply):",
count = self.handles.len()
)
.into_owned()
}
fn is_selection_gathering(&self) -> bool {
+3 -2
View File
@@ -14,6 +14,7 @@ use acadrust::entities::{
use acadrust::types::Vector3;
use acadrust::{EntityType, Handle};
use glam::{DVec3, Vec3};
use crate::t;
use truck_modeling::base::{BoundedCurve, Cut};
use crate::command::{CadCommand, CmdResult};
@@ -42,9 +43,9 @@ impl CadCommand for LengthenCommand {
fn prompt(&self) -> String {
match &self.state {
LenState::PickEntity => "LENGTHEN Select object:".into(),
LenState::PickEntity => t!("LENGTHEN Select object:").into_owned(),
LenState::PickOption { .. } => {
"LENGTHEN Enter option [DE <delta> / TO <total> / P <pct>]:".into()
t!("LENGTHEN Enter option [DE <delta> / TO <total> / P <pct>]:").into_owned()
}
}
}
+19 -9
View File
@@ -10,6 +10,7 @@
use acadrust::Handle;
use glam::DVec3;
use crate::t;
use crate::command::{CadCommand, CmdResult, EntityTransform};
use crate::modules::{IconKind, ModuleEvent, ToolDef};
@@ -66,15 +67,24 @@ impl CadCommand for MirrorCommand {
fn prompt(&self) -> String {
match &self.step {
Step::P1 => format!(
"MIRROR Specify first mirror-line point [{} objects]:",
self.handles.len()
),
Step::P2(p1) => format!(
"MIRROR Specify second point [p1={:.2},{:.2}]:",
p1.x, p1.y
),
Step::AskErase { .. } => "MIRROR Erase source objects? [Yes/No] <No>:".to_string(),
Step::P1 => t!(
"MIRROR Specify first mirror-line point [%{count} objects]:",
count = self.handles.len()
)
.into_owned(),
Step::P2(p1) => {
let px = format!("{:.2}", p1.x);
let py = format!("{:.2}", p1.y);
t!(
"MIRROR Specify second point [p1=%{px},%{py}]:",
px = px,
py = py
)
.into_owned()
}
Step::AskErase { .. } => {
t!("MIRROR Erase source objects? [Yes/No] <No>:").into_owned()
}
}
}
+29 -14
View File
@@ -28,6 +28,7 @@ use cavalier_contours::polyline::{
Polyline as CavPolyline,
};
use glam::{DVec3, Vec3};
use crate::t;
use crate::command::{CadCommand, CmdResult};
use crate::modules::draw::defaults;
@@ -862,12 +863,12 @@ impl CadCommand for OffsetCommand {
fn prompt(&self) -> String {
match &self.step {
Step::Distance => format!(
"OFFSET Specify offset distance or [Through] <{:.4}>:",
defaults::get_offset_dist()
),
Step::Distance => {
let d = format!("{:.4}", defaults::get_offset_dist());
t!("OFFSET Specify offset distance or [Through] <%{d}>:", d = d).into_owned()
}
Step::SelectObject { .. } => {
"OFFSET Select object to offset (Enter to finish):".into()
t!("OFFSET Select object to offset (Enter to finish):").into_owned()
}
Step::PickSide {
targets,
@@ -875,22 +876,36 @@ impl CadCommand for OffsetCommand {
multiple,
..
} => {
let n = if targets.len() > 1 {
format!(" ({} objects)", targets.len())
let n: std::borrow::Cow<'_, str> = if targets.len() > 1 {
t!(" (%{count} objects)", count = targets.len())
} else {
String::new()
std::borrow::Cow::Borrowed("")
};
match (locked, multiple) {
(Some(d), false) => {
format!("OFFSET{n} Click side or [Multiple] [distance {d:.4}]:")
let d = format!("{:.4}", d);
t!(
"OFFSET%{n} Click side or [Multiple] [distance %{d}]:",
n = n,
d = d
)
.into_owned()
}
(Some(d), true) => {
format!("OFFSET{n} Multiple Click next side [distance {d:.4}]:")
let d = format!("{:.4}", d);
t!(
"OFFSET%{n} Multiple Click next side [distance %{d}]:",
n = n,
d = d
)
.into_owned()
}
(None, false) => {
format!("OFFSET{n} Click through point or [Multiple]:")
t!("OFFSET%{n} Click through point or [Multiple]:", n = n).into_owned()
}
(None, true) => {
t!("OFFSET%{n} Multiple Click next through point:", n = n).into_owned()
}
(None, true) => format!("OFFSET{n} Multiple Click next through point:"),
}
}
}
@@ -899,7 +914,7 @@ impl CadCommand for OffsetCommand {
fn options(&self) -> Vec<crate::command::CmdOption> {
match &self.step {
Step::Distance => vec![
crate::command::CmdOption::new("Through", "T"),
crate::command::CmdOption::new(t!("Through").as_ref(), "T"),
crate::command::CmdOption::enter(&format!(
"{:.4}",
defaults::get_offset_dist()
@@ -907,7 +922,7 @@ impl CadCommand for OffsetCommand {
],
Step::PickSide {
multiple: false, ..
} => vec![crate::command::CmdOption::new("Multiple", "M")],
} => vec![crate::command::CmdOption::new(t!("Multiple").as_ref(), "M")],
_ => Vec::new(),
}
}
+24 -19
View File
@@ -15,6 +15,7 @@ use acadrust::entities::LwVertex;
use acadrust::types::Vector2;
use acadrust::{EntityType, Handle};
use glam::{DVec2, DVec3};
use crate::t;
use rustc_hash::FxHashMap as HashMap;
use crate::command::{CadCommand, CmdResult};
@@ -84,16 +85,20 @@ impl CadCommand for PeditCommand {
fn prompt(&self) -> String {
match &self.mode {
Mode::PickTarget => "PEDIT Select polyline (or a line/arc to convert):".into(),
Mode::ConvertPrompt(_) => {
"PEDIT Object is not a polyline. Turn it into one? [Yes/No] <Y>:".into()
Mode::PickTarget => {
t!("PEDIT Select polyline (or a line/arc to convert):").into_owned()
}
Mode::AwaitWidth => "PEDIT Specify new width:".into(),
Mode::JoinGather(list) => format!(
"PEDIT Join Select objects to join ({} picked), Enter to merge:",
list.len().saturating_sub(1)
),
Mode::Options => "PEDIT Enter option:".into(),
Mode::ConvertPrompt(_) => t!(
"PEDIT Object is not a polyline. Turn it into one? [Yes/No] <Y>:"
)
.into_owned(),
Mode::AwaitWidth => t!("PEDIT Specify new width:").into_owned(),
Mode::JoinGather(list) => t!(
"PEDIT Join Select objects to join (%{count} picked), Enter to merge:",
count = list.len().saturating_sub(1)
)
.into_owned(),
Mode::Options => t!("PEDIT Enter option:").into_owned(),
}
}
@@ -101,19 +106,19 @@ impl CadCommand for PeditCommand {
use crate::command::CmdOption;
match &self.mode {
Mode::Options => vec![
CmdOption::new("Close", "C"),
CmdOption::new("Open", "O"),
CmdOption::new("Join", "J"),
CmdOption::new("Width", "W"),
CmdOption::new("Fit", "F"),
CmdOption::new("Spline", "S"),
CmdOption::new("Decurve", "D"),
CmdOption::new("eXit", "X"),
CmdOption::new(t!("Close").as_ref(), "C"),
CmdOption::new(t!("Open").as_ref(), "O"),
CmdOption::new(t!("Join").as_ref(), "J"),
CmdOption::new(t!("Width").as_ref(), "W"),
CmdOption::new(t!("Fit").as_ref(), "F"),
CmdOption::new(t!("Spline").as_ref(), "S"),
CmdOption::new(t!("Decurve").as_ref(), "D"),
CmdOption::new(t!("eXit").as_ref(), "X"),
],
Mode::ConvertPrompt(_) => {
vec![CmdOption::new("Yes", "Y"), CmdOption::new("No", "N")]
vec![CmdOption::new(t!("Yes").as_ref(), "Y"), CmdOption::new(t!("No").as_ref(), "N")]
}
Mode::JoinGather(_) => vec![CmdOption::enter("Join")],
Mode::JoinGather(_) => vec![CmdOption::enter(t!("Join").as_ref())],
_ => vec![],
}
}
+3 -2
View File
@@ -15,6 +15,7 @@
use acadrust::{EntityType, Handle};
use glam::DVec3;
use crate::t;
use crate::command::{CadCommand, CmdResult};
use crate::modules::{IconKind, ModuleEvent, ToolDef};
@@ -79,7 +80,7 @@ impl CadCommand for RefEditPickCommand {
"REFEDIT"
}
fn prompt(&self) -> String {
"REFEDIT Select block reference to edit:".into()
crate::t!("REFEDIT Select block reference to edit:").into_owned()
}
fn needs_entity_pick(&self) -> bool {
@@ -119,7 +120,7 @@ impl CadCommand for RefCloseCommand {
"REFCLOSE"
}
fn prompt(&self) -> String {
"REFCLOSE [Save/Discard] <Save>:".into()
t!("REFCLOSE [Save/Discard] <Save>:").into_owned()
}
fn wants_text_input(&self) -> bool {
true
+2 -1
View File
@@ -23,6 +23,7 @@
use acadrust::entities::Spline;
use acadrust::{EntityType, Handle};
use glam::DVec3;
use crate::t;
use crate::command::{CadCommand, CmdResult};
use crate::modules::{IconKind, ModuleEvent, ToolDef};
@@ -196,7 +197,7 @@ impl CadCommand for ReverseCommand {
}
fn prompt(&self) -> String {
"REVERSE Select line, polyline or spline to reverse:".to_string()
t!("REVERSE Select line, polyline or spline to reverse:").into_owned()
}
fn needs_entity_pick(&self) -> bool {
+19 -15
View File
@@ -11,6 +11,7 @@
use acadrust::Handle;
use glam::DVec3;
use crate::t;
use crate::command::{CadCommand, CmdResult, DynField, EntityTransform};
use crate::modules::draw::defaults;
@@ -71,29 +72,32 @@ impl CadCommand for RotateCommand {
fn prompt(&self) -> String {
match &self.step {
Step::Center => format!(
"ROTATE Specify rotation center [{} objects]:",
self.handles.len()
),
Step::Angle { .. } => format!(
"ROTATE Specify rotation angle <{:.4}>:",
self.default_angle
),
Step::Center => t!(
"ROTATE Specify rotation center [%{count} objects]:",
count = self.handles.len()
)
.into_owned(),
Step::Angle { .. } => {
let a = format!("{:.4}", self.default_angle);
t!("ROTATE Specify rotation angle <%{a}>:", a = a).into_owned()
}
Step::RefFirst { .. } => {
"ROTATE Specify first reference point or type reference angle:".into()
t!("ROTATE Specify first reference point or type reference angle:").into_owned()
}
Step::RefSecond { .. } => {
t!("ROTATE Specify second reference point:").into_owned()
}
Step::RefNew { ref_angle, .. } => {
let a = format!("{:.1}°", ref_angle.to_degrees());
t!("ROTATE Specify new absolute angle [ref=%{a}]:", a = a).into_owned()
}
Step::RefSecond { .. } => "ROTATE Specify second reference point:".into(),
Step::RefNew { ref_angle, .. } => format!(
"ROTATE Specify new absolute angle [ref={:.1}°]:",
ref_angle.to_degrees()
),
}
}
fn options(&self) -> Vec<crate::command::CmdOption> {
use crate::command::CmdOption;
match self.step {
Step::Angle { .. } => vec![CmdOption::new("Reference", "R")],
Step::Angle { .. } => vec![CmdOption::new(t!("Reference").as_ref(), "R")],
_ => vec![],
}
}
+23 -15
View File
@@ -14,6 +14,7 @@
use acadrust::Handle;
use glam::DVec3;
use crate::t;
use crate::command::{CadCommand, CmdResult, DynField, EntityTransform};
use crate::modules::draw::defaults;
@@ -80,22 +81,29 @@ impl CadCommand for ScaleCommand {
fn prompt(&self) -> String {
match &self.step {
Step::Base => format!(
"SCALE Specify base point [{} objects]:",
self.handles.len()
),
Step::Factor { .. } => format!(
"SCALE Specify scale factor <{:.4}>:",
self.default_factor
),
Step::Base => t!(
"SCALE Specify base point [%{count} objects]:",
count = self.handles.len()
)
.into_owned(),
Step::Factor { .. } => {
let f = format!("{:.4}", self.default_factor);
t!("SCALE Specify scale factor <%{f}>:", f = f).into_owned()
}
Step::RefFirst { .. } => {
"SCALE Specify first reference point or type reference length:".into()
t!("SCALE Specify first reference point or type reference length:").into_owned()
}
Step::RefSecond { .. } => {
t!("SCALE Specify second reference point:").into_owned()
}
Step::RefNew { ref_dist, .. } => {
let d = format!("{:.3}", ref_dist);
t!(
"SCALE Specify new length from base or type a length [ref=%{d}]:",
d = d
)
.into_owned()
}
Step::RefSecond { .. } => "SCALE Specify second reference point:".into(),
Step::RefNew { ref_dist, .. } => format!(
"SCALE Specify new length from base or type a length [ref={:.3}]:",
ref_dist
),
}
}
@@ -103,7 +111,7 @@ impl CadCommand for ScaleCommand {
use crate::command::CmdOption;
match &self.step {
// The reference-scaling keyword is only offered at the factor step.
Step::Factor { .. } => vec![CmdOption::new("Reference", "R")],
Step::Factor { .. } => vec![CmdOption::new(t!("Reference").as_ref(), "R")],
_ => vec![],
}
}
+2 -2
View File
@@ -52,8 +52,8 @@ impl CadCommand for SplineditCommand {
fn prompt(&self) -> String {
match &self.step {
Step::SelectSpline => "SPLINEDIT Select spline:".to_string(),
Step::SubCommand { .. } => "SPLINEDIT [CLOSE/OPEN/REVERSE/EXIT]:".to_string(),
Step::SelectSpline => crate::t!("SPLINEDIT Select spline:").into_owned(),
Step::SubCommand { .. } => crate::t!("SPLINEDIT [CLOSE/OPEN/REVERSE/EXIT]:").into_owned(),
}
}
+18 -10
View File
@@ -17,6 +17,7 @@
use acadrust::Handle;
use glam::DVec3;
use crate::t;
use crate::command::{CadCommand, CmdResult};
use crate::modules::{IconKind, ModuleEvent, ToolDef};
@@ -93,20 +94,27 @@ impl CadCommand for StretchCommand {
if self.handles.is_empty() {
// Implicit mode: the window both selects the objects and
// marks which of their points move.
"STRETCH Specify first corner of crossing window:".into()
t!("STRETCH Specify first corner of crossing window:").into_owned()
} else {
format!(
"STRETCH Specify first corner of crossing window [{} objects]:",
self.handles.len()
t!(
"STRETCH Specify first corner of crossing window [%{count} objects]:",
count = self.handles.len()
)
.into_owned()
}
}
Step::WindowCorner2(_) => "STRETCH Specify opposite corner:".into(),
Step::Base { .. } => "STRETCH Specify base point:".into(),
Step::Target { base, .. } => format!(
"STRETCH Specify new point [base {:.3},{:.3}]:",
base.x, base.z
),
Step::WindowCorner2(_) => t!("STRETCH Specify opposite corner:").into_owned(),
Step::Base { .. } => t!("STRETCH Specify base point:").into_owned(),
Step::Target { base, .. } => {
let bx = format!("{:.3}", base.x);
let bz = format!("{:.3}", base.z);
t!(
"STRETCH Specify new point [base %{bx},%{bz}]:",
bx = bx,
bz = bz
)
.into_owned()
}
}
}
+3 -2
View File
@@ -7,6 +7,7 @@
use acadrust::Handle;
use glam::DVec3;
use crate::t;
use crate::command::{CadCommand, CmdResult, DynField};
use crate::scene::model::wire_model::WireModel;
@@ -117,8 +118,8 @@ impl CadCommand for TorientCommand {
fn prompt(&self) -> String {
match &self.step {
Step::AngleOrFirstPoint => "TORIENT New absolute rotation <Most Readable>:".into(),
Step::SecondPoint { .. } => "TORIENT Specify second point:".into(),
Step::AngleOrFirstPoint => t!("TORIENT New absolute rotation <Most Readable>:").into_owned(),
Step::SecondPoint { .. } => t!("TORIENT Specify second point:").into_owned(),
}
}
+44 -21
View File
@@ -26,6 +26,7 @@ use crate::modules::draw::modify::spline_ops::{
};
use crate::modules::IconKind;
use crate::scene::model::wire_model::WireModel;
use crate::t;
use super::entity_index::ModifyEntityIndex;
@@ -3092,22 +3093,33 @@ impl CadCommand for TrimCommand {
}
fn prompt(&self) -> String {
let edge = if self.implied_edges { " [Edge: Extend]" } else { "" };
let edge = if self.implied_edges {
t!(" [Edge: Extend]")
} else {
std::borrow::Cow::Borrowed("")
};
match &self.mode {
TrimMode::Pick => {
format!("TRIM{edge} Click segment to remove (Shift+click extends):")
crate::tf!("TRIM{edge} Click segment to remove (Shift+click extends):")
.into_owned()
}
TrimMode::SelectEdges => format!(
TrimMode::SelectEdges => crate::tf!(
"TRIM Select cutting edges [{} picked, Enter = done]:",
self.edge_set.len()
),
TrimMode::Fence(pts) => format!(
)
.into_owned(),
TrimMode::Fence(pts) => crate::tf!(
"TRIM{edge} Fence: pick points [{} placed, Enter = trim crossed]:",
pts.len()
),
TrimMode::CrossFirst => format!("TRIM{edge} Crossing: first corner:"),
TrimMode::CrossSecond(_) => format!("TRIM{edge} Crossing: opposite corner:"),
TrimMode::Erase => "TRIM Erase: click objects to delete [Enter = done]:".into(),
)
.into_owned(),
TrimMode::CrossFirst => crate::tf!("TRIM{edge} Crossing: first corner:").into_owned(),
TrimMode::CrossSecond(_) => {
crate::tf!("TRIM{edge} Crossing: opposite corner:").into_owned()
}
TrimMode::Erase => {
t!("TRIM Erase: click objects to delete [Enter = done]:").into_owned()
}
}
}
@@ -3778,22 +3790,33 @@ impl CadCommand for ExtendCommand {
}
fn prompt(&self) -> String {
let edge = if self.implied_edges { " [Edge: Extend]" } else { "" };
let edge = if self.implied_edges {
t!(" [Edge: Extend]")
} else {
std::borrow::Cow::Borrowed("")
};
match &self.mode {
TrimMode::Pick => format!(
TrimMode::Pick => crate::tf!(
"EXTEND{edge} Click near end of object to extend (Shift+click trims):"
),
TrimMode::SelectEdges => format!(
)
.into_owned(),
TrimMode::SelectEdges => crate::tf!(
"EXTEND Select boundary edges [{} picked, Enter = done]:",
self.edge_set.len()
),
TrimMode::Fence(pts) => format!(
)
.into_owned(),
TrimMode::Fence(pts) => crate::tf!(
"EXTEND{edge} Fence: pick points [{} placed, Enter = extend crossed]:",
pts.len()
),
TrimMode::CrossFirst => format!("EXTEND{edge} Crossing: first corner:"),
TrimMode::CrossSecond(_) => format!("EXTEND{edge} Crossing: opposite corner:"),
TrimMode::Erase => "EXTEND [Enter = done]:".into(),
)
.into_owned(),
TrimMode::CrossFirst => {
crate::tf!("EXTEND{edge} Crossing: first corner:").into_owned()
}
TrimMode::CrossSecond(_) => {
crate::tf!("EXTEND{edge} Crossing: opposite corner:").into_owned()
}
TrimMode::Erase => t!("EXTEND [Enter = done]:").into_owned(),
}
}
@@ -4671,9 +4694,9 @@ impl CadCommand for ExtrimCommand {
fn prompt(&self) -> String {
if self.boundary.is_none() {
"EXTRIM Select cutting boundary:".into()
crate::t!("EXTRIM Select cutting boundary:").into_owned()
} else {
"EXTRIM Click the side to trim away:".into()
crate::t!("EXTRIM Click the side to trim away:").into_owned()
}
}
+2 -2
View File
@@ -42,9 +42,9 @@ impl CadCommand for MatchPropCommand {
fn prompt(&self) -> String {
if !self.phase1_done() {
"MATCHPROP Select source object:".into()
crate::t!("MATCHPROP Select source object:").into_owned()
} else {
"MATCHPROP Select destination objects (Enter to finish):".into()
crate::t!("MATCHPROP Select destination objects (Enter to finish):").into_owned()
}
}
+11 -6
View File
@@ -10,6 +10,7 @@
use acadrust::Handle;
use glam::DVec3;
use crate::t;
use crate::command::{CadCommand, CmdOption, CmdResult};
use crate::scene::model::wire_model::WireModel;
@@ -52,13 +53,14 @@ impl CadCommand for SelectObjectsCommand {
fn prompt(&self) -> String {
if self.commit_on_enter && !self.handles.is_empty() {
format!(
"{} Select objects ({} selected, Enter to apply):",
self.pending_cmd,
self.handles.len()
t!(
"%{cmd} Select objects (%{count} selected, Enter to apply):",
cmd = self.pending_cmd,
count = self.handles.len()
)
.into_owned()
} else {
format!("{} Select objects:", self.pending_cmd)
t!("%{cmd} Select objects:", cmd = self.pending_cmd).into_owned()
}
}
@@ -74,7 +76,10 @@ impl CadCommand for SelectObjectsCommand {
// also work typed — these buttons just surface them.
fn options(&self) -> Vec<CmdOption> {
if self.commit_on_enter {
vec![CmdOption::new("Previous", "P"), CmdOption::new("Last", "L")]
vec![
CmdOption::new(t!("Previous").as_ref(), "P"),
CmdOption::new(t!("Last").as_ref(), "L"),
]
} else {
Vec::new()
}