10000 l10n: port od for translation + add french by sylvestre · Pull Request #8252 · uutils/coreutils · GitHub
[go: up one dir, main page]

Skip to content

l10n: port od for translation + add french #8252

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jun 25, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 37 additions & 0 deletions src/uu/od/locales/en-US.ftl
Original file line number Diff line number Diff line change
Expand Up @@ -39,3 +39,40 @@ od-after-help = Displays data in various human-readable formats. If multiple for

If an error occurred, a diagnostic message will be printed to stderr, and the
exit code will be non-zero.

# Error messages
od-error-invalid-endian = Invalid argument --endian={$endian}
od-error-invalid-inputs = Invalid inputs: {$msg}
od-error-too-large = value is too large
od-error-radix-invalid = Radix must be one of [o, d, x, n], got: {$radix}
od-error-radix-empty = Radix cannot be empty, and must be one of [o, d, x, n]
od-error-invalid-width = invalid width {$width}; using {$min} instead
od-error-missing-format-spec = missing format specification after '--format' / '-t'
od-error-unexpected-char = unexpected char '{$char}' in format specification {$spec}
od-error-invalid-number = invalid number {$number} in format specification {$spec}
od-error-invalid-size = invalid size '{$size}' in format specification {$spec}
od-error-invalid-offset = invalid offset: {$offset}
od-error-invalid-label = invalid label: {$label}
od-error-too-many-inputs = too many inputs after --traditional: {$input}
od-error-parse-failed = parse failed
od-error-invalid-suffix = invalid suffix in --{$option} argument {$value}
od-error-invalid-argument = invalid --{$option} argument {$value}
od-error-argument-too-large = --{$option} argument {$value} too large
od-error-skip-past-end = tried to skip past end of input

# Help messages
od-help-help = Print help information.
od-help-address-radix = Select the base in which file offsets are printed.
od-help-skip-bytes = Skip bytes input bytes before formatting and writing.
od-help-read-bytes = limit dump to BYTES input bytes
od-help-endian = byte order to use for multi-byte formats
od-help-a = named characters, ignoring high-order bit
od-help-b = octal bytes
od-help-c = ASCII characters or backslash escapes
od-help-d = unsigned decimal 2-byte units
od-help-D = unsigned decimal 4-byte units
od-help-format = select output format or formats
od-help-output-duplicates = do not use * to mark line suppression
od-help-width = output BYTES bytes per output line. 32 is implied when BYTES is not
specified.
od-help-traditional = compatibility mode with one input, offset and label.
79 changes: 79 additions & 0 deletions src/uu/od/locales/fr-FR.ftl
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
od-about = Afficher les fichiers en format octal et autres formats
od-usage = od [OPTION]... [--] [NOMFICHIER]...
od [-abcdDefFhHiIlLoOsxX] [NOMFICHIER] [[+][0x]DÉCALAGE[.][b]]
od --traditional [OPTION]... [NOMFICHIER] [[+][0x]DÉCALAGE[.][b] [[+][0x]ÉTIQUETTE[.][b]]]
od-after-help = Affiche les données dans divers formats lisibles par l'homme. Si plusieurs
formats sont spécifiés, la sortie contiendra tous les formats dans l'ordre où ils
apparaissent sur la ligne de commande. Chaque format sera imprimé sur une nouvelle
ligne. Seule la ligne contenant le premier format sera préfixée avec le 10000 décalage.

Si aucun nom de fichier n'est spécifié, ou si c'est "-", stdin sera utilisé. Après
un "--", aucune autre option ne sera reconnue. Cela permet d'avoir des noms de
fichiers commençant par "-".

Si un nom de fichier est un nombre valide qui peut être utilisé comme décalage dans
la deuxième forme, vous pouvez le forcer à être reconnu comme un nom de fichier si
vous incluez une option comme "-j0", qui n'est valide que dans la première forme.

