Add Norwegian Bokmål interface translation (#4544) (#4556)

* claim: #4544

* Add Norwegian Bokmål translation

* Refresh Norwegian Bokmål translations against current main

* Drop Norwegian messages whose ids are no longer in the English catalogue

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

---------

Co-authored-by: bherbruck <brennen.herbruck@gmail.com>
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Vetle Marentius Nilsen
2026-10-25 18:49:00 +00:00
committed by GitHub
parent 87c9a37663
commit 0e916ee598
5 changed files with 2257 additions and 4 deletions
+1
View File
@@ -158,6 +158,7 @@ Editable drawing code, native projects and shipped exports are collected under `
| assets/locales/ja.json | SolidCraft contributors | Original SolidCraft resource data or drawing code, collected without redesign | MIT OR Apache-2.0 |
| assets/locales/ko.json | SolidCraft contributors | Original SolidCraft resource data or drawing code, collected without redesign | MIT OR Apache-2.0 |
| assets/locales/ms.json | A.Hakim (a-hakim) | Malay translation of the English message catalog | MIT OR Apache-2.0 |
| assets/locales/nb.json | SolidCraft contributors | Original Norwegian Bokmål translation of SolidCraft's English catalog; no commercial CAD text used | MIT OR Apache-2.0 |
| assets/locales/nl.json | SolidCraft contributors | Original Dutch translation of SolidCraft's English catalog; no commercial CAD text used | MIT OR Apache-2.0 |
| assets/locales/pl.json | cyryllo | Polish translation of the English catalog, contributed upstream | MIT OR Apache-2.0 |
| assets/locales/ru.json | Alex Pro (del000) | Russian translation of the English catalog, contributed upstream | MIT OR Apache-2.0 |
File diff suppressed because it is too large Load Diff
+4 -2
View File
@@ -893,6 +893,7 @@ fn the_sections_messages_are_in_every_catalog() {
("de", include_str!(concat!(env!("OUT_DIR"), "/locales/de.json"))),
("ja", include_str!(concat!(env!("OUT_DIR"), "/locales/ja.json"))),
("ko", include_str!(concat!(env!("OUT_DIR"), "/locales/ko.json"))),
("nb", include_str!(concat!(env!("OUT_DIR"), "/locales/nb.json"))),
("pl", include_str!(concat!(env!("OUT_DIR"), "/locales/pl.json"))),
("ru", include_str!(concat!(env!("OUT_DIR"), "/locales/ru.json"))),
("zh", include_str!(concat!(env!("OUT_DIR"), "/locales/zh.json"))),
@@ -902,8 +903,9 @@ fn the_sections_messages_are_in_every_catalog() {
let (Some(en), Some(here)) = (english.get(*id), catalog.get(*id)) else {
panic!("{lang}: missing message {id} (English: {})", english.contains_key(*id));
};
// Danish uses the same established names for these colour-vision modes.
let shared_name = lang == "da" && ["ui.colour_vision_deutan", "ui.colour_vision_protan", "ui.colour_vision_tritan"].contains(id);
// Danish and Norwegian use the same established names for these colour-vision modes.
let shared_name =
matches!(lang, "da" | "nb") && ["ui.colour_vision_deutan", "ui.colour_vision_protan", "ui.colour_vision_tritan"].contains(id);
assert!(lang == "de" || shared_name || here != en, "{lang}: {id} is the English text {en}");
}
}
+3
View File
@@ -46,6 +46,7 @@ static ITALIAN: Catalog = Catalog::new("it", "Italiano", include_str!(concat!(en
static JAPANESE: Catalog = Catalog::new("ja", "日本語", include_str!(concat!(env!("OUT_DIR"), "/locales/ja.json")));
static KOREAN: Catalog = Catalog::new("ko", "한국어", include_str!(concat!(env!("OUT_DIR"), "/locales/ko.json")));
static MALAY: Catalog = Catalog::new("ms", "Bahasa Melayu", include_str!(concat!(env!("OUT_DIR"), "/locales/ms.json")));
static NORWEGIAN: Catalog = Catalog::new("nb", "Norsk bokmål", include_str!(concat!(env!("OUT_DIR"), "/locales/nb.json")));
static DUTCH: Catalog = Catalog::new("nl", "Nederlands", include_str!(concat!(env!("OUT_DIR"), "/locales/nl.json")));
static POLISH: Catalog = Catalog::new("pl", "Polski", include_str!(concat!(env!("OUT_DIR"), "/locales/pl.json")));
static PORTUGUESE_BR: Catalog = Catalog::new("pt-BR", "Português (Brasil)", include_str!(concat!(env!("OUT_DIR"), "/locales/pt-BR.json")));
@@ -75,6 +76,7 @@ pub const LOCALES: &[&Catalog] = &[
&JAPANESE,
&KOREAN,
&MALAY,
&NORWEGIAN,
&DUTCH,
&POLISH,
&PORTUGUESE_BR,
@@ -480,6 +482,7 @@ mod tests {
let cases = [
("cs", "Příruba", "Zebra analýza", "Studie pohybu"),
("da", "Flange", "Zebraanalyse", "Bevægelsesanalyse"),
("nb", "Flens", "Zebraanalyse", "Bevegelsesanalyse"),
("zh", "法兰", "斑马纹分析", "运动研究"),
("ja", "フランジ", "ゼブラ解析", "モーション スタディ"),
("de", "Flansch", "Zebra-Analyse", "Bewegungsuntersuchung"),
+11 -2
View File
@@ -1,7 +1,7 @@
# UI localization
SolidCraft embeds its translations and works offline. English, Czech, Danish, German, English (UK), Spanish, French, Galician, Italian,
Japanese, Korean, Malay, Polish, Brazilian Portuguese, Russian, Turkish, Ukrainian and Chinese are currently registered in `crates/ui-egui/src/i18n.rs`. Adding a language requires an
Japanese, Korean, Malay, Norwegian Bokmål, Dutch, Polish, Brazilian Portuguese, Russian, Turkish, Ukrainian and Chinese are currently registered in `crates/ui-egui/src/i18n.rs`. Adding a language requires an
embedded catalog and one registration there; the preferences selector and validation use the same
registry.
@@ -44,7 +44,7 @@ that looks untranslated. Two guards catch that in the build:
- `every_complete_catalog_carries_every_english_message` — adding a key to `en.json`
without giving it to a complete catalog fails the tests. English is the source catalog,
Japanese and Chinese are delivered complete; Danish, German, Spanish, Galician, Italian, Korean, Malay, Polish, Brazilian Portuguese, Russian, French, Ukrainian and
Japanese and Chinese are delivered complete; Danish, German, Spanish, Galician, Italian, Korean, Malay, Norwegian Bokmål, Polish, Brazilian Portuguese, Russian, French, Ukrainian and
Turkish are partial — their gaps fall back to English and are reported by `cargo xtask i18n` without
failing the build. A new label needs en, ja, zh, de and ko; Russian, French, Ukrainian and Malay may
follow later.
@@ -80,6 +80,15 @@ is Bozza; Counterbore is Lamatura and Countersink is Svasatura. Established tech
terms such as Loft, Sweep, Spline and Offset remain unchanged. Command IDs, shortcuts,
file formats, units and user-provided names are not translated.
The Norwegian Bokmål catalog (`nb`, shown as Norsk bokmål) uses Skisse (Sketch),
Kropp (Body), Funksjon (timeline Feature), Binding (Constraint), Avrunding (Fillet)
and Fas (Chamfer). Ground/Unground are Fest posisjon/Frigjør posisjon, Draft is
Slippvinkel, Flat Pattern is Utbretting, and Counterbore/Countersink are Sylindrisk
forsenkning/Konisk forsenkning. Capture Position is Registrer posisjon, while
sketch snapping is Punktfangst. Loft, Sweep, Spline and Offset remain technical
terms. Command IDs, shortcuts, file formats, units and user-provided names stay
unchanged.
One immutable `Locale` type handles all translations. Table widgets without an app reference
use a render scope that restores the previous locale when it exits, including nested renders.
Standalone translated panels enter the same scope. Measure rendered text to size custom