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

+3 -1
View File
@@ -1,3 +1,5 @@
use crate::t;
use crate::command::{CadCommand, CmdResult};
use crate::modules::{IconKind, ModuleEvent, ToolDef};
use glam::DVec3;
@@ -30,7 +32,7 @@ impl CadCommand for BaseCommand {
}
fn prompt(&self) -> String {
"BASE Specify base point:".to_string()
t!("BASE Specify base point:").into_owned()
}
fn on_point(&mut self, pt: DVec3) -> CmdResult {
+12 -9
View File
@@ -1,5 +1,6 @@
use acadrust::Handle;
use glam::DVec3;
use crate::t;
use crate::command::{CadCommand, CmdResult};
use crate::modules::{IconKind, ModuleEvent, ToolDef};
@@ -40,15 +41,17 @@ impl CadCommand for CreateBlockCommand {
fn prompt(&self) -> String {
match &self.step {
Step::Name => format!(
"BLOCK Enter block name [{} objects selected]:",
self.handles.len()
),
Step::Base { name } => format!(
"BLOCK Specify base point for \"{}\" [{} objects]:",
name,
self.handles.len()
),
Step::Name => t!(
"BLOCK Enter block name [%{count} objects selected]:",
count = self.handles.len()
)
.into_owned(),
Step::Base { name } => t!(
"BLOCK Specify base point for \"%{name}\" [%{count} objects]:",
name = name,
count = self.handles.len()
)
.into_owned(),
}
}
+16 -9
View File
@@ -2,6 +2,7 @@ use acadrust::entities::{AttributeDefinition, AttributeEntity, Entity, Insert};
use acadrust::types::Vector3;
use acadrust::EntityType;
use glam::{DVec3, Vec3};
use crate::t;
use crate::command::{CadCommand, CmdResult};
use crate::modules::{IconKind, ModuleEvent, ToolDef};
@@ -105,15 +106,16 @@ impl CadCommand for InsertBlockCommand {
} else {
format!(" [{}]", self.available.join(", "))
};
format!("INSERT Enter block name:{hint}")
t!("INSERT Enter block name:%{hint}", hint = hint).into_owned()
}
Step::Point { name } => match self.awaiting {
Some(AwaitKind::Scale) => "INSERT Specify scale factor <1>:".to_string(),
Some(AwaitKind::Rotation) => "INSERT Specify rotation angle <0>:".to_string(),
None => format!(
"INSERT Specify insertion point for \"{}\" [Scale/Rotate]:",
name
),
Some(AwaitKind::Scale) => t!("INSERT Specify scale factor <1>:").into_owned(),
Some(AwaitKind::Rotation) => t!("INSERT Specify rotation angle <0>:").into_owned(),
None => t!(
"INSERT Specify insertion point for \"%{name}\" [Scale/Rotate]:",
name = name
)
.into_owned(),
},
Step::FillAttr { attdefs, idx, .. } => {
if let Some(ad) = attdefs.get(*idx) {
@@ -127,9 +129,14 @@ impl CadCommand for InsertBlockCommand {
} else {
ad.prompt.as_str()
};
format!("INSERT {prompt_text}{default_hint}:")
t!(
"INSERT %{prompt}%{hint}:",
prompt = prompt_text,
hint = default_hint
)
.into_owned()
} else {
"INSERT Filling attributes...".into()
t!("INSERT Filling attributes...").into_owned()
}
}
}
+27 -12
View File
@@ -10,6 +10,7 @@ use acadrust::entities::Insert;
use acadrust::types::Vector3;
use acadrust::EntityType;
use glam::DVec3;
use crate::t;
use crate::command::{CadCommand, CmdResult};
use crate::modules::{IconKind, ModuleEvent, ToolDef};
@@ -120,22 +121,36 @@ impl CadCommand for MinsertCommand {
} else {
format!(" [{}]", self.available.join(", "))
};
format!("MINSERT Enter block name:{hint}")
t!("MINSERT Enter block name:%{hint}", hint = hint).into_owned()
}
Step::Point { name } => {
format!("MINSERT Specify insertion point for \"{name}\":")
t!(
"MINSERT Specify insertion point for \"%{name}\":",
name = name
)
.into_owned()
}
Step::Params { idx, .. } => match idx {
ParamIdx::Rows => format!("MINSERT Enter number of rows <{}>:", self.rows),
ParamIdx::Columns => {
format!("MINSERT Enter number of columns <{}>:", self.columns)
}
ParamIdx::RowSpacing => {
format!("MINSERT Enter row spacing <{}>:", self.row_spacing)
}
ParamIdx::ColumnSpacing => {
format!("MINSERT Enter column spacing <{}>:", self.column_spacing)
}
ParamIdx::Rows => t!(
"MINSERT Enter number of rows <%{rows}>:",
rows = self.rows
)
.into_owned(),
ParamIdx::Columns => t!(
"MINSERT Enter number of columns <%{cols}>:",
cols = self.columns
)
.into_owned(),
ParamIdx::RowSpacing => t!(
"MINSERT Enter row spacing <%{val}>:",
val = self.row_spacing
)
.into_owned(),
ParamIdx::ColumnSpacing => t!(
"MINSERT Enter column spacing <%{val}>:",
val = self.column_spacing
)
.into_owned(),
},
}
}
+17 -12
View File
@@ -8,6 +8,7 @@
use acadrust::{entities::Solid3D, EntityType};
use glam::DVec3;
use crate::t;
use crate::command::{CadCommand, CmdResult};
@@ -46,8 +47,9 @@ impl CadCommand for ExtrudeCommand {
}
fn prompt(&self) -> String {
match self.step {
ExtrudeStep::Pick => "EXTRUDE Select closed profile (Circle, LwPolyline…):".into(),
ExtrudeStep::Height => "EXTRUDE Height:".into(),
ExtrudeStep::Pick => t!("EXTRUDE Select closed profile (Circle, LwPolyline…):")
.into_owned(),
ExtrudeStep::Height => t!("EXTRUDE Height:").into_owned(),
}
}
fn needs_entity_pick(&self) -> bool {
@@ -126,10 +128,10 @@ impl CadCommand for RevolveCommand {
}
fn prompt(&self) -> String {
match self.step {
RevolveStep::Pick => "REVOLVE Select profile:".into(),
RevolveStep::AxisStart => "REVOLVE Axis start point:".into(),
RevolveStep::AxisEnd => "REVOLVE Axis end point:".into(),
RevolveStep::Angle => "REVOLVE Angle of revolution <360>:".into(),
RevolveStep::Pick => t!("REVOLVE Select profile:").into_owned(),
RevolveStep::AxisStart => t!("REVOLVE Axis start point:").into_owned(),
RevolveStep::AxisEnd => t!("REVOLVE Axis end point:").into_owned(),
RevolveStep::Angle => t!("REVOLVE Angle of revolution <360>:").into_owned(),
}
}
fn needs_entity_pick(&self) -> bool {
@@ -224,8 +226,10 @@ impl CadCommand for SweepCommand {
}
fn prompt(&self) -> String {
match self.step {
SweepStep::PickProfile => "SWEEP Select profile to sweep:".into(),
SweepStep::PickPath => "SWEEP Select path (Line, Arc, LwPolyline):".into(),
SweepStep::PickProfile => t!("SWEEP Select profile to sweep:").into_owned(),
SweepStep::PickPath => {
t!("SWEEP Select path (Line, Arc, LwPolyline):").into_owned()
}
}
}
fn needs_entity_pick(&self) -> bool {
@@ -278,12 +282,13 @@ impl CadCommand for LoftCommand {
}
fn prompt(&self) -> String {
if self.profiles.is_empty() {
"LOFT Select first cross-section:".into()
t!("LOFT Select first cross-section:").into_owned()
} else {
format!(
"LOFT Select next cross-section ({} selected, Enter to finish):",
self.profiles.len()
t!(
"LOFT Select next cross-section (%{count} selected, Enter to finish):",
count = self.profiles.len()
)
.into_owned()
}
}
fn needs_entity_pick(&self) -> bool {
+14 -7
View File
@@ -5,6 +5,7 @@
// * → copies currently selected model-space entities
use acadrust::{CadDocument, EntityType};
use crate::t;
use crate::modules::{IconKind, ModuleEvent, ToolDef};
@@ -26,11 +27,15 @@ pub fn extract_block_to_doc(src: &CadDocument, block_name: &str) -> Result<CadDo
let br = src
.block_records
.get(block_name)
.ok_or_else(|| format!("Block \"{block_name}\" not found."))?;
.ok_or_else(|| t!("Block \"%{name}\" not found.", name = block_name).into_owned())?;
let handles = br.entity_handles.clone();
if handles.is_empty() {
return Err(format!("Block \"{block_name}\" has no entities."));
return Err(t!(
"Block \"%{name}\" has no entities.",
name = block_name
)
.into_owned());
}
let mut out = CadDocument::new();
@@ -59,9 +64,11 @@ pub fn extract_block_to_doc(src: &CadDocument, block_name: &str) -> Result<CadDo
}
if out.entities().count() == 0 {
return Err(format!(
"Block \"{block_name}\" produced no exportable entities."
));
return Err(t!(
"Block \"%{name}\" produced no exportable entities.",
name = block_name
)
.into_owned());
}
Ok(out)
@@ -74,7 +81,7 @@ pub fn extract_entities_to_doc(
handles: &[acadrust::Handle],
) -> Result<CadDocument, String> {
if handles.is_empty() {
return Err("No entities selected for WBLOCK.".into());
return Err(t!("No entities selected for WBLOCK.").into_owned());
}
let mut out = CadDocument::new();
@@ -99,7 +106,7 @@ pub fn extract_entities_to_doc(
}
if out.entities().count() == 0 {
return Err("None of the selected entities could be exported.".into());
return Err(t!("None of the selected entities could be exported.").into_owned());
}
Ok(out)
+7 -1
View File
@@ -14,6 +14,8 @@ use acadrust::types::Vector3;
use acadrust::EntityType;
use glam::DVec3;
use crate::t;
use crate::command::{CadCommand, CmdResult};
use crate::modules::{IconKind, ModuleEvent, ToolDef};
use crate::scene::model::wire_model::WireModel;
@@ -47,7 +49,11 @@ impl CadCommand for XAttachCommand {
}
fn prompt(&self) -> String {
format!("XATTACH Specify insertion point for \"{}\":", self.block_name)
t!(
"XATTACH Specify insertion point for \"%{name}\":",
name = self.block_name
)
.into_owned()
}
fn on_point(&mut self, pt: DVec3) -> CmdResult {