RADIX est l'un de o,d,x,n pour octal, décimal, hexadécimal ou aucun.

OCTETS est décimal par défaut, octal si préfixé par "0", ou hexadécimal si préfixé
par "0x". Les suffixes b, KB, K, MB, M, GB, G multiplieront le nombre par 512,
1000, 1024, 1000^2, 1024^2, 1000^3, 1024^3, 1000^2, 1024^2.

DÉCALAGE et ÉTIQUETTE sont octaux par défaut, hexadécimaux si préfixés par "0x" ou
décimaux si un suffixe "." est ajouté. Le suffixe "b" multipliera par 512.

TYPE contient une ou plusieurs spécifications de format constituées de :
a pour ASCII imprimable 7-bits
c pour caractères utf-8 ou octal pour caractères non définis
d[TAILLE] pour décimal signé
f[TAILLE] pour virgule flottante
o[TAILLE] pour octal
u[TAILLE] pour décimal non signé
x[TAILLE] pour hexadécimal
TAILLE est le nombre d'octets qui peut être le nombre 1, 2, 4, 8 ou 16,
ou C, I, S, L pour 1, 2, 4, 8 octets pour les types entiers,
ou F, D, L pour 4, 8, 16 octets pour les virgules flottantes.
Toute spécification de type peut avoir un suffixe "z", qui ajoutera un dump ASCII
à la fin de la ligne.

Si une erreur s'est produite, un message de diagnostic sera imprimé sur stderr, et
le code de sortie sera non-zéro.

# Messages d'erreur
od-error-invalid-endian = Argument invalide --endian={$endian}
od-error-invalid-inputs = Entrées invalides : {$msg}
od-error-too-large = la valeur est trop grande
od-error-radix-invalid = Radix doit être l'un de [o, d, x, n], reçu : {$radix}
od-error-radix-empty = Radix ne peut pas être vide, et doit être l'un de [o, d, x, n]
od-error-invalid-width = largeur invalide {$width} ; utilisation de {$min} à la place
od-error-missing-format-spec = spécification de format manquante après '--format' / '-t'
od-error-unexpected-char = caractère inattendu '{$char}' dans la spécification de format {$spec}
od-error-invalid-number = nombre invalide {$number} dans la spécification de format {$spec}
od-error-invalid-size = taille invalide '{$size}' dans la spécification de format {$spec}
od-error-invalid-offset = décalage invalide : {$offset}
od-error-invalid-label = étiquette invalide : {$label}
od-error-too-many-inputs = trop d'entrées après --traditional : {$input}
od-error-parse-failed = échec de l'analyse
od-error-invalid-suffix = suffixe invalide dans l'argument --{$option} {$value}
od-error-invalid-argument = argument --{$option} invalide {$value}
od-error-argument-too-large = argument --{$option} {$value} trop grand
od-error-skip-past-end = tentative d'ignorer au-delà de la fin de l'entrée

# Messages d'aide
od-help-help = Afficher les informations d'aide.
od-help-address-radix = Sélectionner la base dans laquelle les décalages de fichier sont imprimés.
od-help-skip-bytes = Ignorer les octets d'entrée avant le formatage et l'écriture.
od-help-read-bytes = limiter le dump à OCTETS octets d'entrée
od-help-endian = ordre des octets à utiliser pour les formats multi-octets
od-help-a = caractères nommés, ignorant le bit d'ordre supérieur
od-help-b = octets octaux
od-help-c = caractères ASCII ou échappements antislash
od-help-d = unités décimales non signées 2-octets
od-help-D = unités décimales non signées 4-octets
od-help-format = sélectionner le(s) format(s) de sortie
od-help-output-duplicates = ne pas utiliser * pour marquer la suppression de ligne
od-help-width = sortir OCTETS octets par ligne de sortie. 32 est impliqué quand OCTETS n'est pas
spécifié.
od-help-traditional = mode de compatibilité avec une entrée, décalage et étiquette.
99 changes: 65 additions & 34 deletions src/uu/od/src/od.rs
Copy link
Contributor
@cakebaker cakebaker Jun 24, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You missed a few strings on the following lines: 142, 652, 655, and 657.

Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
mod prn_int;

