From eb239024503160707cca87ba6cef5fbfb8fa3f0d Mon Sep 17 00:00:00 2001 From: Lukas <103962359+L4XB@users.noreply.github.com> Date: Tue, 27 Oct 2026 09:27:53 +0100 Subject: [PATCH] fix(lang): keep the {} value and the meaning in four translations (#16701) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * fix(lang): keep the {} value and the meaning in four translations * test(lang): check that the fixed translations keep their key's {} translate() replaces {} with the value from the call. The test checks that no non-empty ru, sc or vi translation of a key with {} drops it; on master it fails with "Downloading {}" => "Скачивание". --- src/lang.rs | 14 ++++++++++++++ src/lang/ru.rs | 2 +- src/lang/sc.rs | 2 +- src/lang/vi.rs | 4 ++-- 4 files changed, 18 insertions(+), 4 deletions(-) diff --git a/src/lang.rs b/src/lang.rs index 19209d005..bf180fcc2 100644 --- a/src/lang.rs +++ b/src/lang.rs @@ -396,4 +396,18 @@ mod test { assert_eq!(f("", "zh_MO", false), "zh-tw"); assert_eq!(f("", "zh-Hans-HK", false), "zh-cn"); } + + #[test] + fn test_translations_keep_the_placeholder_of_their_key() { + use super::*; + + // translate() puts the caller's value where `{}` is, so a translation without `{}` drops it. + for table in [&*ru::T, &*sc::T, &*vi::T] { + for (key, value) in table.iter() { + if key.contains("{}") && !value.is_empty() { + assert!(value.contains("{}"), "{key:?} => {value:?}"); + } + } + } + } } diff --git a/src/lang/ru.rs b/src/lang/ru.rs index 7e78de3ff..6fb51a351 100644 --- a/src/lang/ru.rs +++ b/src/lang/ru.rs @@ -664,7 +664,7 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> = ("Import Folder", "Импортировать папку"), ("Copy to clipboard", "Копировать в буфер обмена"), ("Enable remote printer", "Использовать удалённый принтер"), - ("Downloading {}", "Скачивание"), + ("Downloading {}", "Скачивание {}"), ("{} Update", "Обновить {}"), ("{}-to-update-tip", "{} закроется и установит новую версию."), ("download-new-version-failed-tip", "Ошибка загрузки. Можно повторить попытку или нажать кнопку \"Скачать\", чтобы скачать приложение с официального сайта и обновить вручную."), diff --git a/src/lang/sc.rs b/src/lang/sc.rs index 3305991a7..0d7b11b46 100644 --- a/src/lang/sc.rs +++ b/src/lang/sc.rs @@ -639,7 +639,7 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> = ("Use D3D rendering", "Imprea sa renderizatzione D3D"), ("Printer", "Imprentadora"), ("printer-os-requirement-tip", "Pro pòdere impreare s'imprentadora in seddida bisòngiat a installare {} in custu dispositivu."), - ("printer-requires-installed-{}-client-tip", "Pro sa funtzionalidade de imprenta in essida b'at bisòngiu de Window 10 o prus nou."), + ("printer-requires-installed-{}-client-tip", ""), ("printer-{}-not-installed-tip", "S'imprentadora {} no est installada"), ("printer-{}-ready-tip", "S'imprentadora {} est installada e pronta pro s'impreu."), ("Install {} Printer", "Installa s'imprentadora {}"), diff --git a/src/lang/vi.rs b/src/lang/vi.rs index 25580d4a4..0ce38a9a4 100644 --- a/src/lang/vi.rs +++ b/src/lang/vi.rs @@ -522,7 +522,7 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> = ("auto_disconnect_option_tip", "Tự động ngắt kết nối khi không hoạt động"), ("Connection failed due to inactivity", "Ngắt kết nối do không hoạt động"), ("Check for software update on startup", "Kiểm tra cập nhật khi khởi động"), - ("upgrade_rustdesk_server_pro_to_{}_tip", "Nâng cấp lên Pro để có thêm tính năng"), + ("upgrade_rustdesk_server_pro_to_{}_tip", "Vui lòng nâng cấp RustDesk Server Pro lên phiên bản {} hoặc mới hơn!"), ("pull_group_failed_tip", "Lấy thông tin nhóm thất bại"), ("Filter by intersection", "Lọc theo giao điểm"), ("Remove wallpaper during incoming sessions", "Xóa hình nền khi có kết nối đến"), @@ -666,7 +666,7 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> = ("Enable remote printer", "Bật máy in từ xa"), ("Downloading {}", "Đang tải xuống {}"), ("{} Update", "Cập nhật {}"), - ("{}-to-update-tip", "Cần nâng cấp để sử dụng tính năng này."), + ("{}-to-update-tip", "{} sẽ đóng ngay bây giờ và cài đặt phiên bản mới."), ("download-new-version-failed-tip", "Tải phiên bản mới thất bại."), ("Auto update", "Tự động cập nhật"), ("update-failed-check-msi-tip", "Cập nhật lỗi, vui lòng kiểm tra file MSI."),