Skip to content

Commit b20706f

Browse files
authored
Merge pull request #8207 from sylvestre/l10n-hashsum
l10n: port hashsum for translation + add french
2 parents 9eaaf9c + c906ced commit b20706f

File tree

3 files changed

+124
-47
lines changed

3 files changed

+124
-47
lines changed

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

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,39 @@
11
hashsum-about = Compute and check message digests.
22
hashsum-usage = hashsum --<digest> [OPTIONS]... [FILE]...
3+
4+
# Help messages
5+
hashsum-help-binary-windows = read or check in binary mode (default)
6+
hashsum-help-binary-other = read in binary mode
7+
hashsum-help-text-windows = read or check in text mode
8+
hashsum-help-text-other = read in text mode (default)
9+
hashsum-help-check = read hashsums from the FILEs and check them
10+
hashsum-help-tag = create a BSD-style checksum
11+
hashsum-help-quiet = don't print OK for each successfully verified file
12+
hashsum-help-status = don't output anything, status code shows success
13+
hashsum-help-strict = exit non-zero for improperly formatted checksum lines
14+
hashsum-help-ignore-missing = don't fail or report status for missing files
15+
hashsum-help-warn = warn about improperly formatted checksum lines
16+
hashsum-help-zero = end each output line with NUL, not newline
17+
hashsum-help-length = digest length in bits; must not exceed the max for the blake2 algorithm and must be a multiple of 8
18+
hashsum-help-no-names = Omits filenames in the output (option not present in GNU/Coreutils)
19+
hashsum-help-bits = set the size of the output (only for SHAKE)
20+
21+
# Algorithm help messages
22+
hashsum-help-md5 = work with MD5
23+
hashsum-help-sha1 = work with SHA1
24+
hashsum-help-sha224 = work with SHA224
25+
hashsum-help-sha256 = work with SHA256
26+
hashsum-help-sha384 = work with SHA384
27+
hashsum-help-sha512 = work with SHA512
28+
hashsum-help-sha3 = work with SHA3
29+
hashsum-help-sha3-224 = work with SHA3-224
30+
hashsum-help-sha3-256 = work with SHA3-256
31+
hashsum-help-sha3-384 = work with SHA3-384
32+
hashsum-help-sha3-512 = work with SHA3-512
33+
hashsum-help-shake128 = work with SHAKE128 using BITS for the output size
34+
hashsum-help-shake256 = work with SHAKE256 using BITS for the output size
35+
hashsum-help-b2sum = work with BLAKE2
36+
hashsum-help-b3sum = work with BLAKE3
37+
38+
# Error messages
39+
hashsum-error-failed-to-read-input = failed to read input

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

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
hashsum-about = Calculer et vérifier les empreintes de messages.
2+
hashsum-usage = hashsum --<empreinte> [OPTION]... [FICHIER]...
3+
4+
# Messages d'aide
5+
hashsum-help-binary-windows = lire ou vérifier en mode binaire (par défaut)
6+
hashsum-help-binary-other = lire en mode binaire
7+
hashsum-help-text-windows = lire ou vérifier en mode texte
8+
hashsum-help-text-other = lire en mode texte (par défaut)
9+
hashsum-help-check = lire les empreintes depuis les FICHIERs et les vérifier
10+
hashsum-help-tag = créer une somme de contrôle de style BSD
11+
hashsum-help-quiet = ne pas afficher OK pour chaque fichier vérifié avec succès
12+
hashsum-help-status = ne rien afficher, le code de statut indique le succès
13+
hashsum-help-strict = sortir avec un code non-zéro pour les lignes de somme de contrôle mal formatées
14+
hashsum-help-ignore-missing = ne pas échouer ou rapporter le statut pour les fichiers manquants
15+
hashsum-help-warn = avertir des lignes de somme de contrôle mal formatées
16+
hashsum-help-zero = terminer chaque ligne de sortie avec NUL, pas de retour à la ligne
17+
hashsum-help-length = longueur de l'empreinte en bits ; ne doit pas dépasser le maximum pour l'algorithme blake2 et doit être un multiple de 8
18+
hashsum-help-no-names = Omet les noms de fichiers dans la sortie (option non présente dans GNU/Coreutils)
19+
hashsum-help-bits = définir la taille de la sortie (uniquement pour SHAKE)
20+
21+
# Messages d'aide des algorithmes
22+
hashsum-help-md5 = travailler avec MD5
23+
hashsum-help-sha1 = travailler avec SHA1
24+
hashsum-help-sha224 = travailler avec SHA224
25+
hashsum-help-sha256 = travailler avec SHA256
26+
hashsum-help-sha384 = travailler avec SHA384
27+
hashsum-help-sha512 = travailler avec SHA512
28+
hashsum-help-sha3 = travailler avec SHA3
29+
hashsum-help-sha3-224 = travailler avec SHA3-224
30+
hashsum-help-sha3-256 = travailler avec SHA3-256
31+
hashsum-help-sha3-384 = travailler avec SHA3-384
32+
hashsum-help-sha3-512 = travailler avec SHA3-512
33+
hashsum-help-shake128 = travailler avec SHAKE128 en utilisant BITS pour la taille de sortie
34+
hashsum-help-shake256 = travailler avec SHAKE256 en utilisant BITS pour la taille de sortie
35+
hashsum-help-b2sum = travailler avec BLAKE2
36+
hashsum-help-b3sum = travailler avec BLAKE3
37+
38+
# Messages d'erreur
39+
hashsum-error-failed-to-read-input = échec de la lecture de l'entrée

