Skip to content

Commit 1a25344

Browse files
committed
feat(wc): internationalize hardware support debug messages
Add debug messages for hardware acceleration in English and French locales, and update Rust code to use translate! macro instead of hardcoded strings. This ensures debug output is language-agnostic and translatable.
1 parent d23fc8b commit 1a25344

File tree

3 files changed

+21
-6
lines changed

3 files changed

+21
-6
lines changed

src/uu/wc/locales/en-US.ftl

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,3 +31,9 @@ decoder-error-io = underlying bytestream error: { $error }
3131
# Other messages
3232
wc-standard-input = standard input
3333
wc-total = total
34+
35+
# Debug messages
36+
wc-debug-hw-unavailable = wc: debug: hardware support unavailable on this CPU
37+
wc-debug-hw-using = wc: debug: using hardware support (features: { $features })
38+
wc-debug-hw-disabled-env = wc: debug: hardware support disabled by environment
39+
wc-debug-hw-disabled-glibc = wc: debug: hardware support disabled by GLIBC_TUNABLES ({ $features })

src/uu/wc/locales/fr-FR.ftl

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,3 +31,9 @@ decoder-error-io = erreur du flux d'octets sous-jacent : { $error }
3131
# Autres messages
3232
wc-standard-input = entrée standard
3333
wc-total = total
34+
35+
# Messages de débogage
36+
wc-debug-hw-unavailable = wc : debug : prise en charge matérielle indisponible sur ce CPU
37+
wc-debug-hw-using = wc : debug : utilisation de l'accélération matérielle (fonctions : { $features })
38+
wc-debug-hw-disabled-env = wc : debug : prise en charge matérielle désactivée par l'environnement
39+
wc-debug-hw-disabled-glibc = wc : debug : prise en charge matérielle désactivée par GLIBC_TUNABLES ({ $features })

src/uu/wc/src/wc.rs

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -831,21 +831,24 @@ fn wc(inputs: &Inputs, settings: &Settings) -> UResult<()> {
831831
if policy.allows_simd() {
832832
let enabled = policy.enabled_features();
833833
if enabled.is_empty() {
834-
eprintln!("wc: debug: hardware support unavailable on this CPU");
834+
eprintln!("{}", translate!("wc-debug-hw-unavailable"));
835835
} else {
836836
eprintln!(
837-
"wc: debug: using hardware support (features: {})",
838-
enabled.join(", ")
837+
"{}",
838+
translate!("wc-debug-hw-using", "features" => enabled.join(", "))
839839
);
840840
}
841841
} else {
842842
let disabled = policy.disabled_features();
843843
if disabled.is_empty() {
844-
eprintln!("wc: debug: hardware support disabled by environment");
844+
eprintln!("{}", translate!("wc-debug-hw-disabled-env"));
845845
} else {
846846
eprintln!(
847-
"wc: debug: hardware support disabled by GLIBC_TUNABLES ({})",
848-
disabled.join(", ")
847+
"{}",
848+
translate!(
849+
"wc-debug-hw-disabled-glibc",
850+
"features" => disabled.join(", ")
851+
)
849852
);
850853
}
851854
}

0 commit comments

Comments
 (0)