feat(locale): localize full interface

This commit is contained in:
Hakan Seven committed 2026-08-02 22:09:25 +03:00
1 parent b90b3e3ecf
commit 3e6693b93f
205 files changed
+32369 -3810

No files matched your search

+22 -20
View File
@@ -3,6 +3,8 @@
use crate::app::Message;
use iced::widget::{button, column, container, row, scrollable, text, text_input, Space};
use iced::{Background, Border, Element, Theme};
use crate::t;
use std::borrow::Cow;
fn btn_s(accent: bool) -> impl Fn(&Theme, button::Status) -> button::Style {
move |theme: &Theme, st| {
@@ -89,21 +91,21 @@ pub fn view_window<'a>(
sizing: crate::ui::modal::ModalSizing,
) -> Element<'a, Message> {
let table_name = table
.map(|t| t.name.as_str())
.unwrap_or("(no table loaded)");
.map(|t| t.name.clone())
.unwrap_or_else(|| t!("(no table loaded)").into_owned());
// ── Toolbar ───────────────────────────────────────────────────────────
let toolbar = container(
row![
button(text("Load CTB/STB").size(11))
button(text(t!("Load CTB/STB")).size(11))
.on_press(Message::PlotStyleLoad)
.style(btn_s(false))
.padding([4, 10]),
button(text("Save As…").size(11))
button(text(t!("Save As…")).size(11))
.on_press(Message::PlotStylePanelSave)
.style(btn_s(false))
.padding([4, 10]),
button(text("Clear Table").size(11))
button(text(t!("Clear Table")).size(11))
.on_press(Message::PlotStyleClear)
.style(btn_s(false))
.padding([4, 10]),
@@ -149,7 +151,7 @@ pub fn view_window<'a>(
let label = if has_override {
format!("{aci:>3} {color_str:<9} {lw_str}")
} else {
format!("{aci:>3} (default)")
format!("{aci:>3} {}", t!("(default)"))
};
button(text(label).size(10).font(iced::Font::MONOSPACE))
.on_press(Message::PlotStylePanelSelectAci(aci))
@@ -178,7 +180,7 @@ pub fn view_window<'a>(
let aci_list = container(
column![
text("ACI Color Index").size(10).style(muted_style),
text(t!("ACI Color Index")).size(10).style(muted_style),
container(scrollable(column(aci_items).spacing(1)).height(sizing.height))
.style(|theme: &Theme| {
let palette = theme.palette();
@@ -212,11 +214,11 @@ pub fn view_window<'a>(
let entry = table.and_then(|t| t.aci_entries.get(selected_aci as usize));
let cur_color = entry
.and_then(|e| e.color.map(|[r, g, b]| format!("#{r:02X}{g:02X}{b:02X}")))
.unwrap_or_else(|| "(none)".into());
.unwrap_or_else(|| t!("(none)").into());
let cur_lw = entry
.map(|e| {
if e.lineweight == 255 {
"object".into()
t!("object").into()
} else {
crate::io::plot_style::LW_TABLE
.get(e.lineweight as usize)
@@ -229,41 +231,41 @@ pub fn view_window<'a>(
.map(|e| format!("{}%", e.screening))
.unwrap_or_else(|| "—".into());
let lbl = |s: &'static str| text(s).size(11).style(muted_style);
let lbl = |s: Cow<'static, str>| text(s).size(11).style(muted_style);
let edit_panel = container(
column![
row![
text("ACI:").size(11).style(muted_style).width(100),
text(t!("ACI:")).size(11).style(muted_style).width(100),
text(format!("{selected_aci}")).size(11),
]
.spacing(8)
.align_y(iced::Center),
lbl("Color override (#RRGGBB):"),
text_input("#RRGGBB or blank", color_buf)
lbl(t!("Color override (#RRGGBB):")),
text_input(t!("#RRGGBB or blank").as_ref(), color_buf)
.on_input(Message::PlotStylePanelColorBuf)
.style(field_style)
.size(11)
.padding([4, 8]),
lbl("Lineweight index (0-24, 255=obj):"),
lbl(t!("Lineweight index (0-24, 255=obj):")),
text_input("255", lw_buf)
.on_input(Message::PlotStylePanelLwBuf)
.style(field_style)
.size(11)
.padding([4, 8]),
lbl("Screening (0-100):"),
lbl(t!("Screening (0-100):")),
text_input("100", screen_buf)
.on_input(Message::PlotStylePanelScreenBuf)
.style(field_style)
.size(11)
.padding([4, 8]),
Space::new().height(8),
text("Current values:").size(10).style(muted_style),
text(format!(" Color: {cur_color}")).size(10),
text(format!(" Lineweight: {cur_lw}")).size(10),
text(format!(" Screening: {cur_scr}")).size(10),
text(t!("Current values:")).size(10).style(muted_style),
text(t!(" Color: %{cur_color}", cur_color = cur_color)).size(10),
text(t!(" Lineweight: %{cur_lw}", cur_lw = cur_lw)).size(10),
text(t!(" Screening: %{cur_scr}", cur_scr = cur_scr)).size(10),
Space::new().height(sizing.height),
button(text("Apply to ACI").size(11))
button(text(t!("Apply to ACI")).size(11))
.on_press(Message::PlotStylePanelApply)
.style(btn_s(true))
.padding([5, 10]),