Add Turkish translation (#1520)

Registers a Turkish (tr) catalog with its attribution, docs and a test.

Co-authored-by: macrulz54 <[email protected]>
Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
This commit is contained in:
authored and GitHub committed 2026-10-15 18:47:46 -04:00
1 parent f7967b1ff6
commit 1c9d6617ad
4 files changed
+1397 -3

No files matched your search

+1
View File
@@ -96,6 +96,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/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 |
| assets/materials/library.rs | 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
+13 -1
View File
@@ -38,8 +38,9 @@ static FRENCH: Catalog = Catalog::new("fr", "Français", include_str!(concat!(en
static KOREAN: Catalog = Catalog::new("ko", "한국어", include_str!(concat!(env!("CARGO_MANIFEST_DIR"), "/../../assets/locales/ko.json")));
static RUSSIAN: Catalog = Catalog::new("ru", "Русский", include_str!(concat!(env!("CARGO_MANIFEST_DIR"), "/../../assets/locales/ru.json")));
static UKRAINIAN: Catalog = Catalog::new("uk", "Українська", include_str!(concat!(env!("CARGO_MANIFEST_DIR"), "/../../assets/locales/uk.json")));
static TURKISH: Catalog = Catalog::new("tr", "Türkçe", include_str!(concat!(env!("CARGO_MANIFEST_DIR"), "/../../assets/locales/tr.json")));
static CHINESE: Catalog = Catalog::new("zh", "中文", include_str!(concat!(env!("CARGO_MANIFEST_DIR"), "/../../assets/locales/zh.json")));
pub const LOCALES: &[&Catalog] = &[&ENGLISH, &JAPANESE, &GERMAN, &FRENCH, &KOREAN, &RUSSIAN, &UKRAINIAN, &CHINESE];
pub const LOCALES: &[&Catalog] = &[&ENGLISH, &JAPANESE, &GERMAN, &FRENCH, &KOREAN, &RUSSIAN, &UKRAINIAN, &TURKISH, &CHINESE];
pub fn is_supported(id: &str) -> bool {
LOCALES.iter().any(|catalog| catalog.id == id)
@@ -508,6 +509,17 @@ mod tests {
assert_eq!(fr.dynamic("Sketch of bracket"), "Sketch of bracket");
}
#[test]
fn turkish_catalog_is_registered_and_translates_keys() {
let tr = Locale::for_language("tr");
assert_eq!(tr.name(), "Türkçe");
assert!(is_supported("tr"));
assert_eq!(tr.text("ui.preferences"), "Ayarlar");
assert_eq!(tr.format("document.save_changes", &[("name", "My {design}")]), "My {design} içindeki değişiklikler kaydedilsin mi?");
assert_eq!(tr.format("dialog.selected_count", &[("count", "2")]), "↖ 2 seçildi");
assert_eq!(tr.label("NonExistentKey"), "NonExistentKey");
}
#[test]
fn ukrainian_catalog_translates_keys_labels_and_browser_patterns() {
let uk = Locale::for_language("uk");
+2 -2
View File
@@ -1,7 +1,7 @@
# UI localization
SolidCraft embeds its translations and works offline. English, Japanese, German, French, Korean,
Russian, Ukrainian and Chinese are currently registered in `crates/ui-egui/src/i18n.rs`. Adding a language requires an
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,7 +31,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; German, Korean, Russian, French and Ukrainian are
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
failing the build. A new label needs en, ja, zh, de and ko; Russian, French and Ukrainian may
follow later.