From db9fa8e0a967f92c08de7264ae96790269b9bd63 Mon Sep 17 00:00:00 2001 From: nrq6993-a11y Date: Mon, 19 Oct 2026 01:25:18 +0300 Subject: [PATCH] =?UTF-8?q?Font=20menu:=20show=20=E6=B1=89=E5=AD=97=20for?= =?UTF-8?q?=20the=20CJK=20script=20filter=20in=20Chinese=20UI=20(#2206)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Use a font-script i18n context so Simplified and Traditional Chinese label the Japanese-trait filter as Han characters without changing other locales. Co-authored-by: Cursor --- crates/ui-egui/src/font_menu.rs | 8 +++++++- crates/ui-egui/src/i18n/zh-hans.tsv | 1 + crates/ui-egui/src/i18n/zh-hant.tsv | 1 + 3 files changed, 9 insertions(+), 1 deletion(-) 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: 印表機: