Complete application localization across all supported languages

This commit is contained in:
Hakan Seven committed 2026-09-07 01:05:02 +03:00
1 parent 96c794c072
commit d66e89ca19
78 files changed
+26043 -877

No files matched your search

+15 -15
View File
@@ -169,7 +169,7 @@ pub fn color_selector_varies<'a>(
on_toggle: Message,
on_more: Message,
) -> Element<'a, Message> {
let indicator = container(text("?").size(10))
let indicator = container(text(crate::t!("?")).size(10))
.style(|theme: &Theme| {
let palette = theme.palette();
container::Style {
@@ -434,7 +434,7 @@ pub fn index_color_page<'a>(
}
let recent: Element<'a, Message> = if recent_colors.is_empty() {
text("No recent colors yet")
text(crate::t!("No recent colors yet"))
.size(10)
.style(|theme: &Theme| iced::widget::text::Style {
color: Some(
@@ -464,18 +464,18 @@ pub fn index_color_page<'a>(
format!("ACI {i} RGB {r}, {g}, {b}")
}
AcadColor::Rgb { r, g, b } => {
format!("True Color RGB {r}, {g}, {b}")
crate::tf!("True Color RGB {r}, {g}, {b}").into_owned()
}
AcadColor::ByLayer => "ByLayer".to_string(),
AcadColor::ByBlock => "ByBlock".to_string(),
AcadColor::None => "None".to_string(),
AcadColor::ByLayer => t!("ByLayer").into_owned(),
AcadColor::ByBlock => t!("ByBlock").into_owned(),
AcadColor::None => t!("None").into_owned(),
};
let tabs = row![
button(text("Index Color").size(12))
button(text(crate::t!("Index Color")).size(12))
.style(button::primary)
.padding([5, 14]),
button(text("True Color").size(12))
button(text(crate::t!("True Color")).size(12))
.on_press(Message::ColorPickerTabChanged(
crate::app::ColorPickerTab::TrueColor
))
@@ -486,11 +486,11 @@ pub fn index_color_page<'a>(
let actions = container(
row![
button(text("Cancel").size(11))
button(text(crate::t!("Cancel")).size(11))
.on_press(Message::CloseColorPicker)
.style(button::secondary)
.padding([5, 14]),
button(text("OK").size(11))
button(text(crate::t!("OK")).size(11))
.on_press(Message::ColorWindowPick(current))
.style(button::primary)
.padding([5, 18]),
@@ -503,11 +503,11 @@ pub fn index_color_page<'a>(
container(
column![
tabs,
text("Standard colors").size(11),
text(crate::t!("Standard colors")).size(11),
standard,
text("CAD Color Index (ACI) 10–249").size(11),
text(crate::t!("CAD Color Index (ACI) 10–249")).size(11),
text("Color family → · Shade / intensity ↓")
text(crate::t!("Color family → · Shade / intensity ↓"))
.size(9)
.style(|theme: &Theme| iced::widget::text::Style {
color: Some(theme.palette().background.base.text.scale_alpha(0.65)),
@@ -527,11 +527,11 @@ pub fn index_color_page<'a>(
..Default::default()
}),
text("Grayscale 250–255").size(11),
text(crate::t!("Grayscale 250–255")).size(11),
grayscale,
text("Recently used").size(11),
text(crate::t!("Recently used")).size(11),
recent,
+1 -1
View File
@@ -769,7 +769,7 @@ impl CommandLine {
style
})
.padding([2, 6]);
let mcp_tip = container(text(mcp_tooltip).size(11))
let mcp_tip = container(text(t!(mcp_tooltip)).size(11))
.padding([3, 6])
.style(container::bordered_box);
let mcp_btn = container(tooltip(mcp_btn, mcp_tip, tooltip::Position::Top).gap(4))
+6 -6
View File
@@ -323,8 +323,8 @@ let mut layer_usage = vec![Vec::<String>::new(); 256];
} else {
crate::io::plot_style::LW_TABLE
.get(e.lineweight as usize)
.map(|lw| format!("{lw:.2}mm (idx {})", e.lineweight))
.unwrap_or_else(|| format!("idx {}", e.lineweight))
.map(|lw| crate::tf!("{lw:.2}mm (idx {})", e.lineweight).into_owned())
.unwrap_or_else(|| crate::tf!("idx {}", e.lineweight).into_owned())
}
})
.unwrap_or_else(|| "—".into());
@@ -491,7 +491,7 @@ let mut layer_usage = vec![Vec::<String>::new(); 256];
container(
column![
row![
text(format!("Layers using ACI {selected_aci}"))
text(crate::tf!("Layers using ACI {selected_aci}"))
.size(11),
Space::new().width(iced::Length::Fill),
@@ -500,9 +500,9 @@ let mut layer_usage = vec![Vec::<String>::new(); 256];
"{} {}",
selected_layers.len(),
if selected_layers.len() == 1 {
"layer"
t!("layer")
} else {
"layers"
t!("layers")
}
))
.size(10)
@@ -512,7 +512,7 @@ let mut layer_usage = vec![Vec::<String>::new(); 256];
if selected_layers.is_empty() {
column![
text("No layers use this ACI in the current drawing.")
text(t!("No layers use this ACI in the current drawing."))
.size(10)
.style(muted_style)
]
+3 -3
View File
@@ -254,11 +254,11 @@ impl canvas::Program<Message> for TablePreviewCanvas {
let active = &self.rows[self.active_row.min(2)];
frame.fill_text(canvas::Text {
content: format!(
"{} · {} · type {} / unit {}{}{}",
"{} · {} · {} {} / {} {}{}{}",
active.text_style,
if self.annotative { t!("Annotative") } else { t!("Drawing units") },
active.data_type,
active.unit_type,
t!("Type"), active.data_type,
t!("Unit"), active.unit_type,
if self.description.trim().is_empty() { "" } else { " · " },
self.description,
),
+1 -1
View File
@@ -118,7 +118,7 @@ pub fn color_label(c: AcadColor) -> String {
AcadColor::Index(5) => "Blue".into(),
AcadColor::Index(6) => "Magenta".into(),
AcadColor::Index(7) => "White".into(),
AcadColor::Index(n) => format!("Color {n}"),
AcadColor::Index(n) => crate::tf!("Color {n}").into_owned(),
AcadColor::Rgb { r, g, b } => format!("{r},{g},{b}"),
}
}
+5 -5
View File
@@ -210,18 +210,18 @@ pub fn view(palette: &BlockPalette, width: f32, auto_collapse: bool) -> Element<
style
})
.padding([3, 5]);
let pin = tooltip(pin, text("Auto").size(10), tooltip::Position::Bottom).gap(4);
let pin = tooltip(pin, text(crate::t!("Auto")).size(10), tooltip::Position::Bottom).gap(4);
let close = button(crate::ui::icons::themed_secondary(crate::ui::icons::CLOSE, 12.0))
.on_press(Message::Dock(DockMsg::Close(PanelId::BlockPalette)))
.style(button::subtle)
.padding([3, 5]);
let close = tooltip(close, text("Close").size(10), tooltip::Position::Bottom).gap(4);
let close = tooltip(close, text(crate::t!("Close")).size(10), tooltip::Position::Bottom).gap(4);
let title_bar = mouse_area(
container(
row![
text("Block Palette").size(12),
text(crate::t!("Block Palette")).size(12),
iced::widget::Space::new().width(Fill),
pin,
close,
@@ -239,7 +239,7 @@ pub fn view(palette: &BlockPalette, width: f32, auto_collapse: bool) -> Element<
.on_press(Message::Dock(DockMsg::DockGrab(PanelId::BlockPalette)))
.interaction(iced::mouse::Interaction::Grab);
let search_input = text_input("Search blocks…", &palette.search)
let search_input = text_input(&crate::t!("Search blocks…"), &palette.search)
.on_input(|v| Message::BlockPalette(BlockPaletteMsg::Search(v)))
.padding([4, 8])
.size(12);
@@ -264,7 +264,7 @@ pub fn view(palette: &BlockPalette, width: f32, auto_collapse: bool) -> Element<
} else {
"No matches"
};
container(text(msg).size(12).color(iced::Color { r: 0.55, g: 0.55, b: 0.55, a: 1.0 }))
container(text(crate::t!(msg)).size(12).color(iced::Color { r: 0.55, g: 0.55, b: 0.55, a: 1.0 }))
.center_x(Fill)
.center_y(Fill)
.width(Fill)
+1 -1
View File
@@ -288,7 +288,7 @@ pub fn view_window<'a>(
.into_iter()
.map(|(value, label)| Labelled {
value,
label: label.to_string(),
label: crate::t!(label).into_owned(),
})
.collect::<Vec<_>>();
+20 -2
View File
@@ -47,13 +47,31 @@ impl PlotChoice {
impl fmt::Display for PlotChoice {
fn fmt(&self, formatter: &mut fmt::Formatter<'_>) -> fmt::Result {
if self.localized {
formatter.write_str(crate::i18n::translate(&self.raw).as_ref())
if let Some(name) = self.raw.strip_prefix("View: ") {
formatter.write_str(crate::tf!("View: {name}").as_ref())
} else {
formatter.write_str(crate::i18n::translate(&self.raw).as_ref())
}
} else {
formatter.write_str(&self.raw)
}
}
}
#[cfg(test)]
mod tests {
use super::PlotChoice;
#[test]
fn named_view_display_preserves_the_saved_plot_area() {
let name = "Plan: north";
let choice = PlotChoice::localized(format!("View: {name}"));
assert_eq!(choice.to_string(), crate::tf!("View: {name}").as_ref());
assert_eq!(choice.raw.strip_prefix("View: "), Some(name));
assert_eq!(PlotChoice::raw("View: PDF printer").to_string(), "View: PDF printer");
}
}
/// One of the many boolean plot options (folded into a single message so the
/// dialog needn't carry a variant per checkbox).
#[derive(Debug, Clone, Copy)]
@@ -716,7 +734,7 @@ pub fn view_window(
area_options.extend(
s.plot_views
.iter()
.map(|name| PlotChoice::raw(format!("View: {name}"))),
.map(|name| PlotChoice::localized(format!("View: {name}"))),
);
}
let mut area_row = row![