fix(locale): put TCOUNT's new prompts back in the catalog

The placement options arrived with their prompts and messages written as
plain Rust strings, so they were the only command left speaking English
whatever the interface was set to.

They go through t! / tf! now like every other prompt, and the strings are
registered so the call actually reaches a translation: a source string
only resolves if the generated lookup knows it, and t! on an unknown
string just hands the source back. Keys follow what the table already
uses — the slug of the source, cut to forty-six characters, and the first
ten hex digits of its SHA-1 — which reproduces 2978 of the 3161 entries
exactly; the rest are hand-written ones predating the generator.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
Hakan Seven 2026-08-08 03:19:54 +03:00
commit 2feac73eec
4 changed files with 34 additions and 15 deletions

View file

@ -3428,3 +3428,11 @@ style-manager-center-of-text = Center of text
style-manager-center-of-text-overline = Center of text with overline
style-manager-block-extents = Block extents
style-manager-base-point = Base point
catalog-tcount-select-text-objects-then-press-enter-9b1ee71b4d = TCOUNT select text objects, then press Enter:
catalog-tcount-starting-number-start-7471e47711 = TCOUNT starting number <__ocs_fmt_0__>:
catalog-tcount-increment-increment-79f9ab6108 = TCOUNT increment <__ocs_fmt_0__>:
catalog-tcount-placement-overwrite-prefix-suffix-overw-9214874a72 = TCOUNT placement [Overwrite/Prefix/Suffix] <Overwrite>:
catalog-tcount-placement-must-be-overwrite-prefix-or-s-84211d2b75 = TCOUNT: placement must be Overwrite, Prefix, or Suffix.
catalog-tcount-numbered-n-text-object-s-from-start-by-30588884cc = TCOUNT: numbered __ocs_fmt_0__ text object(s) from __ocs_fmt_1__ by __ocs_fmt_2__ (__ocs_fmt_3__).
catalog-prefix-90eceb016c = Prefix
catalog-suffix-885db975a3 = Suffix

View file

@ -457,7 +457,8 @@ impl OpenCADStudio {
"S" | "SUFFIX" => "S",
_ => {
self.command_line.push_error(
"TCOUNT: placement must be Overwrite, Prefix, or Suffix.",
crate::t!("TCOUNT: placement must be Overwrite, Prefix, or Suffix.")
.as_ref(),
);
return Some(Task::none());
}
@ -477,7 +478,7 @@ impl OpenCADStudio {
if texts.is_empty() {
self.command_line
.push_error("TCOUNT: select single-line text first.");
.push_error(crate::t!("TCOUNT: select single-line text first.").as_ref());
return Some(Task::none());
}
@ -524,18 +525,18 @@ impl OpenCADStudio {
self.tabs[i].scene.bump_entities(&changes);
let placement_name = match placement {
let placement_name = crate::t!(match placement {
"P" => "Prefix",
"S" => "Suffix",
_ => "Overwrite",
};
self.command_line.push_output(&format!(
"TCOUNT: numbered {} text object(s) from {} by {} ({placement_name}).",
texts.len(),
start,
increment,
));
});
let n = texts.len();
self.command_line.push_output(
crate::tf!(
"TCOUNT: numbered {n} text object(s) from {start} by {increment} ({placement_name})."
)
.as_ref(),
);
}
"MLEADER" => {

View file

@ -922,18 +922,20 @@ impl CadCommand for TCountCommand {
fn prompt(&self) -> String {
if self.gathering {
return "TCOUNT select text objects, then press Enter:".to_string();
return crate::t!("TCOUNT select text objects, then press Enter:").into_owned();
}
match self.step {
TCountStep::Start => {
format!("TCOUNT starting number <{}>:", self.start)
let start = self.start;
crate::tf!("TCOUNT starting number <{start}>:").into_owned()
}
TCountStep::Increment => {
format!("TCOUNT increment <{}>:", self.increment)
let increment = self.increment;
crate::tf!("TCOUNT increment <{increment}>:").into_owned()
}
TCountStep::Placement => {
"TCOUNT placement [Overwrite/Prefix/Suffix] <Overwrite>:".to_string()
crate::t!("TCOUNT placement [Overwrite/Prefix/Suffix] <Overwrite>:").into_owned()
}
}
}

View file

@ -53,6 +53,14 @@ pub(super) fn message_id(source: &str) -> Option<&'static str> {
" ⚠ No closed boundary found." => Some("catalog-no-closed-boundary-found-7a55b25ecb"),
" (%{count} objects)" => Some("catalog-count-objects-83518eccc2"),
" [Edge: Extend]" => Some("catalog-edge-extend-90a0cb9b4f"),
"Prefix" => Some("catalog-prefix-90eceb016c"),
"Suffix" => Some("catalog-suffix-885db975a3"),
"TCOUNT increment <{increment}>:" => Some("catalog-tcount-increment-increment-79f9ab6108"),
"TCOUNT placement [Overwrite/Prefix/Suffix] <Overwrite>:" => Some("catalog-tcount-placement-overwrite-prefix-suffix-overw-9214874a72"),
"TCOUNT select text objects, then press Enter:" => Some("catalog-tcount-select-text-objects-then-press-enter-9b1ee71b4d"),
"TCOUNT starting number <{start}>:" => Some("catalog-tcount-starting-number-start-7471e47711"),
"TCOUNT: numbered {n} text object(s) from {start} by {increment} ({placement_name})." => Some("catalog-tcount-numbered-n-text-object-s-from-start-by-30588884cc"),
"TCOUNT: placement must be Overwrite, Prefix, or Suffix." => Some("catalog-tcount-placement-must-be-overwrite-prefix-or-s-84211d2b75"),
"\"%{file_name}\" could not be saved." => Some("catalog-file-name-could-not-be-saved-b35d7df5dd"),
"\"%{file_name}\" was changed by another application." => Some("catalog-file-name-was-changed-by-another-application-278da6e091"),
"\"{}\" name already in use" => Some("catalog-name-already-in-use-1ce1d7a45c"),