Skip to content

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

Font menu: show 汉字 for the CJK script filter in Chinese UI (#2206)

nrq6993-a11ydb9fa8e0a967
diff --git a/crates/ui-egui/src/font_menu.rs b/crates/ui-egui/src/font_menu.rs
index bd723456e..3629760a7 100644
--- a/crates/ui-egui/src/font_menu.rs
+++ b/crates/ui-egui/src/font_menu.rs
@@ -89,7 +89,8 @@ const SCRIPTS: usize = 4;
fn script_label(i: usize) -> &'static str {
match i {
- 1 => tl!("Japanese"),
+ // CJK families use the `japanese` font trait; Chinese UI calls this 汉字 (#2206).
+ 1 => crate::i18n::tr_ctx(crate::i18n::current(), "font-script", "Japanese"),
2 => tl!("Latin"),
3 => tl!("Thai"),
_ => tl!("All Scripts"),
@@ -776,6 +777,11 @@ mod tests {
assert_eq!(passing(japanese), [0, 1]);
assert_eq!(passing(latin), [0, 2]);
assert_eq!(super::script_label(3), "Thai");
+ let zh = crate::i18n::Lang::from_code("zh-hans").unwrap();
+ crate::i18n::set_current(zh);
+ assert_eq!(super::script_label(1), "汉字");
+ crate::i18n::set_current(crate::i18n::Lang::EN);
+ assert_eq!(super::script_label(1), "Japanese");
}
/// #2277: the list's scroll bar has a column of its own, so the stars at the rows' right ends
diff --git a/crates/ui-egui/src/i18n/zh-hans.tsv b/crates/ui-egui/src/i18n/zh-hans.tsv
index 4e06b46b5..ee31597b6 100644
--- a/crates/ui-egui/src/i18n/zh-hans.tsv
+++ b/crates/ui-egui/src/i18n/zh-hans.tsv
@@ -2255,6 +2255,7 @@ diagnostics ui 界面
Printer mark type: 打印机标记类型:
Roman 西式
mark-style Japanese 日式
+font-script Japanese 汉字
Printer profile: 打印机配置文件:
Printer Setup… 打印机设置…
Printer: 打印机:
diff --git a/crates/ui-egui/src/i18n/zh-hant.tsv b/crates/ui-egui/src/i18n/zh-hant.tsv
index bfd52c8ea..2faf73da7 100644
--- a/crates/ui-egui/src/i18n/zh-hant.tsv
+++ b/crates/ui-egui/src/i18n/zh-hant.tsv
@@ -3084,6 +3084,7 @@ diagnostics ui 介面
Printer mark type: 印表機標記類型:
Roman 西式
mark-style Japanese 日式
+font-script Japanese 漢字
Printer profile: 印表機描述檔:
Printer Setup… 印表機設定…
Printer: 印表機: