forked from 1b-agent/opencadstudio-upstream
feat(locale): localize full interface
This commit is contained in:
1 parent
b90b3e3ecf
commit
3e6693b93f
205 files changed
+32369
-3810
No files matched your search
@@ -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()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -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()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -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 {
|
||||
|
||||
@@ -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"),
|
||||
],
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -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 {
|
||||
|
||||
@@ -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![],
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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 {
|
||||
|
||||
@@ -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()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -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(),
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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![],
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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 {
|
||||
|
||||
@@ -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![],
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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![],
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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(),
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -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()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -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(),
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -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()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user