mirror of
https://github.com/storytold/effectcraft.git
synced 2026-10-30 21:16:52 -06:00
Polish menus (every fixed menu entry, 630 rows) and panels (every row of the Chinese panel catalogs, 695), the undo/redo, Reveal and Assign Shortcut labels, the macOS Services item, Settings ▸ General ▸ Language and Match System for pl-* locales. Tests cover the locale mapping, the settings registry and the macOS application menu. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01DukHNvUY45rjRnvtz91x33
65 lines
2.6 KiB
Rust
65 lines
2.6 KiB
Rust
/// Settings ▸ General ▸ Language: (label, `general.language` value).
|
|
pub const LANGUAGES: &[(&str, &str)] = &[
|
|
("Match System", "system"),
|
|
("English", "en"),
|
|
// Alphabetical by the language's own name after English; Cyrillic, Georgian, then CJK names
|
|
// follow the Latin ones.
|
|
("Čeština", "cs"),
|
|
("Deutsch", "de"),
|
|
("Español", "es"),
|
|
("Français", "fr"),
|
|
("Polski", "pl"),
|
|
("Português (Brasil)", "pt-br"),
|
|
("Русский", "ru"),
|
|
("Українська", "uk"),
|
|
("ქართული", "ka"),
|
|
("日本語", "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")];
|
|
|
|
/// Settings ▸ Appearance ▸ Appearance Mode: (label, `appearance.appearanceMode` value). Auto
|
|
/// follows the operating system's light or dark appearance.
|
|
pub const APPEARANCE_MODES: &[(&str, &str)] = &[("Sync with System", "auto"), ("Dark", "dark"), ("Light", "light")];
|
|
|
|
/// The dark family of themes: (label, `appearance.darkTheme` value).
|
|
pub const DARK_THEMES: &[(&str, &str)] = &[("Dark", "dark"), ("Darker", "darker")];
|
|
|
|
/// The light family of themes: (label, `appearance.lightTheme` value).
|
|
pub const LIGHT_THEMES: &[(&str, &str)] = &[("Light", "light")];
|
|
|
|
/// Every theme (the legacy single-theme `appearance.theme`).
|
|
pub const THEMES: &[(&str, &str)] = &[("Dark", "dark"), ("Darker", "darker"), ("Light", "light")];
|
|
|
|
/// The settings whose value must be one of their choices.
|
|
pub(super) fn choices(key: &str) -> Option<&'static [(&'static str, &'static str)]> {
|
|
match key {
|
|
"general.language" => Some(LANGUAGES),
|
|
"startup.windowGraphics" => Some(WINDOW_GRAPHICS),
|
|
"appearance.appearanceMode" => Some(APPEARANCE_MODES),
|
|
"appearance.darkTheme" => Some(DARK_THEMES),
|
|
"appearance.lightTheme" => Some(LIGHT_THEMES),
|
|
"appearance.theme" => Some(THEMES),
|
|
_ => None,
|
|
}
|
|
}
|
|
|
|
pub(super) fn is_choice(choices: &[(&str, &str)], v: &str) -> bool {
|
|
choices.iter().any(|(_, c)| *c == v)
|
|
}
|
|
|
|
/// The appearance mode and the per-mode setting a theme belongs to (`darker` → (`dark`,
|
|
/// `darkTheme`)); `None` for an unknown theme.
|
|
pub fn theme_family(theme: &str) -> Option<(&'static str, &'static str)> {
|
|
if is_choice(DARK_THEMES, theme) {
|
|
Some(("dark", "darkTheme"))
|
|
} else if is_choice(LIGHT_THEMES, theme) {
|
|
Some(("light", "lightTheme"))
|
|
} else {
|
|
None
|
|
}
|
|
}
|