Add Brazilian Portuguese translation (#1688) (#1735)

Thanks @DuBearte.
This commit is contained in:
DuBearte authored and GitHub committed 2026-10-16 10:26:31 -04:00
1 parent bba03803b7
commit 88f76adbc2
4 files changed
+1478 -3

No files matched your search

+1
View File
@@ -99,6 +99,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/ru.json | Alex Pro (del000) | Russian translation of the English catalog, contributed upstream | MIT OR Apache-2.0 |
| assets/locales/pt-BR.json | DuBearte | Brazilian Portuguese translation of the English catalog, contributed upstream | MIT OR Apache-2.0 |
| assets/locales/tr.json | macrulz54 | Turkish translation of the English catalog, contributed upstream | MIT OR Apache-2.0 |
| assets/locales/uk.json | Igor Bronovskyi (BrunIF) | Ukrainian translation of the English catalog, contributed upstream | MIT OR Apache-2.0 |
| assets/locales/zh.json | SolidCraft contributors | Original SolidCraft resource data or drawing code, collected without redesign | MIT OR Apache-2.0 |
File diff suppressed because it is too large. Load diff
+14
View File
@@ -36,6 +36,8 @@ static GERMAN: Catalog = Catalog::new("de", "Deutsch", include_str!(concat!(env!
static FRENCH: Catalog = Catalog::new("fr", "Français", include_str!(concat!(env!("CARGO_MANIFEST_DIR"), "/../../assets/locales/fr.json")));
static JAPANESE: Catalog = Catalog::new("ja", "日本語", include_str!(concat!(env!("CARGO_MANIFEST_DIR"), "/../../assets/locales/ja.json")));
static KOREAN: Catalog = Catalog::new("ko", "한국어", include_str!(concat!(env!("CARGO_MANIFEST_DIR"), "/../../assets/locales/ko.json")));
static PORTUGUESE_BR: Catalog =
Catalog::new("pt-BR", "Português (Brasil)", include_str!(concat!(env!("CARGO_MANIFEST_DIR"), "/../../assets/locales/pt-BR.json")));
static RUSSIAN: Catalog = Catalog::new("ru", "Русский", include_str!(concat!(env!("CARGO_MANIFEST_DIR"), "/../../assets/locales/ru.json")));
static TURKISH: Catalog = Catalog::new("tr", "Türkçe", include_str!(concat!(env!("CARGO_MANIFEST_DIR"), "/../../assets/locales/tr.json")));
static UKRAINIAN: Catalog = Catalog::new("uk", "Українська", include_str!(concat!(env!("CARGO_MANIFEST_DIR"), "/../../assets/locales/uk.json")));
@@ -49,6 +51,7 @@ pub const LOCALES: &[&Catalog] = &[
&FRENCH,
&JAPANESE,
&KOREAN,
&PORTUGUESE_BR,
&RUSSIAN,
&TURKISH,
&UKRAINIAN,
@@ -542,6 +545,17 @@ mod tests {
assert_eq!(tr.label("NonExistentKey"), "NonExistentKey");
}
#[test]
fn brazilian_portuguese_catalog_is_registered_and_translates_keys() {
let pt = Locale::for_language("pt-BR");
assert_eq!(pt.name(), "Português (Brasil)");
assert!(is_supported("pt-BR"));
assert_eq!(pt.text("ui.preferences"), "Preferências");
assert_eq!(pt.format("document.save_changes", &[("name", "My {design}")]), "Salvar as alterações em My {design}?");
assert_eq!(pt.format("dialog.selected_count", &[("count", "2")]), "↖ 2 selecionados");
assert_eq!(pt.label("NonExistentKey"), "NonExistentKey");
}
#[test]
fn ukrainian_catalog_translates_keys_labels_and_browser_patterns() {
let uk = Locale::for_language("uk");
+3 -3
View File
@@ -1,7 +1,7 @@
# UI localization
SolidCraft embeds its translations and works offline. English, Japanese, German, French, Korean,
Russian, Ukrainian, Turkish and Chinese are currently registered in `crates/ui-egui/src/i18n.rs`. Adding a language requires an
Brazilian Portuguese, Russian, Ukrainian, Turkish 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.
@@ -31,8 +31,8 @@ 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; German, Korean, Russian, French, Ukrainian and Turkish are
partial — their gaps fall back to English and are reported by `cargo xtask i18n` without
Japanese and Chinese are delivered complete; German, Korean, 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 and Ukrainian may
follow later.
- `every_toolbar_tab_and_panel_is_in_the_english_catalog` — tabs and panels reach the UI as bare