diff --git a/crates/ui-egui/src/i18n/tests.rs b/crates/ui-egui/src/i18n/tests.rs index e3464cf98a..f30edd8c86 100644 --- a/crates/ui-egui/src/i18n/tests.rs +++ b/crates/ui-egui/src/i18n/tests.rs @@ -39,6 +39,18 @@ fn translations(code: &str) -> String { lang.catalog_texts().flat_map(rows).flat_map(|(_, _, t)| t.split('|').map(str::to_owned).collect::>()).collect() } +#[test] +fn the_macos_bundle_declares_every_interface_language() { + // AppKit translates its own dialogs (open and save panels) only into the languages the app + // bundle declares, so `CFBundleLocalizations` must list every entry of `LANGUAGES`. + let plist = include_str!("../../../../packaging/macos/Info.plist.in"); + let block = plist.split("CFBundleLocalizations").nth(1).expect("the template declares CFBundleLocalizations"); + let block = block.split("").next().expect("the declaration is an array"); + let declared: Vec = block.split("").skip(1).filter_map(|s| s.split("").next()).map(str::to_lowercase).collect(); + let registered: Vec = LANGUAGES.iter().map(|l| l.code.to_lowercase()).collect(); + assert_eq!(declared, registered, "packaging/macos/Info.plist.in and LANGUAGES list different languages"); +} + #[test] fn keyboard_key_names_have_a_separate_context_and_english_fallback() { let keys = fixture_lang("x-keys", "key\tDelete\tEntf\n\tDelete\tLöschen\n\tOpen\tÖffnen\n"); diff --git a/packaging/macos/Info.plist.in b/packaging/macos/Info.plist.in index cfc7d2d08e..f38f186c82 100644 --- a/packaging/macos/Info.plist.in +++ b/packaging/macos/Info.plist.in @@ -6,6 +6,46 @@ CFBundleDevelopmentRegion en + + CFBundleLocalizations + + en + ja + zh-Hans + zh-Hant + cs + pt-BR + de + es + fr + ru + kk + bg + te + hu + uk + it + ar + ckb + fa + pl + sl + el + tr + lt + id + vi + fi + sq + th + ca + ro + lo + hi + ko + nb + CFBundleDisplayName PdfCraft CFBundleName