forked from 1b-agent/opencadstudio-upstream
Complete application localization across all supported languages
This commit is contained in:
1 parent
96c794c072
commit
d66e89ca19
78 files changed
+26043
-877
No files matched your search
@@ -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}"),
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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
@@ -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![
|
||||
|
||||
Reference in new issue
Block a user