i18n: Simplified Chinese (zh-hans) UI translation
- The i18n module now selects a catalog by language code instead of testing for Japanese: `language(app)` returns the code, `lookup` is shared by every catalog, and the undo/redo and workspace / 3D-view titles are formatted per language. - New SIMPLIFIED_CHINESE catalog: the same (command, English label) keys as JAPANESE, one entry per fixed menu row of the engine tree (618 rows). - `general.language` gains 简体中文 (`zh-hans`). Match System maps a Simplified Chinese locale (zh, zh-CN, zh_CN.UTF-8, zh-Hans-CN, zh-SG) to it and a Traditional one (zh-TW, zh-HK, zh-Hant) to English, which has no catalog of its own yet. - The macOS Services menu item is 服务 in Chinese. - Tests: both catalogs must cover the same fixed TREE entries; `...`, brackets and spacing keep the English shape; label/undo/panel-title/submenu/native-menu behaviour in zh-hans with file and layer names kept verbatim; the locale mapping; the preference round-trips through prefs.json.
This commit is contained in:
@@ -23,7 +23,7 @@ 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")];
|
||||
pub const LANGUAGES: &[(&str, &str)] = &[("Match System", "system"), ("English", "en"), ("日本語", "ja"), ("简体中文", "zh-hans")];
|
||||
|
||||
/// Settings ▸ Startup & Repair ▸ Window Graphics: (label, `startup.windowGraphics` value).
|
||||
pub const WINDOW_GRAPHICS: &[(&str, &str)] = &[("Automatic", "auto"), ("OpenGL (compatibility)", "gl")];
|
||||
|
||||
@@ -514,6 +514,12 @@ fn interface_language_is_validated_persisted_and_backward_compatible() {
|
||||
assert_eq!(s.prefs.general.language, "ja");
|
||||
assert_eq!(store.read(PREFS_FILE).unwrap(), saved);
|
||||
}
|
||||
// zh-hans is registered alongside en and ja: it is accepted, persisted and read back.
|
||||
s.execute("prefs.set", json!({"key": "general.language", "value": "zh-hans"})).unwrap();
|
||||
let mut zh = Session { config: Some(store.clone()), ..Default::default() };
|
||||
zh.load_settings();
|
||||
assert_eq!(zh.prefs.general.language, "zh-hans");
|
||||
s.execute("prefs.set", json!({"key": "general.language", "value": "ja"})).unwrap();
|
||||
let mut reloaded = Session { config: Some(store), ..Default::default() };
|
||||
reloaded.load_settings();
|
||||
assert_eq!(reloaded.prefs.general.language, "ja");
|
||||
|
||||
Reference in New Issue
Block a user