1
Fork 0
mirror of https://github.com/RGBCube/uutils-coreutils synced 2025-07-27 19:17:43 +00:00

l10n: port hashsum for translation + add french

This commit is contained in:
Sylvestre Ledru 2025-06-17 22:09:02 +02:00
parent bcb76aca64
commit c906ced95c
3 changed files with 124 additions and 47 deletions

View file

@ -1,2 +1,39 @@
hashsum-about = Compute and check message digests. hashsum-about = Compute and check message digests.
hashsum-usage = hashsum --<digest> [OPTIONS]... [FILE]... hashsum-usage = hashsum --<digest> [OPTIONS]... [FILE]...
# Help messages
hashsum-help-binary-windows = read or check in binary mode (default)
hashsum-help-binary-other = read in binary mode
hashsum-help-text-windows = read or check in text mode
hashsum-help-text-other = read in text mode (default)
hashsum-help-check = read hashsums from the FILEs and check them
hashsum-help-tag = create a BSD-style checksum
hashsum-help-quiet = don't print OK for each successfully verified file
hashsum-help-status = don't output anything, status code shows success
hashsum-help-strict = exit non-zero for improperly formatted checksum lines
hashsum-help-ignore-missing = don't fail or report status for missing files
hashsum-help-warn = warn about improperly formatted checksum lines
hashsum-help-zero = end each output line with NUL, not newline
hashsum-help-length = digest length in bits; must not exceed the max for the blake2 algorithm and must be a multiple of 8
hashsum-help-no-names = Omits filenames in the output (option not present in GNU/Coreutils)
hashsum-help-bits = set the size of the output (only for SHAKE)
# Algorithm help messages
hashsum-help-md5 = work with MD5
hashsum-help-sha1 = work with SHA1
hashsum-help-sha224 = work with SHA224
hashsum-help-sha256 = work with SHA256
hashsum-help-sha384 = work with SHA384
hashsum-help-sha512 = work with SHA512
hashsum-help-sha3 = work with SHA3
hashsum-help-sha3-224 = work with SHA3-224
hashsum-help-sha3-256 = work with SHA3-256
hashsum-help-sha3-384 = work with SHA3-384
hashsum-help-sha3-512 = work with SHA3-512
hashsum-help-shake128 = work with SHAKE128 using BITS for the output size
hashsum-help-shake256 = work with SHAKE256 using BITS for the output size
hashsum-help-b2sum = work with BLAKE2
hashsum-help-b3sum = work with BLAKE3
# Error messages
hashsum-error-failed-to-read-input = failed to read input

View file

@ -0,0 +1,39 @@
hashsum-about = Calculer et vérifier les empreintes de messages.
hashsum-usage = hashsum --<empreinte> [OPTION]... [FICHIER]...
# Messages d'aide
hashsum-help-binary-windows = lire ou vérifier en mode binaire (par défaut)
hashsum-help-binary-other = lire en mode binaire
hashsum-help-text-windows = lire ou vérifier en mode texte
hashsum-help-text-other = lire en mode texte (par défaut)
hashsum-help-check = lire les empreintes depuis les FICHIERs et les vérifier
hashsum-help-tag = créer une somme de contrôle de style BSD
hashsum-help-quiet = ne pas afficher OK pour chaque fichier vérifié avec succès
hashsum-help-status = ne rien afficher, le code de statut indique le succès
hashsum-help-strict = sortir avec un code non-zéro pour les lignes de somme de contrôle mal formatées
hashsum-help-ignore-missing = ne pas échouer ou rapporter le statut pour les fichiers manquants
hashsum-help-warn = avertir des lignes de somme de contrôle mal formatées
hashsum-help-zero = terminer chaque ligne de sortie avec NUL, pas de retour à la ligne
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
hashsum-help-no-names = Omet les noms de fichiers dans la sortie (option non présente dans GNU/Coreutils)
hashsum-help-bits = définir la taille de la sortie (uniquement pour SHAKE)
# Messages d'aide des algorithmes
hashsum-help-md5 = travailler avec MD5
hashsum-help-sha1 = travailler avec SHA1
hashsum-help-sha224 = travailler avec SHA224
hashsum-help-sha256 = travailler avec SHA256
hashsum-help-sha384 = travailler avec SHA384
hashsum-help-sha512 = travailler avec SHA512
hashsum-help-sha3 = travailler avec SHA3
hashsum-help-sha3-224 = travailler avec SHA3-224
hashsum-help-sha3-256 = travailler avec SHA3-256
hashsum-help-sha3-384 = travailler avec SHA3-384
hashsum-help-sha3-512 = travailler avec SHA3-512
hashsum-help-shake128 = travailler avec SHAKE128 en utilisant BITS pour la taille de sortie
hashsum-help-shake256 = travailler avec SHAKE256 en utilisant BITS pour la taille de sortie
hashsum-help-b2sum = travailler avec BLAKE2
hashsum-help-b3sum = travailler avec BLAKE3
# Messages d'erreur
hashsum-error-failed-to-read-input = échec de la lecture de l'entrée

