feat(i18n): implement translations for block creation window and units

- Localize block description placeholder via BlockDefinitionState field
- Add lookup mappings to locale_catalog for block definition dialog,
  validation messages, on-screen prompts, and insertion units
- Add Fluent strings for all 41 keys across all 21 supported locales
This commit is contained in:
Karim Jerbi committed 2026-09-24 11:14:26 +01:00
1 parent 531ba44faa
commit 5e34796dca
23 files changed
+948 -1

No files matched your search

+41
View File
@@ -5178,6 +5178,47 @@ pub(super) fn message_attribute(source: &str) -> Option<(&'static str, &'static
"Mid Between 2 Points" => Some(("ui", "mid-between-2-points")),
"Osnap Settings..." => Some(("ui", "osnap-settings")),
"Snap override: None (next pick only)." => Some(("ui", "snap-override-none-next-pick-only")),
"Allow exploding" => Some(("common", "allow-exploding")),
"Angstroms" => Some(("common", "angstroms")),
"Astronomical Units" => Some(("common", "astronomical-units")),
"BLOCK Select objects:" => Some(("insert", "block-select-objects")),
"BLOCK Specify insertion base point:" => Some(("insert", "block-specify-insertion-base-point")),
"BLOCK creates a block definition from objects you select." => Some(("common", "block-creates-a-block-definition-from-objects-you-select")),
"Behavior" => Some(("common", "behavior")),
"Block \"{name}\" already exists.\nDo you want to redefine it?" => Some(("common", "block-name-already-exists-do-you-want-to-redefine-it")),
"Block \"{}\" already exists — will redefine upon OK" => Some(("common", "block-already-exists-will-redefine-upon-ok")),
"Block Definition" => Some(("common", "block-definition")),
"Block name" => Some(("common", "block-name")),
"Block name cannot be empty." => Some(("common", "block-name-cannot-be-empty")),
"Block name cannot contain: \\ / : * ? \" < > | = `" => Some(("common", "block-name-cannot-contain-invalid-chars")),
"Block name cannot start with '*'." => Some(("common", "block-name-cannot-start-with-star")),
"Block unit:" => Some(("common", "block-unit-label")),
"Convert to block" => Some(("common", "convert-to-block")),
"Decameters" => Some(("common", "decameters")),
"Decimeters" => Some(("common", "decimeters")),
"Enter block description..." => Some(("common", "enter-block-description")),
"Gigameters" => Some(("common", "gigameters")),
"Hectometers" => Some(("common", "hectometers")),
"Hyperlink*" => Some(("common", "hyperlink-star")),
"Hyperlink..." => Some(("common", "hyperlink-ellipsis")),
"Invalid character '{invalid_char}' in block name (\\ / : * ? \" < > | = ` are not allowed)" => Some(("common", "invalid-character-in-block-name")),
"Light Years" => Some(("common", "light-years")),
"Match block orientation" => Some(("common", "match-block-orientation")),
"Microinches" => Some(("common", "microinches")),
"Microns" => Some(("common", "microns")),
"Mils" => Some(("common", "mils")),
"Nanometers" => Some(("common", "nanometers")),
"No objects selected" => Some(("common", "no-objects-selected")),
"No objects selected. You must select objects to define a block." => Some(("common", "no-objects-selected-you-must-select-objects-to-define-a-block")),
"Objects" => Some(("common", "objects-title-case")),
"Parsecs" => Some(("common", "parsecs")),
"Pick point" => Some(("common", "pick-point")),
"Retain" => Some(("common", "retain")),
"Scale uniformly" => Some(("common", "scale-uniformly")),
"Specify On-screen" => Some(("common", "specify-on-screen")),
"US Survey Feet" => Some(("common", "us-survey-feet")),
"to layout" => Some(("common", "to-layout")),
"{count} objects selected" => Some(("common", "count-objects-selected")),
_ => None,
}
}
+4 -1
View File
@@ -72,6 +72,7 @@ pub struct BlockDefinitionState {
pub hyperlink_desc: String,
pub error_message: Option<String>,
pub confirm_redefine: Option<String>,
pub desc_placeholder: String,
}
impl Clone for BlockDefinitionState {
@@ -98,6 +99,7 @@ impl Clone for BlockDefinitionState {
hyperlink_desc: self.hyperlink_desc.clone(),
error_message: self.error_message.clone(),
confirm_redefine: self.confirm_redefine.clone(),
desc_placeholder: self.desc_placeholder.clone(),
}
}
}
@@ -126,6 +128,7 @@ impl BlockDefinitionState {
hyperlink_desc: String::new(),
error_message: None,
confirm_redefine: None,
desc_placeholder: crate::t!("Enter block description...").into_owned(),
}
}
@@ -532,7 +535,7 @@ pub fn view_window<'a>(
// ── Group: Description (Column 2 Bottom) ──────────────────────────────────
let desc_editor = text_editor(&state.description_content)
.on_action(Message::BlockDefDescriptionAction)
.placeholder("Enter block description...")
.placeholder(&state.desc_placeholder)
.size(11)
.padding([4, 6])
.height(Fill)