i18n: Norwegian Bokmål catalog (nb)

- nb.tsv covers every enforced key: menus, tl! literals, blend modes, brush sections, font weights, camera data and the generated preference labels (cargo xtask i18n-coverage: 1905/1905)
- Registered with the one|other plural rule; nb-NO, the macrolanguage no and Nynorsk nn-NO locales resolve to it
- License, attribution and localization docs updated
This commit is contained in:
Nikolai Nyegaard committed 2026-10-28 12:34:46 +01:00
1 parent 1f7fc0f536
commit a049906e43
7 files changed
+3015 -3

No files matched your search

+1
View File
@@ -23,6 +23,7 @@ next to them.
| `crates/ui-egui/src/i18n/cs.tsv` | Czech UI translations | PhotoCraft contributors | Original translations of PhotoCraft's English labels | MIT OR Apache-2.0, [`LICENSE-translations.txt`](crates/ui-egui/src/i18n/LICENSE-translations.txt) |
| `crates/ui-egui/src/i18n/hu.tsv` | Hungarian UI translations | PhotoCraft contributors | Original translations of PhotoCraft's English labels | MIT OR Apache-2.0, [`LICENSE-translations.txt`](crates/ui-egui/src/i18n/LICENSE-translations.txt) |
| `crates/ui-egui/src/i18n/vi.tsv` | Vietnamese UI translations | PhotoCraft contributors | Original translations of PhotoCraft's English labels | MIT OR Apache-2.0, [`LICENSE-translations.txt`](crates/ui-egui/src/i18n/LICENSE-translations.txt) |
| `crates/ui-egui/src/i18n/nb.tsv` | Norwegian Bokmål UI translations | PhotoCraft contributors | Original translations of PhotoCraft's English labels | MIT OR Apache-2.0, [`LICENSE-translations.txt`](crates/ui-egui/src/i18n/LICENSE-translations.txt) |
| `crates/ui-egui/src/i18n/tr.tsv` | Turkish UI translations | PhotoCraft contributors | Original translations of PhotoCraft's English labels | MIT OR Apache-2.0, [`LICENSE-translations.txt`](crates/ui-egui/src/i18n/LICENSE-translations.txt) |
| `crates/ui-egui/src/i18n/sr.tsv` | Serbian (Latin, Ekavian) UI translations | PhotoCraft contributors | Original translations of PhotoCraft's English labels | MIT OR Apache-2.0, [`LICENSE-translations.txt`](crates/ui-egui/src/i18n/LICENSE-translations.txt) |
| `crates/ui-egui/src/i18n/ru.tsv` | Russian UI translations | PhotoCraft contributors | Original translations of PhotoCraft's English labels | MIT OR Apache-2.0, [`LICENSE-translations.txt`](crates/ui-egui/src/i18n/LICENSE-translations.txt) |
+7 -1
View File
@@ -187,7 +187,7 @@ fn expand(packed: &str, keys: &[&str]) -> Result<String, String> {
}
/// The registry. English first: it is the fallback and the source language.
pub static LANGUAGES: [LangInfo; 22] = [
pub static LANGUAGES: [LangInfo; 23] = [
LangInfo { code: "en", name: "English", source: b"", plural: plural_one_other, complete_menus: false, catalog: OnceLock::new() },
LangInfo { code: "ja", name: "日本語", source: catalog!("ja"), plural: plural_none, complete_menus: true, catalog: OnceLock::new() },
LangInfo { code: "zh-hans", name: "简体中文", source: catalog!("zh-hans"), plural: plural_none, complete_menus: true, catalog: OnceLock::new() },
@@ -222,6 +222,8 @@ pub static LANGUAGES: [LangInfo; 22] = [
LangInfo { code: "vi", name: "Tiếng Việt", source: catalog!("vi"), plural: plural_none, complete_menus: true, catalog: OnceLock::new() },
// Hindi; `hi`, `hi-IN` locales resolve here.
LangInfo { code: "hi", name: "हिन्दी", source: catalog!("hi"), plural: plural_one_other, complete_menus: false, catalog: OnceLock::new() },
// Norwegian Bokmål; `nb-NO`, the macrolanguage `no` and Nynorsk `nn` locales resolve here.
LangInfo { code: "nb", name: "Norsk bokmål", source: catalog!("nb"), plural: plural_one_other, complete_menus: true, catalog: OnceLock::new() },
];
impl LangInfo {
@@ -351,6 +353,10 @@ fn candidates(tag: &str) -> Vec<String> {
// The only Portuguese catalog is Brazilian; other regions use it rather than English.
out.insert(out.len() - 1, "pt-br".to_string());
}
if matches!(primary, "no" | "nn") && !out.iter().any(|c| c == "nb") {
// The only Norwegian catalog is Bokmål; the macrolanguage code and Nynorsk use it rather than English.
out.insert(out.len() - 1, "nb".to_string());
}
out
}
@@ -1,6 +1,6 @@
PhotoCraft's Korean, German, Spanish, Brazilian Portuguese, Italian, Ukrainian, Dutch, Czech,
Turkish, Hungarian, Serbian and Russian UI translation catalogs are licensed under MIT OR
Apache-2.0, at your option.
Turkish, Hungarian, Serbian, Russian and Norwegian Bokmål UI translation catalogs are licensed
under MIT OR Apache-2.0, at your option.
The full license texts are in ../../../../LICENSE-MIT and ../../../../LICENSE-APACHE.
Korean translations: PhotoCraft contributors, original translations of
@@ -40,3 +40,6 @@ PhotoCraft's English labels; no proprietary translation resources were used.
Russian translations: PhotoCraft contributors, original translations of
PhotoCraft's English labels; no proprietary translation resources were used.
Norwegian Bokmål translations: PhotoCraft contributors, original translations of
PhotoCraft's English labels; no proprietary translation resources were used.
+1
View File
@@ -28,6 +28,7 @@ fn requested_languages_resolve_regional_preferences() {
("id-ID", "id"),
("vi-VN", "vi"),
("sr-RS", "sr"),
("nb-NO", "nb"),
] {
assert_eq!(Lang::from_pref(tag), lang(code), "{tag}");
}
File diff suppressed because it is too large. Load diff
+16
View File
@@ -7,6 +7,7 @@ const CS: fn() -> Lang = || Lang::from_code("cs").expect("cs registered");
const ID: fn() -> Lang = || Lang::from_code("id").expect("id registered");
const VI: fn() -> Lang = || Lang::from_code("vi").expect("vi registered");
const HI: fn() -> Lang = || Lang::from_code("hi").expect("hi registered");
const NB: fn() -> Lang = || Lang::from_code("nb").expect("nb registered");
#[test]
fn hindi_tags_resolve() {
@@ -36,6 +37,21 @@ fn vietnamese_tags_resolve() {
assert_eq!(Lang::from_pref("VI"), VI());
}
#[test]
fn norwegian_tags_resolve() {
for tag in ["nb", "nb-NO", "nb_NO", "nb_NO.UTF-8", "no", "no-NO", "no_NO.UTF-8", "nn", "nn-NO", "nn_NO.UTF-8"] {
assert_eq!(lang_from_tag(tag), Some(NB()), "{tag}");
}
assert_eq!(candidates("nn_NO"), ["nn-no", "nb", "nn"]);
assert_eq!(NB().name(), "Norsk bokmål");
assert!(NB().complete_menus(), "Norwegian Bokmål translates every source key");
assert_eq!(Lang::from_pref("nb"), NB());
assert_eq!(Lang::from_pref("NB"), NB());
assert_eq!(tr(NB(), "Layer"), "Lag");
assert_eq!(trn(NB(), 1, "{n} item", "{n} items"), "1 element");
assert_eq!(trn(NB(), 2, "{n} item", "{n} items"), "2 elementer");
}
#[test]
fn picker_lists_english_first_then_names_alphabetically() {
let order = Lang::for_picker();
+3
View File
@@ -29,6 +29,7 @@ contextual, command-ID and plural translations; missing entries fall back to Eng
| Tiếng Việt | `vi` | one form |
| Srpski | `sr` | one / few / many (teens use many) |
| हिन्दी | `hi` | one / other |
| Norsk bokmål | `nb` | one / other |
Languages registered with `complete_menus` cover the current menu labels, `tl!` literals, blend
mode names, and generated preference labels. A string a catalog lacks shows in English:
@@ -53,6 +54,8 @@ native system locale; an unsupported code follows the same fallback. Regional ta
Simplified Chinese remain distinct. Every Portuguese locale (`pt`, `pt-BR`, `pt-PT`) uses the
Brazilian Portuguese catalog. The Serbian catalog is written in Latin script (Ekavian); every
Serbian locale (`sr-RS`, `sr-Latn-RS`, `sr_RS@latin`, and Cyrillic `sr-Cyrl-RS`) resolves to it.
The Norwegian catalog is Bokmål; `nb-NO`, the macrolanguage `no` and Nynorsk `nn-NO` all resolve
to it.
### First launch and system language