i18n: add Traditional Chinese (zh-hant) UI translation
- New TRADITIONAL_CHINESE catalog: the same (command, English label) keys as JAPANESE and SIMPLIFIED_CHINESE, one entry per fixed menu row (618 rows). The wording follows the Traditional Chinese catalogs PhotoCraft, PdfCraft, VectorCraft and LightCraft already ship (`檔案`, `開啟`, `儲存`, `圖層`, `遮色片`, `影格`, `預設集`, `快速鍵`, …). - Match System maps a Traditional Chinese locale (`zh-TW`, `zh-HK`, `zh-Hant`, `zh_MO`) to `zh-hant` instead of English, now that there is a catalog for it. - `simplified()` and `traditional()` replace the Simplified-only `chinese()`; the macOS Services item is 服务 in Simplified and 服務 in Traditional. - `general.language` gains 繁體中文; `docs/preferences.md` documents the locale mapping. - Tests: all three catalogs must cover the same fixed TREE entries; the shape check covers both Chinese catalogs; label/undo/panel-title/submenu/native-menu behaviour in zh-hant with file and layer names kept verbatim; the Traditional locale mapping; the preference round-trips.
This commit is contained in:
@@ -23,7 +23,13 @@ pub const PREFS_VERSION: u32 = 2;
|
||||
pub const PREFS_FILE: &str = "prefs.json";
|
||||
|
||||
/// Settings ▸ General ▸ Language: (label, `general.language` value).
|
||||
pub const LANGUAGES: &[(&str, &str)] = &[("Match System", "system"), ("English", "en"), ("日本語", "ja"), ("简体中文", "zh-hans")];
|
||||
pub const LANGUAGES: &[(&str, &str)] = &[
|
||||
("Match System", "system"),
|
||||
("English", "en"),
|
||||
("日本語", "ja"),
|
||||
("简体中文", "zh-hans"),
|
||||
("繁體中文", "zh-hant"),
|
||||
];
|
||||
|
||||
/// Settings ▸ Startup & Repair ▸ Window Graphics: (label, `startup.windowGraphics` value).
|
||||
pub const WINDOW_GRAPHICS: &[(&str, &str)] = &[("Automatic", "auto"), ("OpenGL (compatibility)", "gl")];
|
||||
|
||||
@@ -519,6 +519,11 @@ fn interface_language_is_validated_persisted_and_backward_compatible() {
|
||||
let mut zh = Session { config: Some(store.clone()), ..Default::default() };
|
||||
zh.load_settings();
|
||||
assert_eq!(zh.prefs.general.language, "zh-hans");
|
||||
// zh-hant is the same: another language of the registered set, not an error.
|
||||
s.execute("prefs.set", json!({"key": "general.language", "value": "zh-hant"})).unwrap();
|
||||
let mut zh_hant = Session { config: Some(store.clone()), ..Default::default() };
|
||||
zh_hant.load_settings();
|
||||
assert_eq!(zh_hant.prefs.general.language, "zh-hant");
|
||||
s.execute("prefs.set", json!({"key": "general.language", "value": "ja"})).unwrap();
|
||||
let mut reloaded = Session { config: Some(store), ..Default::default() };
|
||||
reloaded.load_settings();
|
||||
|
||||
Reference in New Issue
Block a user