forked from 1b-agent/opencadstudio-upstream
Complete application localization across all supported languages
This commit is contained in:
1 parent
96c794c072
commit
d66e89ca19
78 files changed
+26043
-877
No files matched your search
@@ -280,14 +280,14 @@ impl CadCommand for ArcLengthDimensionCommand {
|
||||
|
||||
fn prompt(&self) -> String {
|
||||
if self.awaiting_text {
|
||||
return "DIMARC Enter dimension text (blank = measured value):".to_string();
|
||||
return crate::t!("DIMARC Enter dimension text (blank = measured value):").into_owned();
|
||||
}
|
||||
if self.awaiting_angle {
|
||||
return "DIMARC Specify text angle (degrees):".to_string();
|
||||
return crate::t!("DIMARC Specify text angle (degrees):").into_owned();
|
||||
}
|
||||
match self.step {
|
||||
Step::SelectObject => {
|
||||
"DIMARC Select arc or polyline arc segment:".to_string()
|
||||
crate::t!("DIMARC Select arc or polyline arc segment:").into_owned()
|
||||
}
|
||||
Step::DimLine(selection) => {
|
||||
let leader_option = if selection.sweep() > std::f64::consts::FRAC_PI_2 {
|
||||
@@ -295,15 +295,15 @@ impl CadCommand for ArcLengthDimensionCommand {
|
||||
} else {
|
||||
""
|
||||
};
|
||||
format!(
|
||||
crate::tf!(
|
||||
"DIMARC Specify arc length dimension location [Mtext/Text/Angle/Partial{leader_option}]:"
|
||||
)
|
||||
).into_owned()
|
||||
}
|
||||
Step::PartialFirst(_) => {
|
||||
"DIMARC Specify first point of partial arc:".to_string()
|
||||
crate::t!("DIMARC Specify first point of partial arc:").into_owned()
|
||||
}
|
||||
Step::PartialSecond { .. } => {
|
||||
"DIMARC Specify second point of partial arc:".to_string()
|
||||
crate::t!("DIMARC Specify second point of partial arc:").into_owned()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -385,16 +385,15 @@ impl CadCommand for DimBaselineCommand {
|
||||
|
||||
fn prompt(&self) -> String {
|
||||
if self.base.is_none() {
|
||||
"DIMBASELINE Select base dimension:".to_string()
|
||||
crate::t!("DIMBASELINE Select base dimension:").into_owned()
|
||||
} else if self
|
||||
.base
|
||||
.as_ref()
|
||||
.is_some_and(|base| matches!(&base.kind, BaselineKind::Ordinate { .. }))
|
||||
{
|
||||
"DIMBASELINE Specify feature location [Undo/Select] <Select>:".to_string()
|
||||
crate::t!("DIMBASELINE Specify feature location [Undo/Select] <Select>:").into_owned()
|
||||
} else {
|
||||
"DIMBASELINE Specify second extension line origin [Select/Undo] <Select>:"
|
||||
.to_string()
|
||||
crate::t!("DIMBASELINE Specify second extension line origin [Select/Undo] <Select>:").into_owned()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -322,16 +322,15 @@ impl CadCommand for DimContinueCommand {
|
||||
|
||||
fn prompt(&self) -> String {
|
||||
if self.base.is_none() {
|
||||
"DIMCONTINUE Select continued dimension:".to_string()
|
||||
crate::t!("DIMCONTINUE Select continued dimension:").into_owned()
|
||||
} else if self
|
||||
.base
|
||||
.as_ref()
|
||||
.is_some_and(|base| matches!(&base.kind, ContinueKind::Ordinate { .. }))
|
||||
{
|
||||
"DIMCONTINUE Specify feature location [Undo/Select] <Select>:".to_string()
|
||||
crate::t!("DIMCONTINUE Specify feature location [Undo/Select] <Select>:").into_owned()
|
||||
} else {
|
||||
"DIMCONTINUE Specify second extension line origin [Select/Undo] <Select>:"
|
||||
.to_string()
|
||||
crate::t!("DIMCONTINUE Specify second extension line origin [Select/Undo] <Select>:").into_owned()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -249,7 +249,7 @@ impl CadCommand for TextCommand {
|
||||
"TEXT Current style: {}, Height: {}, Annotative: {}",
|
||||
self.style_name,
|
||||
self.height,
|
||||
if self.annotative { "Yes" } else { "No" }
|
||||
if self.annotative { t!("Yes") } else { t!("No") }
|
||||
),
|
||||
t!("TEXT Specify start point or [Justify/Style]:")
|
||||
),
|
||||
|
||||
@@ -573,7 +573,7 @@ impl CadCommand for HatchCommand {
|
||||
"D",
|
||||
),
|
||||
CmdOption::new(
|
||||
&format!("Island style: {}", self.island_style_label()),
|
||||
&crate::tf!("Island style: {}", self.island_style_label()),
|
||||
"Y",
|
||||
),
|
||||
];
|
||||
@@ -603,7 +603,7 @@ impl CadCommand for HatchCommand {
|
||||
"D",
|
||||
),
|
||||
CmdOption::new(
|
||||
&format!("Island style: {}", self.island_style_label()),
|
||||
&crate::tf!("Island style: {}", self.island_style_label()),
|
||||
"Y",
|
||||
),
|
||||
];
|
||||
|
||||
@@ -53,14 +53,14 @@ impl Report {
|
||||
self.translated.iter().map(|(_, _, n)| n).sum()
|
||||
}
|
||||
|
||||
/// The transaction log AutoCAD writes beside the drawing, as text.
|
||||
/// Layer translation log stored beside the drawing.
|
||||
pub fn to_log(&self) -> String {
|
||||
let mut out = String::new();
|
||||
for (from, to, moved) in &self.translated {
|
||||
out.push_str(&format!("{from} -> {to} ({moved} object(s))\n"));
|
||||
out.push_str(&crate::tf!("{from} -> {to} ({moved} object(s))\n").into_owned());
|
||||
}
|
||||
for (layer, reason) in &self.skipped {
|
||||
out.push_str(&format!("{layer}: skipped — {reason}\n"));
|
||||
out.push_str(&crate::tf!("{layer}: skipped — {reason}\n").into_owned());
|
||||
}
|
||||
out
|
||||
}
|
||||
@@ -85,7 +85,7 @@ pub fn load_targets(path: &Path) -> Result<Vec<TargetLayer>, String> {
|
||||
.collect();
|
||||
targets.sort_by(|a, b| a.name.to_lowercase().cmp(&b.name.to_lowercase()));
|
||||
if targets.is_empty() {
|
||||
return Err("no layers found in that file".into());
|
||||
return Err(crate::t!("no layers found in that file").into_owned());
|
||||
}
|
||||
Ok(targets)
|
||||
}
|
||||
@@ -143,20 +143,20 @@ pub fn translate(
|
||||
if mapping.from == "0" {
|
||||
report
|
||||
.skipped
|
||||
.push((mapping.from.clone(), "layer \"0\" cannot be translated".into()));
|
||||
.push((mapping.from.clone(), crate::t!("layer \"0\" cannot be translated").into_owned()));
|
||||
continue;
|
||||
}
|
||||
if mapping.from.eq_ignore_ascii_case(current_layer) {
|
||||
report.skipped.push((
|
||||
mapping.from.clone(),
|
||||
"it is the current layer".into(),
|
||||
crate::t!("it is the current layer").into_owned(),
|
||||
));
|
||||
continue;
|
||||
}
|
||||
if !scene.document.layers.contains(&mapping.from) {
|
||||
report
|
||||
.skipped
|
||||
.push((mapping.from.clone(), "no such layer in this drawing".into()));
|
||||
.push((mapping.from.clone(), crate::t!("no such layer in this drawing").into_owned()));
|
||||
continue;
|
||||
}
|
||||
// Bring the target in with the standard's own properties. An existing
|
||||
@@ -170,7 +170,7 @@ pub fn translate(
|
||||
else {
|
||||
report
|
||||
.skipped
|
||||
.push((mapping.from.clone(), "target layer is not in the loaded set".into()));
|
||||
.push((mapping.from.clone(), crate::t!("target layer is not in the loaded set").into_owned()));
|
||||
continue;
|
||||
};
|
||||
let mut layer = target.layer.clone();
|
||||
|
||||
@@ -383,27 +383,27 @@ impl CadCommand for PolysolidCommand {
|
||||
|
||||
fn prompt(&self) -> String {
|
||||
match self.step {
|
||||
Step::Start => format!(
|
||||
Step::Start => crate::tf!(
|
||||
"POLYSOLID Height = {:.4}, Width = {:.4}, Justification = {}\n{}",
|
||||
self.height,
|
||||
self.width,
|
||||
match self.justification {
|
||||
PolysolidJustification::Left => "Left",
|
||||
PolysolidJustification::Center => "Center",
|
||||
PolysolidJustification::Right => "Right",
|
||||
PolysolidJustification::Left => crate::t!("Left"),
|
||||
PolysolidJustification::Center => crate::t!("Center"),
|
||||
PolysolidJustification::Right => crate::t!("Right"),
|
||||
},
|
||||
t!("Specify start point or [Object/Height/Width/Justify] <Object>:")
|
||||
),
|
||||
Step::Height => format!("Specify height <{:.4}>:", self.height),
|
||||
Step::Width => format!("Specify width <{:.4}>:", self.width),
|
||||
Step::Justify => format!(
|
||||
).into_owned(),
|
||||
Step::Height => crate::tf!("Specify height <{:.4}>:", self.height).into_owned(),
|
||||
Step::Width => crate::tf!("Specify width <{:.4}>:", self.width).into_owned(),
|
||||
Step::Justify => crate::tf!(
|
||||
"Enter justification [Left/Center/Right] <{}>:",
|
||||
match self.justification {
|
||||
PolysolidJustification::Left => "Left",
|
||||
PolysolidJustification::Center => "Center",
|
||||
PolysolidJustification::Right => "Right",
|
||||
PolysolidJustification::Left => crate::t!("Left"),
|
||||
PolysolidJustification::Center => crate::t!("Center"),
|
||||
PolysolidJustification::Right => crate::t!("Right"),
|
||||
}
|
||||
),
|
||||
).into_owned(),
|
||||
Step::Object => t!("Select object:").into_owned(),
|
||||
Step::Line if self.vertices.len() >= 3 => {
|
||||
t!("Specify next point or [Arc/Close/Undo]:").into_owned()
|
||||
|
||||
@@ -8,8 +8,6 @@
|
||||
// command at all). Naming each style once, next to the command that applies it,
|
||||
// is what keeps the three in step. (#621)
|
||||
|
||||
use std::sync::OnceLock;
|
||||
|
||||
use acadrust::entities::ViewportRenderMode as Mode;
|
||||
|
||||
use crate::modules::IconKind;
|
||||
@@ -95,16 +93,9 @@ pub fn keyword_choices() -> Vec<(&'static str, &'static str, Option<&'static str
|
||||
.collect()
|
||||
}
|
||||
|
||||
/// The prompt those choices are announced with. Built once from the table so
|
||||
/// the line the user reads cannot list something the picker does not offer.
|
||||
/// Stable source used by the shared command prompt translator.
|
||||
pub fn keyword_prompt() -> &'static str {
|
||||
static PROMPT: OnceLock<String> = OnceLock::new();
|
||||
PROMPT
|
||||
.get_or_init(|| {
|
||||
let listed: Vec<&str> = VISUAL_STYLES.iter().map(|style| style.label).collect();
|
||||
format!("Visual style [{}]:", listed.join(" / "))
|
||||
})
|
||||
.as_str()
|
||||
"Visual style [Wireframe 2D/Wireframe 3D/Hidden Line/Flat Shaded/Gouraud Shaded/Flat Shaded + Edges/Gouraud Shaded + Edges]:"
|
||||
}
|
||||
|
||||
pub fn label_for(mode: Mode) -> &'static str {
|
||||
|
||||
Reference in new issue
Block a user