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-21 00:12:05 +02:00
1 parent 872748fb5b
commit 1047bb355b
7 files changed
+2752 -2

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) |
| `assets/fonts/Inter-Regular.ttf`, `Inter-Medium.ttf`, `Inter-SemiBold.ttf` | Inter 4.001 (UI font) | The Inter Project Authors (Rasmus Andersson) | <https://github.com/rsms/inter> | SIL OFL 1.1, [`assets/fonts/OFL-Inter.txt`](assets/fonts/OFL-Inter.txt) |
@@ -1,5 +1,5 @@
PhotoCraft's Korean, German, Spanish, Brazilian Portuguese, Italian, Ukrainian, Dutch, Czech,
Turkish, Hungarian and Serbian UI translation catalogs are licensed under MIT OR Apache-2.0,
Turkish, Hungarian, Serbian 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.
@@ -37,3 +37,6 @@ PhotoCraft's English labels; no proprietary translation resources were used.
Serbian 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
@@ -21,6 +21,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}");
}
+23 -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; 21] = [
pub static LANGUAGES: [LangInfo; 22] = [
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() },
@@ -220,6 +220,8 @@ pub static LANGUAGES: [LangInfo; 21] = [
LangInfo { code: "tr", name: "Türkçe", source: catalog!("tr"), plural: plural_none, complete_menus: true, catalog: OnceLock::new() },
// Vietnamese; `vi-VN` resolves here.
LangInfo { code: "vi", name: "Tiếng Việt", source: catalog!("vi"), plural: plural_none, complete_menus: true, 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 {
@@ -318,6 +320,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
}
@@ -436,6 +442,7 @@ mod tests {
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 NB: fn() -> Lang = || Lang::from_code("nb").expect("nb registered");
#[test]
fn indonesian_tags_resolve() {
@@ -456,6 +463,21 @@ mod tests {
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 tags_map_to_languages() {
assert_eq!(lang_from_tag("ja_JP.UTF-8"), Some(JA()));
File diff suppressed because it is too large. Load diff
+3
View File
@@ -28,6 +28,7 @@ contextual, command-ID and plural translations; missing entries fall back to Eng
| Magyar | `hu` | one form |
| Tiếng Việt | `vi` | one form |
| Srpski | `sr` | one / few / many (teens use many) |
| 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; tests enforce that coverage. Vietnamese (`vi`) is
@@ -50,6 +51,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
+1
View File
@@ -583,6 +583,7 @@ mod tests {
("tr", "tr.tsv"),
("vi", "vi.tsv"),
("sr", "sr.tsv"),
("nb", "nb.tsv"),
] {
let catalog_path = root.join("crates/ui-egui/src/i18n").join(path);
let text = fs::read_to_string(&catalog_path).unwrap_or_default();