View file

@ -309,14 +309,6 @@ mod options {
} }
pub fn uu_app_common() -> Command { pub fn uu_app_common() -> Command {
#[cfg(windows)]
const BINARY_HELP: &str = "read or check in binary mode (default)";
#[cfg(not(windows))]
const BINARY_HELP: &str = "read in binary mode";
#[cfg(windows)]
const TEXT_HELP: &str = "read or check in text mode";
#[cfg(not(windows))]
const TEXT_HELP: &str = "read in text mode (default)";
Command::new(uucore::util_name()) Command::new(uucore::util_name())
.version(uucore::crate_version!()) .version(uucore::crate_version!())
.about(get_message("hashsum-about")) .about(get_message("hashsum-about"))
@ -327,21 +319,30 @@ pub fn uu_app_common() -> Command {
Arg::new(options::BINARY) Arg::new(options::BINARY)
.short('b') .short('b')
.long("binary") .long("binary")
.help(BINARY_HELP) .help({
#[cfg(windows)]
{
get_message("hashsum-help-binary-windows")
}
#[cfg(not(windows))]
{
get_message("hashsum-help-binary-other")
}
})
.action(ArgAction::SetTrue), .action(ArgAction::SetTrue),
) )
.arg( .arg(
Arg::new(options::CHECK) Arg::new(options::CHECK)
.short('c') .short('c')
.long("check") .long("check")
.help("read hashsums from the FILEs and check them") .help(get_message("hashsum-help-check"))
.action(ArgAction::SetTrue) .action(ArgAction::SetTrue)
.conflicts_with("tag"), .conflicts_with("tag"),
) )
.arg( .arg(
Arg::new(options::TAG) Arg::new(options::TAG)
.long("tag") .long("tag")
.help("create a BSD-style checksum") .help(get_message("hashsum-help-tag"))
.action(ArgAction::SetTrue) .action(ArgAction::SetTrue)
.conflicts_with("text"), .conflicts_with("text"),
) )
@ -349,7 +350,16 @@ pub fn uu_app_common() -> Command {
Arg::new(options::TEXT) Arg::new(options::TEXT)
.short('t') .short('t')
.long("text") .long("text")
.help(TEXT_HELP) .help({
#[cfg(windows)]
{
get_message("hashsum-help-text-windows")
}
#[cfg(not(windows))]
{
get_message("hashsum-help-text-other")
}
})
.conflicts_with("binary") .conflicts_with("binary")
.action(ArgAction::SetTrue), .action(ArgAction::SetTrue),
) )
@ -357,7 +367,7 @@ pub fn uu_app_common() -> Command {
Arg::new(options::QUIET) Arg::new(options::QUIET)
.short('q') .short('q')
.long(options::QUIET) .long(options::QUIET)
.help("don't print OK for each successfully verified file") .help(get_message("hashsum-help-quiet"))
.action(ArgAction::SetTrue) .action(ArgAction::SetTrue)
.overrides_with_all([options::STATUS, options::WARN]), .overrides_with_all([options::STATUS, options::WARN]),
) )
@ -365,27 +375,27 @@ pub fn uu_app_common() -> Command {
Arg::new(options::STATUS) Arg::new(options::STATUS)
.short('s') .short('s')
.long("status") .long("status")
.help("don't output anything, status code shows success") .help(get_message("hashsum-help-status"))
.action(ArgAction::SetTrue) .action(ArgAction::SetTrue)
.overrides_with_all([options::QUIET, options::WARN]), .overrides_with_all([options::QUIET, options::WARN]),
) )
.arg( .arg(
Arg::new(options::STRICT) Arg::new(options::STRICT)
.long("strict") .long("strict")
.help("exit non-zero for improperly formatted checksum lines") .help(get_message("hashsum-help-strict"))
.action(ArgAction::SetTrue), .action(ArgAction::SetTrue),
) )
.arg( .arg(
Arg::new("ignore-missing") Arg::new("ignore-missing")
.long("ignore-missing") .long("ignore-missing")
.help("don't fail or report status for missing files") .help(get_message("hashsum-help-ignore-missing"))
.action(ArgAction::SetTrue), .action(ArgAction::SetTrue),
) )
.arg( .arg(
Arg::new(options::WARN) Arg::new(options::WARN)
.short('w') .short('w')
.long("warn") .long("warn")
.help("warn about improperly formatted checksum lines") .help(get_message("hashsum-help-warn"))
.action(ArgAction::SetTrue) .action(ArgAction::SetTrue)
.overrides_with_all([options::QUIET, options::STATUS]), .overrides_with_all([options::QUIET, options::STATUS]),
) )
@ -393,7 +403,7 @@ pub fn uu_app_common() -> Command {
Arg::new("zero") Arg::new("zero")
.short('z') .short('z')
.long("zero") .long("zero")
.help("end each output line with NUL, not newline") .help(get_message("hashsum-help-zero"))
.action(ArgAction::SetTrue), .action(ArgAction::SetTrue),
) )
.arg( .arg(
@ -416,10 +426,7 @@ fn uu_app_opt_length(command: Command) -> Command {
.long(options::LENGTH) .long(options::LENGTH)
.value_parser(value_parser!(usize)) .value_parser(value_parser!(usize))
.short('l') .short('l')
.help( .help(get_message("hashsum-help-length"))
"digest length in bits; must not exceed the max for the blake2 algorithm \
and must be a multiple of 8",
)
.overrides_with(options::LENGTH) .overrides_with(options::LENGTH)
.action(ArgAction::Set), .action(ArgAction::Set),
) )
@ -433,7 +440,7 @@ fn uu_app_b3sum_opts(command: Command) -> Command {
command.arg( command.arg(
Arg::new("no-names") Arg::new("no-names")
.long("no-names") .long("no-names")
.help("Omits filenames in the output (option not present in GNU/Coreutils)") .help(get_message("hashsum-help-no-names"))
.action(ArgAction::SetTrue), .action(ArgAction::SetTrue),
) )
} }
@ -447,7 +454,7 @@ fn uu_app_opt_bits(command: Command) -> Command {
command.arg( command.arg(
Arg::new("bits") Arg::new("bits")
.long("bits") .long("bits")
.help("set the size of the output (only for SHAKE)") .help(get_message("hashsum-help-bits"))
.value_name("BITS") .value_name("BITS")
// XXX: should we actually use validators? they're not particularly efficient // XXX: should we actually use validators? they're not particularly efficient
.value_parser(parse_bit_num), .value_parser(parse_bit_num),
@ -457,34 +464,28 @@ fn uu_app_opt_bits(command: Command) -> Command {
pub fn uu_app_custom() -> Command { pub fn uu_app_custom() -> Command {
let mut command = uu_app_b3sum_opts(uu_app_opt_bits(uu_app_common())); let mut command = uu_app_b3sum_opts(uu_app_opt_bits(uu_app_common()));
let algorithms = &[ let algorithms = &[
("md5", "work with MD5"), ("md5", get_message("hashsum-help-md5")),
("sha1", "work with SHA1"), ("sha1", get_message("hashsum-help-sha1")),
("sha224", "work with SHA224"), ("sha224", get_message("hashsum-help-sha224")),
("sha256", "work with SHA256"), ("sha256", get_message("hashsum-help-sha256")),
("sha384", "work with SHA384"), ("sha384", get_message("hashsum-help-sha384")),
("sha512", "work with SHA512"), ("sha512", get_message("hashsum-help-sha512")),
("sha3", "work with SHA3"), ("sha3", get_message("hashsum-help-sha3")),
("sha3-224", "work with SHA3-224"), ("sha3-224", get_message("hashsum-help-sha3-224")),
("sha3-256", "work with SHA3-256"), ("sha3-256", get_message("hashsum-help-sha3-256")),
("sha3-384", "work with SHA3-384"), ("sha3-384", get_message("hashsum-help-sha3-384")),
("sha3-512", "work with SHA3-512"), ("sha3-512", get_message("hashsum-help-sha3-512")),
( ("shake128", get_message("hashsum-help-shake128")),
"shake128", ("shake256", get_message("hashsum-help-shake256")),
"work with SHAKE128 using BITS for the output size", ("b2sum", get_message("hashsum-help-b2sum")),
), ("b3sum", get_message("hashsum-help-b3sum")),
(
"shake256",
"work with SHAKE256 using BITS for the output size",
),
("b2sum", "work with BLAKE2"),
("b3sum", "work with BLAKE3"),
]; ];
for (name, desc) in algorithms { for (name, desc) in algorithms {
command = command.arg( command = command.arg(
Arg::new(*name) Arg::new(*name)
.long(name) .long(name)
.help(*desc) .help(desc)
.action(ArgAction::SetTrue), .action(ArgAction::SetTrue),
); );
} }
@ -549,7 +550,7 @@ where
options.binary, options.binary,
options.output_bits, options.output_bits,
) )
.map_err_context(|| "failed to read input".to_string())?; .map_err_context(|| get_message("hashsum-error-failed-to-read-input"))?;
let (escaped_filename, prefix) = escape_filename(filename); let (escaped_filename, prefix) = escape_filename(filename);
if options.tag { if options.tag {
if options.algoname == "blake2b" { if options.algoname == "blake2b" {