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
+43
-20
@@ -106,7 +106,7 @@ impl CadCommand for ValuePromptCommand {
|
||||
}
|
||||
|
||||
fn prompt(&self) -> String {
|
||||
self.prompt.to_string()
|
||||
crate::t!(self.prompt).into_owned()
|
||||
}
|
||||
|
||||
fn wants_text_input(&self) -> bool {
|
||||
@@ -177,9 +177,18 @@ impl CadCommand for RenameCommand {
|
||||
|
||||
fn prompt(&self) -> String {
|
||||
match &self.step {
|
||||
RenameStep::Type => "RENAME Select the object type to rename:".to_string(),
|
||||
RenameStep::Old { ty } => format!("RENAME {ty} Enter the current name:"),
|
||||
RenameStep::New { ty, old } => format!("RENAME {ty} Rename \"{old}\" to:"),
|
||||
RenameStep::Type => crate::t!("RENAME Select the object type to rename:").into_owned(),
|
||||
RenameStep::Old { ty } => crate::t!(
|
||||
"RENAME %{type} Enter the current name:",
|
||||
type = ty
|
||||
)
|
||||
.into_owned(),
|
||||
RenameStep::New { ty, old } => crate::t!(
|
||||
"RENAME %{type} Rename \"%{old}\" to:",
|
||||
type = ty,
|
||||
old = old
|
||||
)
|
||||
.into_owned(),
|
||||
}
|
||||
}
|
||||
|
||||
@@ -274,8 +283,10 @@ impl CadCommand for UserRegCommand {
|
||||
|
||||
fn prompt(&self) -> String {
|
||||
match self.slot {
|
||||
None => format!("{} which register? [1-5]:", self.name),
|
||||
Some(n) => format!("{}{n} new value:", self.name),
|
||||
None => crate::t!("%{name} which register? [1-5]:", name = self.name)
|
||||
.into_owned(),
|
||||
Some(n) => crate::t!("%{name}%{slot} new value:", name = self.name, slot = n)
|
||||
.into_owned(),
|
||||
}
|
||||
}
|
||||
|
||||
@@ -369,8 +380,8 @@ impl CadCommand for KeywordCommand {
|
||||
|
||||
fn prompt(&self) -> String {
|
||||
match self.pending {
|
||||
Some((_, value_prompt)) => value_prompt.to_string(),
|
||||
None => self.prompt.to_string(),
|
||||
Some((_, value_prompt)) => crate::t!(value_prompt).into_owned(),
|
||||
None => crate::t!(self.prompt).into_owned(),
|
||||
}
|
||||
}
|
||||
|
||||
@@ -464,8 +475,8 @@ impl CadCommand for TwoValuePromptCommand {
|
||||
|
||||
fn prompt(&self) -> String {
|
||||
match &self.first {
|
||||
None => self.prompt1.to_string(),
|
||||
Some(_) => self.prompt2.to_string(),
|
||||
None => crate::t!(self.prompt1).into_owned(),
|
||||
Some(_) => crate::t!(self.prompt2).into_owned(),
|
||||
}
|
||||
}
|
||||
|
||||
@@ -548,11 +559,15 @@ impl CadCommand for SelectThenKeywordCommand {
|
||||
|
||||
fn prompt(&self) -> String {
|
||||
if self.gathering {
|
||||
return format!("{} select objects, then press Enter:", self.name);
|
||||
return crate::t!(
|
||||
"%{name} select objects, then press Enter:",
|
||||
name = self.name
|
||||
)
|
||||
.into_owned();
|
||||
}
|
||||
match self.pending {
|
||||
Some((_, value_prompt)) => value_prompt.to_string(),
|
||||
None => self.prompt.to_string(),
|
||||
Some((_, value_prompt)) => crate::t!(value_prompt).into_owned(),
|
||||
None => crate::t!(self.prompt).into_owned(),
|
||||
}
|
||||
}
|
||||
|
||||
@@ -655,9 +670,13 @@ impl CadCommand for SelectThenValueCommand {
|
||||
|
||||
fn prompt(&self) -> String {
|
||||
if self.gathering {
|
||||
format!("{} select objects, then press Enter:", self.name)
|
||||
crate::t!(
|
||||
"%{name} select objects, then press Enter:",
|
||||
name = self.name
|
||||
)
|
||||
.into_owned()
|
||||
} else {
|
||||
self.value_prompt.to_string()
|
||||
crate::t!(self.value_prompt).into_owned()
|
||||
}
|
||||
}
|
||||
|
||||
@@ -740,11 +759,15 @@ impl CadCommand for SelectThenTwoValueCommand {
|
||||
|
||||
fn prompt(&self) -> String {
|
||||
if self.gathering {
|
||||
format!("{} select objects, then press Enter:", self.name)
|
||||
crate::t!(
|
||||
"%{name} select objects, then press Enter:",
|
||||
name = self.name
|
||||
)
|
||||
.into_owned()
|
||||
} else if self.first.is_none() {
|
||||
self.prompt1.to_string()
|
||||
crate::t!(self.prompt1).into_owned()
|
||||
} else {
|
||||
self.prompt2.to_string()
|
||||
crate::t!(self.prompt2).into_owned()
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1220,14 +1243,14 @@ impl CmdOption {
|
||||
/// Button whose keyword is typed on click, e.g. `("Ttr", "TTR")`.
|
||||
pub fn new(label: &str, keyword: &str) -> Self {
|
||||
Self {
|
||||
label: label.to_string(),
|
||||
label: crate::t!(label).into_owned(),
|
||||
keyword: keyword.to_string(),
|
||||
}
|
||||
}
|
||||
/// A "finish" button that submits the step like Enter.
|
||||
pub fn enter(label: &str) -> Self {
|
||||
Self {
|
||||
label: label.to_string(),
|
||||
label: crate::t!(label).into_owned(),
|
||||
keyword: String::new(),
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user