diff --git a/README.md b/README.md index 21ff4306ec..19f3499ab1 100644 --- a/README.md +++ b/README.md @@ -499,8 +499,7 @@ CRAFT_FONTS_DIR=../craft-fonts cargo run --release -p lightcraft Without it LightCraft builds and runs the same, but Chinese and Japanese text have no glyphs. Fonts are never committed to this repo — what goes there is described in the [craft-fonts README](https://github.com/storytold/craft-fonts#readme). -**Interface language:** **Edit → Language** (English, 简体中文, 繁體中文(台灣), 日本語, Português (Brasil), Español, Deutsch, Русский, Français, Українська, Polski, Čeština, Italiano, ქართული, Svenska, Suomi, Bahasa Indonesia, Tiếng Việt) or **Settings → General → -Language**; the choice applies immediately and persists. See [docs/localization.md](docs/localization.md). +**Interface language:** **Settings → General → Language** (English, 简体中文, 繁體中文(台灣), 日本語, Português (Brasil), Español, Deutsch, Русский, Français, Українська, Polski, Čeština, Italiano, ქართული, Svenska, Suomi, Bahasa Indonesia, Tiếng Việt); the choice applies immediately and persists. See [docs/localization.md](docs/localization.md). **Logs:** the desktop app writes its log to standard error and to `logs/lightcraft.log` in its settings folder (Linux `$XDG_CONFIG_HOME/lightcraft/logs/`, by default `~/.config/lightcraft/logs/`; macOS diff --git a/README.zh-hans.md b/README.zh-hans.md index a577a8db7b..054f2c1e81 100644 --- a/README.zh-hans.md +++ b/README.zh-hans.md @@ -422,8 +422,7 @@ CRAFT_FONTS_DIR=../craft-fonts cargo run --release -p lightcraft 不指定它时,LightCraft 构建和运行的方式完全相同,只是中文和日文文字没有字形。字体从不提交到 本仓库。 -**界面语言:** **编辑 → 语言**(English、简体中文、繁體中文(台灣)、日本語、Português (Brasil)、Español、Deutsch、Русский、Français)或 **设置 → 一般 → -语言**;选择立即生效并会保留。见 [docs/localization.md](docs/localization.md)。 +**界面语言:** **设置 → 一般 → 语言**(English、简体中文、繁體中文(台灣)、日本語、Português (Brasil)、Español、Deutsch、Русский、Français);选择立即生效并会保留。见 [docs/localization.md](docs/localization.md)。 **日志:** 桌面应用把日志写到标准错误,以及设置文件夹里的 `logs/lightcraft.log` (Linux `$XDG_CONFIG_HOME/lightcraft/logs/`,默认 `~/.config/lightcraft/logs/`;macOS diff --git a/README.zh-hant.md b/README.zh-hant.md index f2c223897a..c8079956f0 100644 --- a/README.zh-hant.md +++ b/README.zh-hant.md @@ -447,8 +447,7 @@ CRAFT_FONTS_DIR=../craft-fonts cargo run --release -p lightcraft 不指定它時,LightCraft 一樣能建置與執行,只是中文和日文文字沒有字形。字型從不提交到 本儲存庫,字型的收錄規範記載在該儲存庫:見 [craft-fonts README](https://github.com/storytold/craft-fonts#readme)。 -**介面語言:** **編輯 → 語言**(English、简体中文、繁體中文(台灣)、日本語、Português (Brasil)、Español、Deutsch、Русский、Français、Українська、Čeština、ქართული)或 **設定 → 一般 → -語言**;選擇後立即生效並會保留。詳見 [docs/localization.md](docs/localization.md)。 +**介面語言:** **設定 → 一般 → 語言**(English、简体中文、繁體中文(台灣)、日本語、Português (Brasil)、Español、Deutsch、Русский、Français、Українська、Čeština、ქართული);選擇後立即生效並會保留。詳見 [docs/localization.md](docs/localization.md)。 **記錄檔:** 桌面應用程式會把記錄檔寫到標準錯誤輸出,以及設定資料夾裡的 `logs/lightcraft.log` (Linux `$XDG_CONFIG_HOME/lightcraft/logs/`,預設為 `~/.config/lightcraft/logs/`;macOS diff --git a/crates/ui-egui/src/i18n.rs b/crates/ui-egui/src/i18n.rs index c9e0e6aead..836190bd95 100644 --- a/crates/ui-egui/src/i18n.rs +++ b/crates/ui-egui/src/i18n.rs @@ -1,10 +1,10 @@ //! Presentation-only localization. Command ids, user names and catalog data remain unchanged. //! //! A language is one entry in [`language_table!`] below: its BCP-47 code, the endonym shown in the -//! Language menus, the ISO 15924 script its text needs (which picks the CJK font fallback), and its +//! Settings language row, the ISO 15924 script its text needs (which picks the CJK font fallback), and its //! message catalog (`locales/.json`, embedded at build time). Adding a language is that entry //! plus its catalogs and the corresponding language command in `menus.rs`. Settings read the -//! locale table, while menus and the control channel share the command mapping. +//! locale table, while the control channel uses the command mapping. use std::{cell::RefCell, collections::BTreeMap, sync::OnceLock}; @@ -34,7 +34,7 @@ macro_rules! language_table { match self { Self::$source => $source_code, $(Self::$variant => $code,)* } } - /// The language's own name, as shown in the Language menus. + /// The language's own name, as shown in the Settings language row. pub const fn name(self) -> &'static str { match self { Self::$source => "English", $(Self::$variant => $name,)* } } @@ -140,7 +140,7 @@ language_table! { } impl Locale { - /// Every language in the order the Settings row and Edit ▸ Language list them: English first + /// Every language in the order the Settings row lists them: English first /// (the source language), then the rest by their own name with accents folded, so Čeština /// sits under C. Names in other scripts follow the Latin ones in code point order: Cyrillic, /// Georgian, then the CJK languages. @@ -590,9 +590,9 @@ mod picker_order_tests { } #[test] - fn language_menu_lists_the_picker_order() { + fn language_commands_list_the_picker_order() { let menu: Vec<&str> = crate::menus::LANGUAGE_COMMANDS.iter().map(|c| c.1).collect(); let picker: Vec<&str> = Locale::for_picker().into_iter().map(Locale::name).collect(); - assert_eq!(menu, picker, "Edit ▸ Language and the Settings row list the languages the same way"); + assert_eq!(menu, picker, "the language commands and the Settings row list the languages the same way"); } } diff --git a/crates/ui-egui/src/i18n/tests.rs b/crates/ui-egui/src/i18n/tests.rs index 0b7f31cf9e..4206db36f0 100644 --- a/crates/ui-egui/src/i18n/tests.rs +++ b/crates/ui-egui/src/i18n/tests.rs @@ -22,7 +22,6 @@ fn languages_switch_persist_and_keep_user_values() { app.run(&command, serde_json::json!({})).unwrap(); assert_eq!(app.ui.language, locale); assert_eq!(language(), locale); - assert_eq!(crate::menubar::checked(&app, &command), Some(true)); assert_eq!(builtin_label("Warm Glow", false), "Warm Glow"); assert_eq!(builtin_label("Warm Glow", true), locale.tr("Warm Glow")); assert_eq!(tr("photo-{title}.jpg"), "photo-{title}.jpg"); @@ -369,7 +368,7 @@ fn translated_catalogs_do_not_use_missing_menu_triangles() { } } -/// The language menu covers every language, and a language's own command selects it. +/// Every language has a command, and a language's own command selects it. #[test] fn language_commands_cover_every_language() { let commands = [ @@ -392,11 +391,11 @@ fn language_commands_cover_every_language() { ("app.language.indonesian", Locale::Id), ("app.language.vietnamese", Locale::Vi), ]; - // One command per language, and every command reachable from the menu table. + // One command per language, and every command in the UI command tables. assert_eq!(commands.len(), Locale::ALL.len()); for (id, language) in commands { assert_eq!(crate::menus::language_from_command(id), Some(language), "{id}"); - assert!(crate::menus::ui_commands().any(|command| command.0 == id), "{id} is not in the menu"); + assert!(crate::menus::ui_commands().any(|command| command.0 == id), "{id} is not a UI command"); } assert_eq!(crate::menus::language_from_command("app.language.klingon"), None); assert_eq!(crate::menus::language_from_command("view.detail"), None); @@ -586,7 +585,6 @@ fn german_switches_via_menu_and_control_and_persists() { app.run("app.language.german", serde_json::json!({})).unwrap(); assert_eq!(app.ui.language, Locale::De); assert_eq!(language(), Locale::De); - assert_eq!(crate::menubar::checked(&app, "app.language.german"), Some(true)); let saved = serde_json::to_string(&app.ui).unwrap(); assert!(saved.contains(r#""language":"de""#)); assert_eq!(serde_json::from_str::(&saved).unwrap().language, Locale::De); @@ -887,8 +885,6 @@ fn traditional_chinese_switches_through_menu_and_control_and_persists() { assert_eq!(source_label(lightcraft_engine::LibrarySource::All, &app.session.catalog), Locale::ZhHant.tr("All Photos")); assert_eq!(date_group_label("", false), Locale::ZhHant.tr("Unknown Date")); assert_eq!(display_time("a-user-value"), "a-user-value"); - assert_eq!(crate::menubar::checked(&app, "app.language.traditionalChinese"), Some(true)); - assert_eq!(crate::menubar::checked(&app, "app.language.english"), Some(false)); assert_eq!(tr("my-photo.jpg"), "my-photo.jpg"); for id in ["album.addPhotos", "metadata.applyPreset", "label.applySet"] { assert_eq!(crate::menubar::display_item_label(id, &serde_json::json!({"id": 1}), "Color"), "Color"); @@ -1275,7 +1271,6 @@ fn polish_switches_formats_dates_and_reads_every_count() { app.run("app.language.polish", serde_json::json!({})).unwrap(); assert_eq!(app.ui.language, Locale::Pl); assert_eq!(Locale::Pl.name(), "Polski"); - assert_eq!(crate::menubar::checked(&app, "app.language.polish"), Some(true)); assert_eq!(tr("File"), "Plik"); assert_eq!(tr("Exposure"), "Ekspozycja"); assert_eq!(date_group_label("2026-09-20", false), "Niedziela, 20.09.2026"); diff --git a/crates/ui-egui/src/menus/menubar.rs b/crates/ui-egui/src/menus/menubar.rs index b73729a913..e298e104c6 100644 --- a/crates/ui-egui/src/menus/menubar.rs +++ b/crates/ui-egui/src/menus/menubar.rs @@ -392,8 +392,6 @@ pub fn checked(app: &LightcraftApp, id: &str) -> Option { let u = &app.ui; let panel = |p: RightPanel| Some(u.right == p); match id { - // Every language's command is checked when it is the active one. - _ if crate::menus::language_from_command(id).is_some() => Some(crate::menus::language_from_command(id) == Some(u.language)), "develop.autoSync" => Some(app.session.auto_sync), "view.photoCounts" => Some(u.show_counts), "view.secondWindow" => Some(u.second_window), diff --git a/crates/ui-egui/src/menus/menubar/tests.rs b/crates/ui-egui/src/menus/menubar/tests.rs index cc3c5c4b0f..88019f15bf 100644 --- a/crates/ui-egui/src/menus/menubar/tests.rs +++ b/crates/ui-egui/src/menus/menubar/tests.rs @@ -852,3 +852,20 @@ fn edit_menu_places_the_select_and_paste_rows_with_their_kin() { let after = &nodes[pos("app.settings") + 1..]; assert!(!after.iter().any(|n| matches!(n, MenuNode::Item { .. })), "no row follows Settings… but a submenu: {after:?}"); } + +/// The interface language is chosen in Settings ▸ General (one choice per language), so Edit has no +/// Language submenu of 18 rows. The commands stay: agents and tests still switch language by id. +#[test] +fn edit_menu_has_no_language_submenu_because_settings_has_the_choice() { + let mut a = app(); + let bar = menu_bar(&a); + let edit = bar.iter().find(|(t, _)| t == "Edit").expect("Edit menu").1.as_slice(); + assert!(!edit.iter().any(|n| matches!(n, MenuNode::Submenu { label, .. } if label == "Language")), "Edit still has a Language submenu"); + for (title, nodes) in &bar { + for command in crate::menus::LANGUAGE_COMMANDS { + assert!(find(nodes, command.0).is_none(), "{} is in {title}", command.0); + } + } + run_item(&mut a, "app.language.german", Value::Null).expect("the command still switches language"); + assert_eq!(a.ui.language, crate::i18n::Locale::De); +} diff --git a/crates/ui-egui/src/menus/ui_commands.rs b/crates/ui-egui/src/menus/ui_commands.rs index f4398d2842..65292f8cb0 100644 --- a/crates/ui-egui/src/menus/ui_commands.rs +++ b/crates/ui-egui/src/menus/ui_commands.rs @@ -1,28 +1,29 @@ use super::UiCommand; -/// The "Edit → Language" entries, one per language in [`crate::i18n::Locale::ALL`], so a language -/// has a matching menu command (also listed through the control channel). Tests check coverage. +/// One command per language in [`crate::i18n::Locale::ALL`], so a language has a matching command +/// (also listed through the control channel). They are in no menu: Settings ▸ General has the +/// language choice. Tests check coverage. pub const LANGUAGE_COMMANDS: &[UiCommand] = &[ - ("app.language.english", crate::i18n::Locale::En.name(), None, "Edit>Language"), + ("app.language.english", crate::i18n::Locale::En.name(), None, ""), // The picker order (`Locale::for_picker`): alphabetical by the language's own name after // English; Cyrillic, Georgian, then CJK names follow the Latin ones. A test keeps them equal. - ("app.language.indonesian", crate::i18n::Locale::Id.name(), None, "Edit>Language"), - ("app.language.czech", crate::i18n::Locale::Cs.name(), None, "Edit>Language"), - ("app.language.german", crate::i18n::Locale::De.name(), None, "Edit>Language"), - ("app.language.spanish", crate::i18n::Locale::Es.name(), None, "Edit>Language"), - ("app.language.french", crate::i18n::Locale::Fr.name(), None, "Edit>Language"), - ("app.language.italian", crate::i18n::Locale::It.name(), None, "Edit>Language"), - ("app.language.polish", crate::i18n::Locale::Pl.name(), None, "Edit>Language"), - ("app.language.portuguese", crate::i18n::Locale::PtBr.name(), None, "Edit>Language"), - ("app.language.finnish", crate::i18n::Locale::Fi.name(), None, "Edit>Language"), - ("app.language.swedish", crate::i18n::Locale::Sv.name(), None, "Edit>Language"), - ("app.language.vietnamese", crate::i18n::Locale::Vi.name(), None, "Edit>Language"), - ("app.language.russian", crate::i18n::Locale::Ru.name(), None, "Edit>Language"), - ("app.language.ukrainian", crate::i18n::Locale::Uk.name(), None, "Edit>Language"), - ("app.language.georgian", crate::i18n::Locale::Ka.name(), None, "Edit>Language"), - ("app.language.japanese", crate::i18n::Locale::Ja.name(), None, "Edit>Language"), - ("app.language.simplifiedChinese", crate::i18n::Locale::ZhHans.name(), None, "Edit>Language"), - ("app.language.traditionalChinese", crate::i18n::Locale::ZhHant.name(), None, "Edit>Language"), + ("app.language.indonesian", crate::i18n::Locale::Id.name(), None, ""), + ("app.language.czech", crate::i18n::Locale::Cs.name(), None, ""), + ("app.language.german", crate::i18n::Locale::De.name(), None, ""), + ("app.language.spanish", crate::i18n::Locale::Es.name(), None, ""), + ("app.language.french", crate::i18n::Locale::Fr.name(), None, ""), + ("app.language.italian", crate::i18n::Locale::It.name(), None, ""), + ("app.language.polish", crate::i18n::Locale::Pl.name(), None, ""), + ("app.language.portuguese", crate::i18n::Locale::PtBr.name(), None, ""), + ("app.language.finnish", crate::i18n::Locale::Fi.name(), None, ""), + ("app.language.swedish", crate::i18n::Locale::Sv.name(), None, ""), + ("app.language.vietnamese", crate::i18n::Locale::Vi.name(), None, ""), + ("app.language.russian", crate::i18n::Locale::Ru.name(), None, ""), + ("app.language.ukrainian", crate::i18n::Locale::Uk.name(), None, ""), + ("app.language.georgian", crate::i18n::Locale::Ka.name(), None, ""), + ("app.language.japanese", crate::i18n::Locale::Ja.name(), None, ""), + ("app.language.simplifiedChinese", crate::i18n::Locale::ZhHans.name(), None, ""), + ("app.language.traditionalChinese", crate::i18n::Locale::ZhHant.name(), None, ""), ]; /// Every UI command: the languages, then everything else. `xtask parity` reads both tables from @@ -31,8 +32,8 @@ pub fn ui_commands() -> impl Iterator { LANGUAGE_COMMANDS.iter().chain(UI_COMMANDS) } -/// The language a Language-menu command selects, if the id is one. The engine and the UI both go -/// through here, so the menu, the settings row and the control channel agree on the mapping. +/// The language a language command selects, if the id is one. The engine and the UI both go +/// through here, so the settings row and the control channel agree on the mapping. pub fn language_from_command(id: &str) -> Option { match id { "app.language.english" => Some(crate::i18n::Locale::En), diff --git a/crates/ui-egui/src/tests/dialog_settings.rs b/crates/ui-egui/src/tests/dialog_settings.rs index 950cae6e66..4398f8c053 100644 --- a/crates/ui-egui/src/tests/dialog_settings.rs +++ b/crates/ui-egui/src/tests/dialog_settings.rs @@ -390,3 +390,21 @@ fn each_tab_remembers_how_far_it_was_scrolled() { show(&mut h, "import"); assert!((rect(&h, "check:settings.perCamera").top() - scrolled).abs() < 0.5, "Import is where it was left after a reopen"); } + +/// Settings ▸ General ▸ Language is where the interface language is chosen (Edit has no Language +/// menu): each choice switches the app at once. +#[test] +fn each_language_choice_in_general_switches_the_interface() { + let mut h = demo([1600.0, 1000.0]); + show(&mut h, "general"); + let picker = crate::i18n::Locale::for_picker(); + for (i, language) in picker.iter().enumerate() { + let r = h.request("ui.clickWidget", json!({"id": format!("button:settingsLanguage-{i}")}), T); + assert_eq!(r["ok"], true, "{language:?}: {r}"); + h.step(); + h.step(); + assert_eq!(h.app.ui.language, *language, "choice {i}"); + assert_eq!(crate::i18n::language(), *language, "choice {i} is applied at once"); + } + crate::i18n::set_language(crate::i18n::Locale::En); +} diff --git a/docs/localization-cs.md b/docs/localization-cs.md index c3ed1ddcf4..c04e8cfe4c 100644 --- a/docs/localization-cs.md +++ b/docs/localization-cs.md @@ -1,7 +1,6 @@ # Čeština -Češtinu (`cs`, English name **Czech**, native name **Čeština**) zapnete přes **Úpravy → Jazyk → -Čeština** nebo **Nastavení → Obecné → Jazyk**. Změna platí ihned a ukládá se pro další spuštění. +Češtinu (`cs`, English name **Czech**, native name **Čeština**) zapnete přes **Nastavení → Obecné → Jazyk → Čeština**. Změna platí ihned a ukládá se pro další spuštění. Příkaz je `app.language.czech`; řídicí kanál přijímá `ui.set {"language":"cs"}` i značky `cs-CZ` a `cs_CZ.UTF-8`. Pro běh bez okna lze nastavit `LIGHTCRAFT_LANGUAGE=cs`. diff --git a/docs/localization-de.md b/docs/localization-de.md index b31e9eff53..2366b83f54 100644 --- a/docs/localization-de.md +++ b/docs/localization-de.md @@ -1,6 +1,6 @@ # LightCraft auf Deutsch -Wähle **Bearbeiten → Sprache → Deutsch** oder **Einstellungen → Allgemein → Sprache**. +Wähle **Einstellungen → Allgemein → Sprache → Deutsch**. Die Auswahl gilt sofort und wird für den nächsten Start gespeichert (`language: "de"` in `ui.json`). Die deutschen Kataloge decken alle Schlüssel der bisherigen Übersetzungen sowie sämtliche diff --git a/docs/localization-es.md b/docs/localization-es.md index d8aeaa7838..91c1fad8bd 100644 --- a/docs/localization-es.md +++ b/docs/localization-es.md @@ -1,6 +1,6 @@ # LightCraft en español -Elegir **Editar → Idioma → Español** o **Ajustes → General → Idioma**. El cambio se aplica al +Elegir **Ajustes → General → Idioma → Español**. El cambio se aplica al momento y se conserva para el próximo inicio (`language: "es"` en `ui.json`). `LIGHTCRAFT_LANGUAGE` acepta cualquier variante del español (`es`, `es-ES`, `es_MX.UTF-8`, `es-419`…). diff --git a/docs/localization-fi.md b/docs/localization-fi.md index fcb89d7844..76483a99da 100644 --- a/docs/localization-fi.md +++ b/docs/localization-fi.md @@ -1,7 +1,7 @@ # Suomi Suomen (`fi`, englanniksi **Finnish**, omakielinen nimi **Suomi**) saa käyttöön valitsemalla -**Muokkaa → Kieli → Suomi** tai **Asetukset → Yleiset → Kieli**. Muutos tulee voimaan heti ja +**Asetukset → Yleiset → Kieli → Suomi**. Muutos tulee voimaan heti ja tallentuu seuraavaa käynnistystä varten. Komento on `app.language.finnish`; ohjauskanava hyväksyy `ui.set {"language":"fi"}` sekä tunnisteet `fi-FI` ja `fi_FI.UTF-8`. Ikkunattomassa ajossa voi käyttää `LIGHTCRAFT_LANGUAGE=fi`. diff --git a/docs/localization-id.md b/docs/localization-id.md index 13fc1c7ee8..328f30fe1a 100644 --- a/docs/localization-id.md +++ b/docs/localization-id.md @@ -1,6 +1,6 @@ # LightCraft in Indonesian -Choose **Edit → Language → Bahasa Indonesia** or **Settings → General → Language**. The choice applies +Choose **Settings → General → Language → Bahasa Indonesia**. The choice applies at once and is saved for the next launch (`language: "id"` in `ui.json`); the control command is `app.language.indonesian`. `LIGHTCRAFT_LANGUAGE` selects it for headless runs and accepts `id`, `id-ID` and `id_ID.UTF-8`; the saved value is always `id`. LightCraft does not follow the system language, for diff --git a/docs/localization-ja.md b/docs/localization-ja.md index 8d40688427..a9f758d6e1 100644 --- a/docs/localization-ja.md +++ b/docs/localization-ja.md @@ -3,7 +3,7 @@ LightCraft は日本語・簡体字中国語・英語(English)の表示に対応しています。 言語設定は `ui.json` の `language` に保存します。 -- 「編集 → 言語」または「設定 → 一般 → 言語」で切り替えます。選択は次回起動にも引き継ぎます。 +- 「設定 → 一般 → 言語」で切り替えます。選択は次回起動にも引き継ぎます。 - メニュー、写真編集、マスク、切り抜き、設定、読み込み、書き出し、主な処理状況を翻訳しています。 - 通常表示と太字の双方に、SIL OFLのBIZ UDPGothicを使います。日本語フォントはこのリポジトリではなく [storytold/craft-fonts](https://github.com/storytold/craft-fonts) にあり、任意のビルド入力 diff --git a/docs/localization-ka.md b/docs/localization-ka.md index 16d878794a..07f231dde9 100644 --- a/docs/localization-ka.md +++ b/docs/localization-ka.md @@ -1,6 +1,6 @@ # LightCraft in Georgian -Choose **Edit → Language → ქართული** or **Settings → General → Language**. The choice applies at once +Choose **Settings → General → Language → ქართული**. The choice applies at once and is saved for the next launch (`language: "ka"` in `ui.json`); the control command is `app.language.georgian`. `LIGHTCRAFT_LANGUAGE` selects it for headless runs and accepts `ka`, `ka-GE` and `ka_GE.UTF-8`; the saved value is always `ka`. LightCraft does not follow the system language, diff --git a/docs/localization-pl.md b/docs/localization-pl.md index 445dbcf639..81a48c9781 100644 --- a/docs/localization-pl.md +++ b/docs/localization-pl.md @@ -1,7 +1,7 @@ # Polski -Język polski (`pl`, English name **Polish**, nazwa natywna **Polski**) włącza się przez **Edytuj → Język → -Polski** albo **Ustawienia → Ogólne → Język**. Zmiana działa od razu i jest zapamiętywana przy kolejnym +Język polski (`pl`, English name **Polish**, nazwa natywna **Polski**) włącza się przez **Ustawienia → Ogólne → Język → +Polski**. Zmiana działa od razu i jest zapamiętywana przy kolejnym uruchomieniu. Polecenie to `app.language.polish`; kanał sterowania przyjmuje `ui.set {"language":"pl"}` oraz znaczniki `pl-PL` i `pl_PL.UTF-8`. Bez okna można ustawić `LIGHTCRAFT_LANGUAGE=pl`. diff --git a/docs/localization-pt-br.md b/docs/localization-pt-br.md index 72d5fcfea0..6baee8d3d0 100644 --- a/docs/localization-pt-br.md +++ b/docs/localization-pt-br.md @@ -3,7 +3,7 @@ O LightCraft pode ser exibido em inglês, chinês simplificado, chinês tradicional (Taiwan), japonês e português do Brasil. A preferência de idioma é gravada em `language` no `ui.json`. -- Troque em **Editar → Idioma** ou em **Configurações → Geral → Idioma**. A escolha é mantida nas +- Troque em **Configurações → Geral → Idioma**. A escolha é mantida nas próximas inicializações. - Traduzimos menus, edição de fotos, máscaras, recorte, configurações, importação, exportação e as principais mensagens de progresso. diff --git a/docs/localization-ru.md b/docs/localization-ru.md index 5ffbeffef5..440bd06233 100644 --- a/docs/localization-ru.md +++ b/docs/localization-ru.md @@ -1,6 +1,6 @@ # LightCraft на русском -Выберите **Правка → Язык → Русский** или **Настройки → Общие → Язык**. Выбор применяется сразу +Выберите **Настройки → Общие → Язык → Русский**. Выбор применяется сразу и сохраняется для следующего запуска (`language: "ru"` в `ui.json`). Русский каталог охватывает меню, сочетания клавиш, библиотеку, обработку, кадрирование, маски, diff --git a/docs/localization-vi.md b/docs/localization-vi.md index 2d8776d8a3..d718a2be2c 100644 --- a/docs/localization-vi.md +++ b/docs/localization-vi.md @@ -1,6 +1,6 @@ # LightCraft bằng tiếng Việt -Chọn **Chỉnh sửa → Ngôn ngữ → Tiếng Việt** hoặc **Cài đặt → Chung → Ngôn ngữ**. +Chọn **Cài đặt → Chung → Ngôn ngữ → Tiếng Việt**. Lựa chọn áp dụng ngay và được lưu cho lần mở sau (`language: "vi"` trong `ui.json`). Các tag locale hệ thống sau cũng chọn tiếng Việt: `vi`, `vi-VN`, `vi_VN`, `vi_VN.UTF-8`. diff --git a/docs/localization-zh-hans.md b/docs/localization-zh-hans.md index bf41dfed57..03a430fa95 100644 --- a/docs/localization-zh-hans.md +++ b/docs/localization-zh-hans.md @@ -2,7 +2,7 @@ LightCraft 的界面支持英语、简体中文、繁体中文(台湾)和日语。语言设置保存在 `ui.json` 的 `language` 字段中。 -- 通过「编辑 → 语言」或「设置 → 一般 → 语言」切换,选择会保留到下次启动。 +- 通过「设置 → 一般 → 语言」切换,选择会保留到下次启动。 - 已翻译的范围与 `zh-hant.json` 键集完全一致(1246 条),两份目录的键与键序一一对应。 - 正文字重与半粗体都使用 SIL OFL 的 **Noto Sans CJK SC**(简体中文)与 BIZ UDPGothic(日语)。 这些字体不在本仓库,而在 [storytold/craft-fonts](https://github.com/storytold/craft-fonts); diff --git a/docs/localization-zh-hant.md b/docs/localization-zh-hant.md index abf1af6514..858eef8792 100644 --- a/docs/localization-zh-hant.md +++ b/docs/localization-zh-hant.md @@ -1,6 +1,6 @@ # LightCraft 繁體中文(台灣)介面 -從「編輯 → 語言 → 繁體中文(台灣)」切換,或開啟「設定 → 一般 → 語言」選擇。 +從「設定 → 一般 → 語言 → 繁體中文(台灣)」切換。 macOS 的設定也可由「LightCraft → 設定…」或 `⌘,` 開啟。 語言立即生效,並儲存在應用程式設定的 `ui.json`,下次啟動會沿用。 英文、簡體中文、繁體中文與日文可隨時互相切換。 diff --git a/docs/localization.md b/docs/localization.md index 36a28d5447..446d914892 100644 --- a/docs/localization.md +++ b/docs/localization.md @@ -39,12 +39,12 @@ are in [`localization-zh-hans.md`](localization-zh-hans.md), [`localization-zh-h ``` The fields are the BCP-47 code (also the settings-file value), the **endonym** shown in the - Language menu, the ISO 15924 script (`Latn`, `Jpan`, `Hans`, `Hant`, `Kore`…), and the embedded + Settings language row, the ISO 15924 script (`Latn`, `Jpan`, `Hans`, `Hant`, `Kore`…), and the embedded catalog. `build.rs` picks up `-formats.json` by name, so the macro and the format lookup follow automatically. Add the corresponding `app.language.` entry to `LANGUAGE_COMMANDS` and `language_from_command` in `src/menus.rs`, and to the - `language_commands_cover_every_language` test. Settings read the locale table; menus and - the control channel share the language-command mapping. + `language_commands_cover_every_language` test. Settings read the locale table; the control + channel uses the language commands (they are in no menu). 3. **Make sure the glyphs exist.** The script drives which craft-fonts faces the UI installs: a language whose script has no face in the build shows boxes (the test says so instead of failing). Fonts live in [storytold/craft-fonts](https://github.com/storytold/craft-fonts), never here; a diff --git a/docs/parity-checklist.md b/docs/parity-checklist.md index 99381ec5f5..ecfacd2936 100644 --- a/docs/parity-checklist.md +++ b/docs/parity-checklist.md @@ -482,7 +482,7 @@ differences and missing bindings are in [ui-parity.md](ui-parity.md#shortcuts). | LR-BEHAV-TEXTFIELD | Text fields behave alike | P1 | 🟡 | `crates/ui-egui/src/widgets/text_field.rs`, `crates/ui-egui/src/panels/topbar.rs`, `crates/ui-egui/src/widgets.rs`, `crates/ui-egui/src/panels/right.rs` (`meta_field`), `crates/ui-egui/src/dialogs.rs`, `crates/ui-egui/src/panels/unnamed.rs` | one shared field: right-click Cut / Copy / Paste / Select All (no Paste in the browser), Esc gives back the text from before the edit, Return / leaving / Esc reported to the caller, optional select-on-focus; agents use `ui.clipboard` (MCP `clipboard`) and `ui.inspect` → `copied`. Used by Search Photos, slider values, the Info panel's metadata fields (multi-line captions), the one-field dialogs (New / Rename Album, New Smart Album, Rename / Merge Keywords, text prompts) and the unnamed faces' name field so far; the other text fields (most dialogs, import, settings, masking, keywords …) still use egui's own and have no menu | | LR-BEHAV-HEADLESS | Headless UI snapshots | P2 | ✅ | `apps/lightcraft-cli/src/main.rs`, `crates/ui-egui/src/headless.rs`, `docs/control-protocol.md` | `snapshot` rasterizes the UI and defaults photo development to the CPU before the first frame, without adapter discovery; scaled dimensions are validated before allocation, and UI zoom preserves the requested physical viewport; JSON-lines control scripts are supported | | LR-BEHAV-ACCESS | Accessibility | P2 | 🟡 | `crates/ui-egui/src/widgets.rs`, `crates/ui-egui/src/widgets/text_field.rs`, `crates/ui-egui/src/panels/grid.rs`, `crates/ui-egui/tests/it/accessibility.rs` | AccessKit (VoiceOver / Narrator / AT-SPI): sliders announce control, value, range and step and take Increment / Decrement (the value field beside each is named ` value` and describes how to type or drag), buttons / icon buttons / dropdowns / section headers / sources their labels and state, text fields their caption, grid thumbnails file name, rating, flag and label. `tests/it/accessibility.rs` fails on an unnamed control, a slider without range or an untitled dialog in every view, Develop tool and 13 dialogs, and checks that Crop and Remove sliders are reached with Tab and that Tab walks the right panels top to bottom. Canvas tools by keyboard (`crates/ui-egui/src/canvas_keys.rs`, `crates/ui-egui/src/tests/canvas_keys.rs`): crop corners, edges and box, spot targets and sources, a New spot point (Return adds), radial / linear gradient handles and mask pins take the focus, are announced with their position and move with the arrows (Shift: further). Dialogs with one name field (New Album, New Smart Album, Save Metadata Preset, the renames) take the focus once when they open, so Tab and Shift+Tab reach their check box, Cancel and OK, and Return and Esc still confirm and cancel (`crates/ui-egui/src/tests/dialog_tab.rs`). The photo in Detail is named like its grid cell, `Photo: , , ,