i18n: add Vietnamese (vi) localization support (#2915)
* i18n: add Vietnamese (vi) localization support Add Vietnamese (vi) message catalog with 1,583 translated keys covering CAD modeling commands, UI dialogs, timeline, analysis tools, and AI agent chat. Register VIETNAMESE catalog in ui-egui/src/i18n.rs and add unit test verifying translations, labels, and dynamic browser naming. * chore: attribute Vietnamese locale and sort catalog * i18n: fix corrupted and half-English strings in Vietnamese catalog * i18n: polish residual command and UI translations in Vietnamese catalog
This commit is contained in:
@@ -102,6 +102,7 @@ Editable drawing code, native projects and shipped exports are collected under `
|
||||
| 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/vi.json | vandang890615 | Vietnamese 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 |
|
||||
| assets/platforms/linux/ai.storyteller.solidcraft.desktop | PhotoCraft / SolidCraft contributors | PhotoCraft packaging templates (https://github.com/storytold/photocraft), adapted for SolidCraft | Apache-2.0 |
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -47,6 +47,7 @@ static PORTUGUESE_BR: Catalog =
|
||||
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")));
|
||||
static VIETNAMESE: Catalog = Catalog::new("vi", "Tiếng Việt", include_str!(concat!(env!("CARGO_MANIFEST_DIR"), "/../../assets/locales/vi.json")));
|
||||
static CHINESE: Catalog = Catalog::new("zh", "中文", include_str!(concat!(env!("CARGO_MANIFEST_DIR"), "/../../assets/locales/zh.json")));
|
||||
/// English first (the fallback), then by language id, one per line so that adding a language
|
||||
/// doesn't edit a line another addition edits.
|
||||
@@ -67,6 +68,7 @@ pub const LOCALES: &[&Catalog] = &[
|
||||
&RUSSIAN,
|
||||
&TURKISH,
|
||||
&UKRAINIAN,
|
||||
&VIETNAMESE,
|
||||
&CHINESE,
|
||||
];
|
||||
|
||||
@@ -691,6 +693,27 @@ mod tests {
|
||||
assert_eq!(uk.dynamic("Sketch of bracket"), "Sketch of bracket");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn vietnamese_catalog_translates_keys_labels_and_browser_patterns() {
|
||||
let vi = Locale::for_language("vi");
|
||||
assert_eq!(vi.name(), "Tiếng Việt");
|
||||
assert!(is_supported("vi"));
|
||||
assert_eq!(vi.text("ui.preferences"), "Tùy chọn cài đặt");
|
||||
assert_eq!(vi.label("Extrude"), "Đùn khối");
|
||||
assert_eq!(vi.label("CREATE SKETCH"), "TẠO PHÁC THẢO");
|
||||
assert_eq!(vi.label("NonExistentKey"), "NonExistentKey");
|
||||
assert_eq!(vi.format("document.save_changes", &[("name", "My {design}")]), "Lưu các thay đổi đối với My {design}?");
|
||||
assert_eq!(vi.format("dialog.selected_count", &[("count", "2")]), "↖ 2 đã chọn");
|
||||
assert_eq!(vi.dynamic("Sketch1"), "Phác thảo1");
|
||||
assert_eq!(vi.dynamic("Body2"), "Thân khối2");
|
||||
assert_eq!(vi.dynamic("Component12"), "Cụm chi tiết12");
|
||||
assert_eq!(vi.dynamic("Units: mm"), "Đơn vị: mm");
|
||||
assert_eq!(vi.dynamic("Precision: 3"), "Độ chính xác: 3");
|
||||
assert_eq!(vi.dynamic("Parameters (5)"), "Bảng tham số (5)");
|
||||
assert_eq!(vi.dynamic("4 degrees of freedom"), "4 bậc tự do");
|
||||
assert_eq!(vi.dynamic("Sketch of bracket"), "Sketch of bracket");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn render_scopes_restore_the_previous_language() {
|
||||
let _english = scope("en");
|
||||
|
||||
Reference in New Issue
Block a user