use std::cmp;
use std::collections::HashMap;
use std::fmt::Write;
use std::io::BufReader;

Expand All @@ -44,7 +45,7 @@
use clap::{Arg, ArgMatches, Command, parser::ValueSource};
use uucore::display::Quotable;
use uucore::error::{UResult, USimpleError};
use uucore::locale::get_message;
use uucore::locale::{get_message, get_message_with_args};
use uucore::parser::parse_size::ParseSizeError;
use uucore::parser::shortcut_value_parser::ShortcutValueParser;
use uucore::{format_usage, show_error, show_warning};
Expand Down Expand Up @@ -86,7 +87,10 @@
_ => {
return Err(USimpleError::new(
1,
format!("Invalid argument --endian={s}"),
get_message_with_args(
"od-error-invalid-endian",
HashMap::from([("endian".to_string(), s.to_string())]),
),

Check warning on line 93 in src/uu/od/src/od.rs

View check run for this annotation

Codecov / codecov/patch

src/uu/od/src/od.rs#L90-L93

Added lines #L90 - L93 were not covered by tests
));
}
}
Expand All @@ -109,8 +113,15 @@

let mut label: Option<u64> = None;

let parsed_input = parse_inputs(matches)
.map_err(|e| USimpleError::new(1, format!("Invalid inputs: {e}")))?;
let parsed_input = parse_inputs(matches).map_err(|e| {
USimpleError::new(
1,
get_message_with_args(
"od-error-invalid-inputs",
HashMap::from([("msg".to_string(), e.to_string())]),
),
)
})?;
let input_strings = match parsed_input {
CommandLineInputs::FileNames(v) => v,
CommandLineInputs::FileAndOffset((f, s, l)) => {
Expand Down Expand Up @@ -146,7 +157,16 @@
cmp::max(max, next.formatter_item_info.byte_size)
});
if line_bytes == 0 || line_bytes % min_bytes != 0 {
show_warning!("invalid width {line_bytes}; using {min_bytes} instead");
show_warning!(
"{}",
get_message_with_args(
"od-error-invalid-width",
HashMap::from([
("width".to_string(), line_bytes.to_string()),
("min".to_string(), min_bytes.to_string())
])
)
);
line_bytes = min_bytes;
}

