fix(lang): keep the {} placeholder in three translations (#17000)

* fix(lang): keep the {} placeholder in three translations

fa and nl dropped the {} in shortcut-must-include-modifiers and shortcut-key-not-supported, so the recording dialog lost the modifier list and the rejected key name. sc had a {} and an unrelated meaning in printer-os-requirement-tip, which is shown as plain text.

* test(lang): check fa, nl and sc against the placeholders of their English text

The existing placeholder test only looks at keys that contain {}. These three tables had mismatches against the en.rs text instead (strings whose {} is filled by Dart replaceAll). The test fails on master and passes with the translation fixes.

---------

Co-authored-by: Ruslan Zaitsev <293677063+Dofam1nch1k@users.noreply.github.com>
This commit is contained in:
Ruslan ZaitsevandRuslan Zaitsev authored and GitHub committed 2026-11-13 14:23:31 +08:00
1 parent b84058e076
commit 225ff5721e
4 files changed
+26 -5

No files matched your search

+21
View File
@@ -426,4 +426,25 @@ mod test {
}
}
}
#[test]
fn test_translations_keep_the_placeholders_of_their_english_text() {
use super::*;
// Some callers fill `{}` themselves (Dart `.replaceAll('{}', ...)`), so the English text,
// not only the key, decides how many `{}` a translation needs.
for table in [&*fa::T, &*nl::T, &*sc::T] {
for (key, value) in table.iter() {
if value.is_empty() {
continue;
}
let english = en::T.get(key).filter(|v| !v.is_empty()).unwrap_or(key);
assert_eq!(
english.matches("{}").count(),
value.matches("{}").count(),
"{key:?} => {value:?}"
);
}
}
}
}
+2 -2
View File
@@ -805,12 +805,12 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Set shortcut", "تنظیم میانبر"),
("shortcut-recording-instruction", "کلیدهای میانبر مورد نظر را فشار دهید."),
("shortcut-recording-press-keys-tip", "کلیدها را فشار دهید..."),
("shortcut-must-include-modifiers", "میانبر باید شامل حداقل یک کلید تغییردهنده (Ctrl، Alt، Shift یا Meta) باشد."),
("shortcut-must-include-modifiers", "میانبر باید شامل حداقل یک کلید تغییردهنده باشد: {}"),
("shortcut-already-bound-to", "این میانبر قبلاً به عملکرد دیگری اختصاص داده شده است."),
("Replace", "جایگزینی"),
("Valid", "معتبر"),
("shortcut-mobile-physical-keyboard-tip", "این میانبرها فقط با صفحه کلید فیزیکی متصل کار می‌کنند."),
("shortcut-key-not-supported", "این کلید برای میانبر پشتیبانی نمی‌شود."),
("shortcut-key-not-supported", "\"{}\" را نمی‌توان به‌عنوان میانبر استفاده کرد."),
("On", "روشن"),
("Off", "خاموش"),
("api_server_connection_tip", "سرور سفارشی شما از HTTP رمزنگاری‌نشده استفاده می‌کند. برای فعال‌سازی HTTPS با مدیر سیستم خود تماس بگیرید."),
+2 -2
View File
@@ -805,12 +805,12 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Set shortcut", "Sneltoets toewijzen"),
("shortcut-recording-instruction", "Druk op de toetsencombinatie die je wilt gebruiken."),
("shortcut-recording-press-keys-tip", "Druk op de toetsencombinatie..."),
("shortcut-must-include-modifiers", "Sneltoets moet een combinatietoets bevatten"),
("shortcut-must-include-modifiers", "Sneltoets moet minstens één combinatietoets bevatten: {}"),
("shortcut-already-bound-to", "Sneltoets is al toegewezen aan"),
("Replace", "Vervangen"),
("Valid", "Geldig"),
("shortcut-mobile-physical-keyboard-tip", "Voor het opnemen is een fysiek toetsenbord vereist. Schermtoetsenborden worden niet ondersteund."),
("shortcut-key-not-supported", "Sneltoets wordt niet ondersteund"),
("shortcut-key-not-supported", "\"{}\" kan niet als sneltoets worden gebruikt."),
("On", "Aan"),
("Off", "Uit"),
("api_server_connection_tip", "De door jou gebruikte aangepaste server maakt gebruik van onversleuteld HTTP. Neem contact op met de beheerder om HTTPS in te schakelen."),
+1 -1
View File
@@ -638,7 +638,7 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("d3d_render_tip", "Cando sa renderizatzione D3D est abilitada, s'ischermu de controllu remotu diat pòdere èssere nieddu in unas cantas màchinas"),
("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-os-requirement-tip", "Pro pòdere impreare s'imprentadora in seddida bisòngiat Windows 10 o una versione prus noa."),
("printer-requires-installed-{}-client-tip", "Pro impreare s'imprenta remota, bisòngiat a installare {} in custu dispositivu."),
("printer-{}-not-installed-tip", "S'imprentadora {} no est installada"),
("printer-{}-ready-tip", "S'imprentadora {} est installada e pronta pro s'impreu."),