Merge pull request #309 from FeiLiuEM/i18n/zh-hans
i18n: add Simplified and Traditional Chinese (zh-hans, zh-hant) UI translation
This commit is contained in:
commit
2a968c4d0e
|
|
@ -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")];
|
||||
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")];
|
||||
|
|
|
|||
|
|
@ -514,6 +514,17 @@ 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");
|
||||
// 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();
|
||||
assert_eq!(reloaded.prefs.general.language, "ja");
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load Diff
|
|
@ -184,7 +184,16 @@ pub fn build(app: &EffectcraftApp) -> NativeMenu {
|
|||
if role == Role::Hide && !services_added {
|
||||
out.push(NativeNode::Predefined {
|
||||
role: Role::Services,
|
||||
label: if crate::i18n::japanese(app) { "サービス" } else { "Services" }.into(),
|
||||
label: if crate::i18n::japanese(app) {
|
||||
"サービス"
|
||||
} else if crate::i18n::simplified(app) {
|
||||
"服务"
|
||||
} else if crate::i18n::traditional(app) {
|
||||
"服務"
|
||||
} else {
|
||||
"Services"
|
||||
}
|
||||
.into(),
|
||||
command: String::new(),
|
||||
});
|
||||
out.push(NativeNode::Separator);
|
||||
|
|
|
|||
|
|
@ -29,7 +29,7 @@ Commands (CLI, MCP, control channel):
|
|||
|
||||
### Settings that change behaviour
|
||||
|
||||
- `general.language`: interface language (`system` / `en` / `ja`), Settings ▸ General ▸ Language; menu labels change immediately. `system` (Match System, the default) follows the operating system's interface language where EffectCraft has a translation and is English otherwise; the browser build stays in English with it. Native Japanese UI uses installed system fonts; the web host must supply a Japanese font.
|
||||
- `general.language`: interface language (`system` / `en` / `ja` / `zh-hans` / `zh-hant`), Settings ▸ General ▸ Language; menu labels change immediately. `system` (Match System, the default) follows the operating system's interface language where EffectCraft has a translation and is English otherwise: a Simplified Chinese locale (`zh`, `zh-CN`, `zh_CN.UTF-8`, `zh-Hans-CN`, `zh-SG`) selects `zh-hans`, a Traditional one (`zh-TW`, `zh-HK`, `zh-Hant`, `zh_MO`) selects `zh-hant`; the browser build stays in English with it. Native Japanese, Simplified and Traditional Chinese UI uses installed system fonts; the web host must supply a Japanese font.
|
||||
- `general.undoLevels`: Levels of Undo
|
||||
- `general.pathPointSize`: Path Point and Handle Size
|
||||
- `general.recentItems`: Recent Projects Shown
|
||||
|
|
|
|||
Loading…
Reference in New Issue