LightCraft: An open-source non-destructive photo editor written by scratch in pure Rust
Merge PR #1855: i18n: Swedish (sv) interface translation
aiongg4764767694e2
diff --cc README.mdindex 42b164d6c,26358d37b..760360f22--- a/README.md+++ b/README.md@@@ -451,7 -405,7 +451,7 @@@ CRAFT_FONTS_DIR=../craft-fonts cargo ruWithout it LightCraft builds and runs the same, but Chinese and Japanese text have no glyphs. Fonts are never committed to thisrepo — the standard for what goes there lives with it: see 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, ქართული) or **Settings → General →-**Interface language:** **Edit → Language** (English, 简体中文, 繁體中文(台灣), 日本語, Português (Brasil), Español, Deutsch, Русский, Français, Українська, Čeština, Svenska) or **Settings → General →++**Interface language:** **Edit → Language** (English, 简体中文, 繁體中文(台灣), 日本語, Português (Brasil), Español, Deutsch, Русский, Français, Українська, Polski, Čeština, Italiano, ქართული, Svenska) or **Settings → General →Language**; 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 folderdiff --cc assets/ATTRIBUTION.mdindex 7f8a8a719,74a7d0492..2bdb934ff--- a/assets/ATTRIBUTION.md+++ b/assets/ATTRIBUTION.md@@@ -32,8 -29,7 +32,9 @@@ covers a whole directory), or if a lice| craft-fonts: optional build input, not files in this repository | BIZ UDPGothic (Regular, Bold), BIZ UDMincho Regular, Shippori Mincho Regular, Noto Sans CJK SC Regular, Noto Sans Arabic Regular, Noto Sans Thai Regular | The Noto Project Authors (Arabic and Thai); Morisawa Inc. / The BIZ UDGothic and BIZ UDMincho Project Authors; The Shippori Mincho Project Authors; Google and Adobe (Noto Sans CJK, maintainer-approved exception; see AGENTS.md) (per craft-fonts' attribution) | https://github.com/storytold/craft-fonts/blob/main/ATTRIBUTION.md | SIL Open Font License 1.1 (each font's OFL.txt in craft-fonts; release packages ship it as OFL-<family>.txt) | 2026-10-06 | none; native builds made with `CRAFT_FONTS_DIR` embed the manifest fonts (all official releases); the web build embeds BIZ UDPGothic Regular and Noto Sans Thai Regular and ships Noto Sans CJK SC Regular as a separate font file || `crates/ui-egui/locales/uk.json`, `crates/ui-egui/locales/uk-formats.json` | Ukrainian interface catalogs | @dmatviichuk with Codex; PhotoCraft, FilmCraft and VectorCraft translation contributors for reused labels | original translations from English source; 337 initial English-key matches reviewed from [PhotoCraft 69c41f3](https://github.com/storytold/photocraft/blob/69c41f3523e147eb215da8c7b4c29b18b35d1c63/crates/ui-egui/src/i18n/uk.tsv), [FilmCraft 4854c27](https://github.com/storytold/filmcraft/blob/4854c277536fe8118257362304b6a7d82d8e704b/crates/ui-egui/src/i18n/uk.tsv), [VectorCraft 4b44265](https://github.com/storytold/vectorcraft/blob/4b44265965fdd6ffedfd6182a892c1a6c360d344/crates/ui-egui/src/i18n/uk.tsv) | MIT OR Apache-2.0 (`LICENSE-MIT`, `LICENSE-APACHE`, also the source repositories' licences) | 2026-10-09 | adapted to LightCraft photo-development context, completed catalogs, reviewed spelling and placeholders || `crates/ui-egui/locales/cs.json`, `crates/ui-egui/locales/cs-formats.json` | Czech interface catalogs | @Losminek with AI assistance (Codex) | original work: translations of English source phrases, reviewed against the app UI conventions; no external translation material | MIT OR Apache-2.0 (`LICENSE-MIT`, `LICENSE-APACHE`) | 2026-10-11 | catalog coverage, Czech dates and count-neutral wording; independent scope/terminology review; native-speaker proofreading pending |+| `crates/ui-egui/locales/it.json`, `crates/ui-egui/locales/it-formats.json` | Italian interface catalogs | @GabrielePecchioli with Claude Code; PhotoCraft, VectorCraft, PdfCraft and WordCraft translation contributors for reused labels | original translations from English source; 410 initial English-key matches reviewed from [PhotoCraft da3da09](https://github.com/storytold/photocraft/blob/da3da0942c14c1159f40c652afcf33584332c733/crates/ui-egui/src/i18n/it.tsv), [VectorCraft 5432821](https://github.com/storytold/vectorcraft/blob/543282148007bcb5633c493a5374cd26b0339c8d/crates/ui-egui/src/i18n/it.tsv), [PdfCraft e8e275c](https://github.com/storytold/pdfcraft/blob/e8e275cbd40ccd0dc6b56f82b16a575571043702/crates/ui-egui/src/i18n/it.tsv) and the Italian WordCraft catalog ([storytold/wordcraft#598](https://github.com/storytold/wordcraft/pull/598)); 46 of them retranslated where the sibling's meaning didn't fit a photo app | MIT OR Apache-2.0 (`LICENSE-MIT`, `LICENSE-APACHE`, also the source repositories' licences) | 2026-10-12 | adapted to LightCraft photo-development context, count-neutral labels for Italian plural agreement, reviewed placeholders |+| `crates/ui-egui/locales/ka.json`, `crates/ui-egui/locales/ka-formats.json` | Georgian interface catalogs | Davit Matchakhelidze with Claude; WordCraft, GridCraft, PhotoCraft, FilmCraft and VectorCraft Georgian catalogs for reused labels | original translations from the English source (meaning-based, no vendor localization used); 450 English-key matches reused from the sibling Craft apps' Georgian catalogs | MIT OR Apache-2.0 (`LICENSE-MIT`, `LICENSE-APACHE`) | 2026-10-12 | adapted to LightCraft photo-library and raw-development context; count-neutral numerals; placeholders checked |+ | `crates/ui-egui/locales/sv.json`, `crates/ui-egui/locales/sv-formats.json` | Swedish interface catalogs | LightCraft contributors | original work: clean-room Swedish translations of English source phrases | MIT OR Apache-2.0 (`LICENSE-MIT`, `LICENSE-APACHE`) | 2026-10-15 | none |Notes- Fonts authored or published by Adobe (Source Sans/Serif/Code, Source Han, …) are not used, even though some arediff --cc crates/ui-egui/src/i18n.rsindex feaba9497,4f8bd0444..4df50c8e2--- a/crates/ui-egui/src/i18n.rs+++ b/crates/ui-egui/src/i18n.rs@@@ -128,8 -128,7 +128,9 @@@ language_table!Uk, "uk", "Українська", "Cyrl", include_str!("../locales/uk.json");Pl, "pl", "Polski", "Latn", include_str!("../locales/pl.json");Cs, "cs", "Čeština", "Latn", include_str!("../locales/cs.json");+ It, "it", "Italiano", "Latn", include_str!("../locales/it.json");+ Ka, "ka", "ქართული", "Geor", include_str!("../locales/ka.json");+ Sv, "sv", "Svenska", "Latn", include_str!("../locales/sv.json");}// The settings file stores the BCP-47 code (`"zh-hans"`), never the Rust variant name, so a@@@ -556,15 -517,46 +557,55 @@@ mod testsset_language(Locale::En);}+ #[test]+ fn sentence_case_keeps_georgian_lowercase() {+ assert_eq!(upper_first("its input is not an image"), "Its input is not an image");+ assert_eq!(upper_first("ფაილი ვერ იკითხება"), "ფაილი ვერ იკითხება");+ assert_eq!(upper_first("ᲥᲐᲠᲗᲣᲚᲘ"), "ᲥᲐᲠᲗᲣᲚᲘ");+ assert_eq!(upper_first(""), "");+ assert!(capitalizes('a') && capitalizes('ж') && !capitalizes('ქ') && !capitalizes('Ⴀ') && !capitalizes('ⴀ'));+ }++ #[test]+ fn swedish_switches_persists_and_formats_without_changing_user_values() {+ use crate::control::{ControlRequest, Outcome};+ let mut app = crate::LightcraftApp::new(lightcraft_engine::Session::with_demo(), Default::default());+ app.run("app.language.swedish", serde_json::json!({})).unwrap();+ assert_eq!(app.ui.language, Locale::Sv);+ assert_eq!(Locale::Sv.name(), "Svenska");+ assert_eq!(Locale::Sv.script(), "Latn");+ assert_eq!(crate::menubar::checked(&app, "app.language.swedish"), Some(true));+ assert_eq!(tr("File"), "Fil");+ assert_eq!(tr("Develop"), "Framkalla");+ assert_eq!(tr("Exposure"), "Exponering");+ assert_eq!(date_group_label("2026", false), "2026");+ assert!(date_group_label("2026-09-20", false).starts_with("Söndag 20 "), "{}", date_group_label("2026-09-20", false));+ assert_eq!(builtin_label("Warm Glow", false), "Warm Glow");+ assert_eq!(tr("photo-{title}.jpg"), "photo-{title}.jpg");+ let saved = serde_json::to_string(&app.ui).unwrap();+ assert!(saved.contains("\"sv\""), "{saved}");+ assert_eq!(serde_json::from_str::<crate::state::UiState>(&saved).unwrap().language, Locale::Sv);+ let ctx = egui::Context::default();+ for tag in ["sv", "sv-SE", "sv_SE.UTF-8", "sv-FI"] {+ assert_eq!(Locale::parse_tag(tag), Some(Locale::Sv), "{tag}");+ let (request, _) = ControlRequest::new("ui.set", serde_json::json!({"language": tag}));+ let Outcome::Done(reply) = crate::control::handle(&mut app, &ctx, &request) else { panic!("expected reply") };+ assert_eq!(reply["ok"], true);+ assert_eq!(language(), Locale::Sv);+ }+ let text = painted_text(&ctx, &mut app, Locale::Sv);+ assert!(text.contains("Fil") && text.contains("Exponering"), "{text}");+ ctx.fonts_mut(|fonts| {+ for family in [egui::FontFamily::Proportional, egui::FontFamily::Name(crate::theme::FONT_SEMIBOLD.into())] {+ let font = egui::FontId::new(13.0, family);+ for ch in "åäöÅÄÖé”’".chars() {+ assert!(fonts.has_glyph(&font, ch), "missing Swedish glyph {ch}");+ }+ }+ });+ set_language(Locale::En);+ }+#[test]fn every_language_has_a_catalog_covering_the_source() {assert!(crate::i18n::Locale::En.catalog().is_empty(), "the source language needs no catalog");@@@ -824,8 -794,7 +865,9 @@@("app.language.ukrainian", Locale::Uk),("app.language.polish", Locale::Pl),("app.language.czech", Locale::Cs),+ ("app.language.italian", Locale::It),+ ("app.language.georgian", Locale::Ka),+ ("app.language.swedish", Locale::Sv),];// One command per language, and every command reachable from the menu table.assert_eq!(commands.len(), Locale::ALL.len());diff --cc crates/ui-egui/src/menus.rsindex 3e8c3653b,e77a20b15..41267baeb--- a/crates/ui-egui/src/menus.rs+++ b/crates/ui-egui/src/menus.rs@@@ -26,8 -26,7 +26,9 @@@ pub const LANGUAGE_COMMANDS: &[UiComman("app.language.ukrainian", crate::i18n::Locale::Uk.name(), None, "Edit>Language"),("app.language.polish", crate::i18n::Locale::Pl.name(), None, "Edit>Language"),("app.language.czech", crate::i18n::Locale::Cs.name(), None, "Edit>Language"),+ ("app.language.italian", crate::i18n::Locale::It.name(), None, "Edit>Language"),+ ("app.language.georgian", crate::i18n::Locale::Ka.name(), None, "Edit>Language"),+ ("app.language.swedish", crate::i18n::Locale::Sv.name(), None, "Edit>Language"),];/// Every UI command: the languages, then everything else. `xtask parity` reads both tables from@@@ -52,8 -51,7 +53,9 @@@ pub fn language_from_command(id: &str)"app.language.ukrainian" => Some(crate::i18n::Locale::Uk),"app.language.polish" => Some(crate::i18n::Locale::Pl),"app.language.czech" => Some(crate::i18n::Locale::Cs),+ "app.language.italian" => Some(crate::i18n::Locale::It),+ "app.language.georgian" => Some(crate::i18n::Locale::Ka),+ "app.language.swedish" => Some(crate::i18n::Locale::Sv),_ => None,}}diff --cc crates/ui-egui/src/panels/keyword_list.rsindex d42aa1ff5,546d17dfd..7661e9dd7--- a/crates/ui-egui/src/panels/keyword_list.rs+++ b/crates/ui-egui/src/panels/keyword_list.rs@@@ -621,13 -621,13 +621,13 @@@ mod tests"Export Keywords…",];let dir = std::path::Path::new(env!("CARGO_MANIFEST_DIR")).join("locales");- for code in ["de", "es", "fr", "pt-br", "ru", "uk", "it", "ka", "ja", "zh-hans", "zh-hant", "pl", "cs"] {- for code in ["de", "es", "fr", "pt-br", "ru", "uk", "ja", "zh-hans", "zh-hant", "cs", "pl", "sv"] {++ for code in ["de", "es", "fr", "pt-br", "ru", "uk", "it", "ka", "ja", "zh-hans", "zh-hant", "pl", "cs", "sv"] {let text = std::fs::read_to_string(dir.join(format!("{code}.json"))).unwrap();let catalog: std::collections::HashMap<String, String> = serde_json::from_str(&text).unwrap();for label in labels {assert!(catalog.contains_key(label), "{code}: “{label}”");}}- assert_eq!(Locale::ALL.len(), 14, "a language added: list its file above");- assert_eq!(Locale::ALL.len(), 13, "a language added: list its file above");++ assert_eq!(Locale::ALL.len(), 15, "a language added: list its file above");}}diff --cc docs/localization.mdindex 84feb4d8d,b60e6318b..70effd6ae--- a/docs/localization.md+++ b/docs/localization.md@@@ -2,11 -2,11 +2,11 @@@The interface ships in the language it is written in (English) plus every language in the table in`crates/ui-egui/src/i18n.rs`. Today that is English, Simplified Chinese (`zh-hans`), Traditional- Chinese (`zh-hant`, Taiwan), Japanese (`ja`), Brazilian Portuguese (`pt-br`), Spanish (`es`), German (`de`), Russian (`ru`), French (`fr`), Ukrainian (`uk`), Czech (`cs`) and Georgian (`ka`). This file is the reference for **adding or maintaining a language**; the per-language notes-Chinese (`zh-hant`, Taiwan), Japanese (`ja`), Brazilian Portuguese (`pt-br`), Spanish (`es`), German (`de`), Russian (`ru`), French (`fr`), Ukrainian (`uk`), Czech (`cs`) and Swedish (`sv`). This file is the reference for **adding or maintaining a language**; the per-language notes++Chinese (`zh-hant`, Taiwan), Japanese (`ja`), Brazilian Portuguese (`pt-br`), Spanish (`es`), German (`de`), Russian (`ru`), French (`fr`), Ukrainian (`uk`), Czech (`cs`), Georgian (`ka`) and Swedish (`sv`). This file is the reference for **adding or maintaining a language**; the per-language notesare in [`localization-zh-hans.md`](localization-zh-hans.md), [`localization-zh-hant.md`](localization-zh-hant.md),[`localization-ja.md`](localization-ja.md), [`localization-pt-br.md`](localization-pt-br.md), [`localization-es.md`](localization-es.md),-[`localization-de.md`](localization-de.md), [`localization-ru.md`](localization-ru.md) and-[`localization-cs.md`](localization-cs.md).+[`localization-de.md`](localization-de.md), [`localization-ru.md`](localization-ru.md),+[`localization-cs.md`](localization-cs.md) and [`localization-ka.md`](localization-ka.md).## Adding a language