Expand Down Expand Up @@ -183,16 +203,16 @@
_ => {
return Err(USimpleError::new(
1,
"Radix must be one of [o, d, x, n]".to_string(),
get_message_with_args(
"od-error-radix-invalid",
HashMap::from([("radix".to_string(), s.to_string())]),
),
));
}
}
} else {
// Return an error instead of panicking when `od -A ''` is executed.
return Err(USimpleError::new(
1,
"Radix cannot be empty, and must be one of [o, d, x, n]".to_string(),
));
return Err(USimpleError::new(1, get_message("od-error-radix-empty")));
}
}
};
Expand Down Expand Up @@ -261,34 +281,34 @@
.arg(
Arg::new(options::HELP)
.long(options::HELP)
.help("Print help information.")
.help(get_message("od-help-help"))
.action(ArgAction::Help)
)
.arg(
Arg::new(options::ADDRESS_RADIX)
.short('A')
.long(options::ADDRESS_RADIX)
.help("Select the base in which file offsets are printed.")
.help(get_message("od-help-address-radix"))
.value_name("RADIX"),
)
.arg(
Arg::new(options::SKIP_BYTES)
.short('j')
.long(options::SKIP_BYTES)
.help("Skip bytes input bytes before formatting and writing.")
.help(get_message("od-help-skip-bytes"))
.value_name("BYTES"),
)
.arg(
Arg::new(options::READ_BYTES)
.short('N')
.long(options::READ_BYTES)
.help("limit dump to BYTES input bytes")
.help(get_message("od-help-read-bytes"))
.value_name("BYTES"),
)
.arg(
Arg::new(options::ENDIAN)
.long(options::ENDIAN)
.help("byte order to use for multi-byte formats")
.help(get_message("od-help-endian"))
.value_parser(ShortcutValueParser::new(["big", "little"]))
.value_name("big|little"),
)
Expand All @@ -306,31 +326,31 @@
.arg(
Arg::new("a")
.short('a')
.help("named characters, ignoring high-order bit")
.help(get_message("od-help-a"))
.action(ArgAction::SetTrue),
)
.arg(
Arg::new("b")
.short('b')
.help("octal bytes")
.help(get_message("od-help-b"))
.action(ArgAction::SetTrue),
)
.arg(
Arg::new("c")
.short('c')
.help("ASCII characters or backslash escapes")
.help(get_message("od-help-c"))
.action(ArgAction::SetTrue),
)
.arg(
Arg::new("d")
.short('d')
.help("unsigned decimal 2-byte units")
.help(get_message("od-help-d"))
.action(ArgAction::SetTrue),
)
.arg(
Arg::new("D")
.short('D')
.help("unsigned decimal 4-byte units")
.help(get_message("od-help-D"))
.action(ArgAction::SetTrue),
)
.arg(
Expand Down Expand Up @@ -421,7 +441,7 @@
Arg::new(options::FORMAT)
.short('t')
.long("format")
.help("select output format or formats")
.help(get_message("od-help-format"))
.action(ArgAction::Append)
.num_args(1)
.value_name("TYPE"),
Expand All @@ -430,25 +450,22 @@
Arg::new(options::OUTPUT_DUPLICATES)
.short('v')
.long(options::OUTPUT_DUPLICATES)
.help("do not use * to mark line suppression")
.help(get_message("od-help-output-duplicates"))
.action(ArgAction::SetTrue),
)
.arg(
Arg::new(options::WIDTH)
.short('w')
.long(options::WIDTH)
.help(
"output BYTES bytes per output line. 32 is implied when BYTES is not \
specified.",
)
.help(get_message("od-help-width"))
.default_missing_value("32")
.value_name("BYTES")
.num_args(..=1),
)
.arg(
Arg::new(options::TRADITIONAL)
.long(options::TRADITIONAL)
.help("compatibility mode with one input, offset and label.")
.help(get_message("od-help-traditional"))
.action(ArgAction::SetTrue),
)
.arg(
Expand Down Expand Up @@ -631,12 +648,26 @@
// NOTE:
// GNU's od echos affected flag, -N or --read-bytes (-j or --skip-bytes, etc.), depending user's selection
match error {
ParseSizeError::InvalidSuffix(_) => {
format!("invalid suffix in --{option} argument {}", s.quote())
}
ParseSizeError::ParseFailure(_) | ParseSizeError::PhysicalMem(_) => {
format!("invalid --{option} argument {}", s.quote())
}
ParseSizeError::SizeTooBig(_) => format!("--{option} argument {} too large", s.quote()),
ParseSizeError::InvalidSuffix(_) => get_message_with_args(
"od-error-invalid-suffix",
HashMap::from([
("option".to_string(), option.to_string()),
("value".to_string(), s.quote().to_string()),
]),
),
ParseSizeError::ParseFailure(_) | ParseSizeError::PhysicalMem(_) => get_message_with_args(
"od-error-invalid-argument",
HashMap::from([
("option".to_string(), option.to_string()),
("value".to_string(), s.quote().to_string()),
]),
),
ParseSizeError::SizeTooBig(_) => get_message_with_args(
"od-error-argument-too-large",
HashMap::from([
("option".to_string(), option.to_string()),
("value".to_string(), s.quote().to_string()),
]),
),
}
}
Loading
Loading
0