From 2feac73eecae3d38247387c4d168d0e9182ad1ca Mon Sep 17 00:00:00 2001 From: Hakan Seven Date: Sat, 8 Aug 2026 03:19:54 +0300 Subject: [PATCH] fix(locale): put TCOUNT's new prompts back in the catalog MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 --- locales/en-US/opencadstudio.ftl | 8 ++++++++ src/app/commands/dim.rs | 23 ++++++++++++----------- src/command.rs | 10 ++++++---- src/locale_catalog.rs | 8 ++++++++ 4 files changed, 34 insertions(+), 15 deletions(-) diff --git a/locales/en-US/opencadstudio.ftl b/locales/en-US/opencadstudio.ftl index 3b7652658..cc7bb55fe 100644 --- a/locales/en-US/opencadstudio.ftl +++ b/locales/en-US/opencadstudio.ftl @@ -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] : +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 diff --git a/src/app/commands/dim.rs b/src/app/commands/dim.rs index 81a8680f9..e8665b41f 100644 --- a/src/app/commands/dim.rs +++ b/src/app/commands/dim.rs @@ -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" => { diff --git a/src/command.rs b/src/command.rs index 330c9ffb0..0c9233f4e 100644 --- a/src/command.rs +++ b/src/command.rs @@ -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] :".to_string() + crate::t!("TCOUNT placement [Overwrite/Prefix/Suffix] :").into_owned() } } } diff --git a/src/locale_catalog.rs b/src/locale_catalog.rs index 75a8799e4..d9e16fc8c 100644 --- a/src/locale_catalog.rs +++ b/src/locale_catalog.rs @@ -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] :" => 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"),