mirror of
https://github.com/storytold/effectcraft.git
synced 2026-10-25 18:47:07 -06:00
i18n: add Ukrainian menu translation (#395)
This commit is contained in:
@@ -23,7 +23,8 @@ 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"), ("繁體中文", "zh-hant")];
|
||||
pub const LANGUAGES: &[(&str, &str)] =
|
||||
&[("Match System", "system"), ("English", "en"), ("日本語", "ja"), ("简体中文", "zh-hans"), ("繁體中文", "zh-hant"), ("Українська", "uk")];
|
||||
|
||||
/// Settings ▸ Appearance ▸ UI Scale: (label, `appearance.uiScale` percent).
|
||||
pub const UI_SCALES: &[(&str, &str)] = &[("75%", "75"), ("100%", "100"), ("125%", "125"), ("150%", "150"), ("175%", "175"), ("200%", "200")];
|
||||
@@ -67,7 +68,7 @@ macro_rules! page {
|
||||
|
||||
page!(General {
|
||||
/// Interface language: `system` (the operating system's, where EffectCraft has it, else
|
||||
/// English), `en` or `ja`.
|
||||
/// English), or a language code from `LANGUAGES`.
|
||||
language: String = "system".into(),
|
||||
/// Levels of Undo (1–99).
|
||||
undo_levels: u32 = 32,
|
||||
|
||||
@@ -546,6 +546,12 @@ fn interface_language_is_validated_persisted_and_backward_compatible() {
|
||||
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": "uk"})).unwrap();
|
||||
assert_eq!(s.execute("prefs.get", json!({"key": "general.language"})).unwrap(), json!("uk"));
|
||||
let mut uk = Session { config: Some(store.clone()), ..Default::default() };
|
||||
uk.load_settings();
|
||||
assert_eq!(uk.prefs.general.language, "uk");
|
||||
assert_eq!(Prefs::from_json(r#"{"general":{"language":"uk"}}"#).general.language, "uk");
|
||||
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