src/uu/hashsum/src/hashsum.rs

Lines changed: 48 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -309,14 +309,6 @@ mod options {
309309
}
310310

311311
pub fn uu_app_common() -> Command {
312-
#[cfg(windows)]
313-
const BINARY_HELP: &str = "read or check in binary mode (default)";
314-
#[cfg(not(windows))]
315-
const BINARY_HELP: &str = "read in binary mode";
316-
#[cfg(windows)]
317-
const TEXT_HELP: &str = "read or check in text mode";
318-
#[cfg(not(windows))]
319-
const TEXT_HELP: &str = "read in text mode (default)";
320312
Command::new(uucore::util_name())
321313
.version(uucore::crate_version!())
322314
.about(get_message("hashsum-about"))
@@ -327,73 +319,91 @@ pub fn uu_app_common() -> Command {
327319
Arg::new(options::BINARY)
328320
.short('b')
329321
.long("binary")
330-
.help(BINARY_HELP)
322+
.help({
323+
#[cfg(windows)]
324+
{
325+
get_message("hashsum-help-binary-windows")
326+
}
327+
#[cfg(not(windows))]
328+
{
329+
get_message("hashsum-help-binary-other")
330+
}
331+
})
331332
.action(ArgAction::SetTrue),
332333
)
333334
.arg(
334335
Arg::new(options::CHECK)
335336
.short('c')
336337
.long("check")
337-
.help("read hashsums from the FILEs and check them")
338+
.help(get_message("hashsum-help-check"))
338339
.action(ArgAction::SetTrue)
339340
.conflicts_with("tag"),
340341
)
341342
.arg(
342343
Arg::new(options::TAG)
343344
.long("tag")
344-
.help("create a BSD-style checksum")
345+
.help(get_message("hashsum-help-tag"))
345346
.action(ArgAction::SetTrue)
346347
.conflicts_with("text"),
347348
)
348349
.arg(
349350
Arg::new(options::TEXT)
350351
.short('t')
351352
.long("text")
352-
.help(TEXT_HELP)
353+
.help({
354+
#[cfg(windows)]
355+
{
356+
get_message("hashsum-help-text-windows")
357+
}
358+
#[cfg(not(windows))]
359+
{
360+
get_message("hashsum-help-text-other")
361+
}
362+
})
353363
.conflicts_with("binary")
354364
.action(ArgAction::SetTrue),
355365
)
356366
.arg(
357367
Arg::new(options::QUIET)
358368
.short('q')
359369
.long(options::QUIET)
360-
.help("don't print OK for each successfully verified file")
370+
.help(get_message("hashsum-help-quiet"))
361371
.action(ArgAction::SetTrue)
362372
.overrides_with_all([options::STATUS, options::WARN]),
363373
)
364374
.arg(
365375
Arg::new(options::STATUS)
366376
.short('s')
367377
.long("status")
368-
.help("don't output anything, status code shows success")
378+
.help(get_message("hashsum-help-status"))
369379
.action(ArgAction::SetTrue)
370380
.overrides_with_all([options::QUIET, options::WARN]),
371381
)
372382
.arg(
373383
Arg::new(options::STRICT)
374384
.long("strict")
375-
.help("exit non-zero for improperly formatted checksum lines")
385+
.help(get_message("hashsum-help-strict"))
376386
.action(ArgAction::SetTrue),
377387
)
378388
.arg(
379389
Arg::new("ignore-missing")
380390
.long("ignore-missing")
381-
.help("don't fail or report status for missing files")
391+
.help(get_message("hashsum-help-ignore-missing"))
382392
.action(ArgAction::SetTrue),
383393
)
384394
.arg(
385395
Arg::new(options::WARN)
386396
.short('w')
387397
.long("warn")
388-
.help("warn about improperly formatted checksum lines")
398+
.help(get_message("hashsum-help-warn"))
389399
.action(ArgAction::SetTrue)
390400
.overrides_with_all([options::QUIET, options::STATUS]),
391401
)
392402
.arg(
393403
Arg::new("zero")
394404
.short('z')
395405
.long("zero")
396-
.help("end each output line with NUL, not newline")
406+
.help(get_message("hashsum-help-zero"))
397407
.action(ArgAction::SetTrue),
398408
)
399409
.arg(
@@ -416,10 +426,7 @@ fn uu_app_opt_length(command: Command) -> Command {
416426
.long(options::LENGTH)
417427
.value_parser(value_parser!(usize))
418428
.short('l')
419-
.help(
420-
"digest length in bits; must not exceed the max for the blake2 algorithm \
421-
and must be a multiple of 8",
422-
)
429+
.help(get_message("hashsum-help-length"))
423430
.overrides_with(options::LENGTH)
424431
.action(ArgAction::Set),
425432
)
@@ -433,7 +440,7 @@ fn uu_app_b3sum_opts(command: Command) -> Command {
433440
command.arg(
434441
Arg::new("no-names")
435442
.long("no-names")
436-
.help("Omits filenames in the output (option not present in GNU/Coreutils)")
443+
.help(get_message("hashsum-help-no-names"))
437444
.action(ArgAction::SetTrue),
438445
)
439446
}
@@ -447,7 +454,7 @@ fn uu_app_opt_bits(command: Command) -> Command {
447454
command.arg(
448455
Arg::new("bits")
449456
.long("bits")
450-
.help("set the size of the output (only for SHAKE)")
457+
.help(get_message("hashsum-help-bits"))
451458
.value_name("BITS")
452459
// XXX: should we actually use validators? they're not particularly efficient
453460
.value_parser(parse_bit_num),
@@ -457,34 +464,28 @@ fn uu_app_opt_bits(command: Command) -> Command {
457464
pub fn uu_app_custom() -> Command {
458465
let mut command = uu_app_b3sum_opts(uu_app_opt_bits(uu_app_common()));
459466
let algorithms = &[
460-
("md5", "work with MD5"),
461-
("sha1", "work with SHA1"),
462-
("sha224", "work with SHA224"),
463-
("sha256", "work with SHA256"),
464-
("sha384", "work with SHA384"),
465-
("sha512", "work with SHA512"),
466-
("sha3", "work with SHA3"),
467-
("sha3-224", "work with SHA3-224"),
468-
("sha3-256", "work with SHA3-256"),
469-
("sha3-384", "work with SHA3-384"),
470-
("sha3-512", "work with SHA3-512"),
471-
(
472-
"shake128",
473-
"work with SHAKE128 using BITS for the output size",
474-
),
475-
(
476-
"shake256",
477-
"work with SHAKE256 using BITS for the output size",
478-
),
479-
("b2sum", "work with BLAKE2"),
480-
("b3sum", "work with BLAKE3"),
467+
("md5", get_message("hashsum-help-md5")),
468+
("sha1", get_message("hashsum-help-sha1")),
469+
("sha224", get_message("hashsum-help-sha224")),
470+
("sha256", get_message("hashsum-help-sha256")),
471+
("sha384", get_message("hashsum-help-sha384")),
472+
("sha512", get_message("hashsum-help-sha512")),
473+
("sha3", get_message("hashsum-help-sha3")),
474+
("sha3-224", get_message("hashsum-help-sha3-224")),
475+
("sha3-256", get_message("hashsum-help-sha3-256")),
476+
("sha3-384", get_message("hashsum-help-sha3-384")),
477+
("sha3-512", get_message("hashsum-help-sha3-512")),
478+
("shake128", get_message("hashsum-help-shake128")),
479+
("shake256", get_message("hashsum-help-shake256")),
480+
("b2sum", get_message("hashsum-help-b2sum")),
481+
("b3sum", get_message("hashsum-help-b3sum")),
481482
];
482483

483484
for (name, desc) in algorithms {
484485
command = command.arg(
485486
Arg::new(*name)
486487
.long(name)
487-
.help(*desc)
488+
.help(desc)
488489
.action(ArgAction::SetTrue),
489490
);
490491
}
@@ -549,7 +550,7 @@ where
549550
options.binary,
550551
options.output_bits,
551552
)
552-
.map_err_context(|| "failed to read input".to_string())?;
553+
.map_err_context(|| get_message("hashsum-error-failed-to-read-input"))?;
553554
let (escaped_filename, prefix) = escape_filename(filename);
554555
if options.tag {
555556
if options.algoname == "blake2b" {

0 commit comments

Comments
 (0)