fix(sheetset): translate the sysvar messages and insertion prompt

- SSM* / SS* sysvar messages and the Place on Sheet prompt go through
  t!/tf!, reusing the existing catalog entries where they exist; one new
  key (integer range) is translated in all 21 locales.
- The SETVAR prefix is matched case-insensitively.
- The stale "SHEETSET ... not yet implemented" key is removed from the
  catalog and every locale.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
Hakan SevenandClaude Opus 5.5 committed 2026-10-06 09:39:35 +03:00
1 parent b0969946b6
commit 310bf568f5
23 files changed
+37 -33

No files matched your search

+15 -11
View File
@@ -192,7 +192,7 @@ impl CadCommand for SheetSetPlaceCommand {
}
fn prompt(&self) -> String {
"Specify insertion point:".into()
crate::t!("Specify insertion point:").into_owned()
}
fn options(&self) -> Vec<CmdOption> {
@@ -506,7 +506,11 @@ impl OpenCADStudio {
}
fn dispatch_sheet_set_vars(&mut self, cmd: &str, _i: usize) -> Option<Task<Message>> {
let rest = cmd.strip_prefix("SETVAR ").map(str::trim).unwrap_or(cmd);
let cmd = cmd.trim();
let rest = match cmd.get(..7) {
Some(prefix) if prefix.eq_ignore_ascii_case("SETVAR ") => cmd[7..].trim(),
_ => cmd,
};
let mut parts = rest.splitn(2, char::is_whitespace);
let name = parts.next().unwrap_or("").to_ascii_uppercase();
if !SHEET_SET_SYSVARS.contains(&name.as_str()) {
@@ -517,11 +521,11 @@ impl OpenCADStudio {
match name.as_str() {
"SSMSTATE" => {
let v = u8::from(self.sheet_set.show);
self.command_line.push_output(&format!("SSMSTATE = {v} (read only)"));
self.command_line.push_output(&format!("SSMSTATE = {v} ({})", crate::t!("Read-only")));
}
"SSFOUND" => {
let v = self.sheet_set.found.clone();
self.command_line.push_output(&format!("SSFOUND = \"{v}\" (read only)"));
self.command_line.push_output(&format!("SSFOUND = \"{v}\" ({})", crate::t!("Read-only")));
}
_ => {
let (current, min, max) = match name.as_str() {
@@ -531,24 +535,24 @@ impl OpenCADStudio {
_ => (i32::from(s.sheet_status), 0, 2),
};
let ask = |app: &mut Self, name: String| {
app.command_line.push_output(&format!("Enter new value for {name} <{current}>:"));
app.command_line.push_output(&crate::tf!("Enter new value for {name} <{current}>:"));
app.pending_setvar = Some(name);
};
match value {
None => ask(self, name),
Some(v) => match v.parse::<i32>() {
Err(_) => {
self.command_line.push_error("Requires an integer value.");
ask(self, name);
}
Ok(n) if !(min..=max).contains(&n) => {
self.command_line.push_error(&if max == 1 {
"Requires 0 or 1 only.".to_string()
crate::t!("Requires 0 or 1").into_owned()
} else {
format!("Requires an integer between {min} and {max}.")
crate::tf!("Requires an integer between {min} and {max}.").into_owned()
});
ask(self, name);
}
Err(_) => {
self.command_line.push_error(&crate::tf!("Requires an integer between {min} and {max}."));
ask(self, name);
}
Ok(n) => {
let s = &mut self.sheet_set.settings;
match name.as_str() {
+1 -1
View File
@@ -4,6 +4,7 @@
pub(super) fn message_attribute(source: &str) -> Option<(&'static str, &'static str)> {
match source {
"Create Sheet Set" => Some(("view", "ss-create-sheet-set")),
"Requires an integer between {min} and {max}." => Some(("view", "ss-requires-integer-between")),
"New Sheet" => Some(("view", "ss-new-sheet")),
"Subset Properties" => Some(("view", "ss-subset-properties")),
"Rename & Renumber Sheet" => Some(("view", "ss-rename-renumber-sheet")),
@@ -2727,7 +2728,6 @@ pub(super) fn message_attribute(source: &str) -> Option<(&'static str, &'static
"SETVAR new value (blank to read):" => Some(("styles", "setvar-new-value-blank-to-read")),
"SETVAR variable name:" => Some(("styles", "setvar-variable-name")),
"SETVAR: {name} requires 0, 1, or 2." => Some(("draw", "setvar-frame-range")),
"SHEETSET: Sheet Set Manager not yet implemented." => Some(("view", "sheetset-sheet-set-manager-not-yet-implemented")),
"SHX" => Some(("properties", "shx")),
"Connect" => Some(("draw", "sketch-connect")),
"Exit" => Some(("draw", "sketch-exit")),