Skip to content

VectorCraft: An open-source, vector art tool written by scratch in pure Rust

Tabs: the position field's label is translated

dotCooCooe28c08a8b8ba
diff --git a/crates/ui-egui/src/i18n/pl.tsv b/crates/ui-egui/src/i18n/pl.tsv
index ef814fcf5..74fe7890f 100644
--- a/crates/ui-egui/src/i18n/pl.tsv
+++ b/crates/ui-egui/src/i18n/pl.tsv
@@ -1885,6 +1885,8 @@ lighting Light Światło
Repeat Tab Powtórz tabulator
Right-Justified Tab Tabulator prawy
Top-Justified Tab Tabulator górny
+ X: X:
+ Y: Y:
Select a text object to set its tab stops. Zaznacz obiekt tekstowy, aby ustawić jego tabulatory.
Select text Zaznacz tekst
Snap to Unit Przyciągaj do jednostek
diff --git a/crates/ui-egui/src/i18n/vi.tsv b/crates/ui-egui/src/i18n/vi.tsv
index 6eac7c3c3..cde41165c 100644
--- a/crates/ui-egui/src/i18n/vi.tsv
+++ b/crates/ui-egui/src/i18n/vi.tsv
@@ -4002,7 +4002,9 @@ mark-style Japanese Kiểu Nhật
X11 (XWayland) When a Pen Is Attached X11 (XWayland) khi có bút được kết nối
If a drawing tablet's pen doesn't draw, choose an X11 (XWayland) option. Nếu bút của bảng vẽ không vẽ được, hãy chọn một tùy chọn X11 (XWayland).
X11 (XWayland) X11 (XWayland)
+ X: X:
XML ID XML ID
+ Y: Y:
Yards Yard
Yellow Vàng
Your browser downloads the files (several as one .zip). Trình duyệt của bạn tải xuống các tệp (một số tệp gộp thành một .zip).
diff --git a/crates/ui-egui/src/panels/tabs.rs b/crates/ui-egui/src/panels/tabs.rs
index 455bfb583..9eba2af7b 100644
--- a/crates/ui-egui/src/panels/tabs.rs
+++ b/crates/ui-egui/src/panels/tabs.rs
@@ -158,7 +158,7 @@ pub fn show(app: &mut VectorcraftApp, ui: &mut Ui) {
});
ui.add_space(4.0);
egui::Grid::new("tabs-grid").num_columns(2).spacing([6.0, 4.0]).show(ui, |ui| {
- ui.label(egui::RichText::new(if vertical { "Y:" } else { "X:" }).color(t.text));
+ ui.label(egui::RichText::new(if vertical { tl!("Y:") } else { tl!("X:") }).color(t.text));
let x = stops.get(sel).map(|s| s.position);
if let Some(v) = widgets::spin_field(ui, "tabs-x", x, app.session.general_unit(), 90.0, 1.0, 0.0, &[])
&& let Some(i) = apply_moved(app, ui.ctx(), &mut stops, sel, v.max(0.0))
diff --git a/crates/ui-egui/src/panels/tabs/tests.rs b/crates/ui-egui/src/panels/tabs/tests.rs
index e7919b448..e66f5860f 100644
--- a/crates/ui-egui/src/panels/tabs/tests.rs
+++ b/crates/ui-egui/src/panels/tabs/tests.rs
@@ -81,6 +81,27 @@ fn vertical_type_names_the_alignments_top_and_bottom_and_the_position_y() {
}
}
+/// The position field's label is translated: French puts a no-break space before the colon,
+/// Chinese writes a full-width colon.
+#[test]
+fn position_label_is_translated() {
+ let mut app = VectorcraftApp::new(Session::new(), Default::default());
+ app.session.execute("file.new", &json!({})).unwrap();
+ app.session.execute("text.create", &json!({"x": 10, "y": 20, "text": "a b", "area": {"width": 300, "height": 100}})).unwrap();
+ app.session.execute("text.tabs.set", &json!({"stops": [{"position": 50}]})).unwrap();
+ let labels = |app: &mut VectorcraftApp| {
+ let text = crate::tests_labels::painted_text(app, show);
+ ["X:", "Y:", "X\u{a0}:", "Y\u{a0}:", "X:", "Y:"].into_iter().filter(|l| text.lines().any(|t| t.trim() == *l)).collect::<Vec<_>>()
+ };
+ for (code, horizontal, vertical) in [("fr", "X\u{a0}:", "Y\u{a0}:"), ("zh-hans", "X:", "Y:"), ("en", "X:", "Y:")] {
+ crate::i18n::set_current(crate::i18n::Lang::from_code(code).unwrap());
+ app.session.execute("type.orientation.horizontal", &json!({})).unwrap();
+ assert_eq!(labels(&mut app), [horizontal], "{code}");
+ app.session.execute("type.orientation.vertical", &json!({})).unwrap();
+ assert_eq!(labels(&mut app), [vertical], "{code}");
+ }
+}
+
/// #924: Leader and Align On keep what is typed, frame after frame, until Enter applies it
/// (spaces kept, eight characters at most).
#[test]