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

l10n: port seq for translation + add french

This commit is contained in:
Sylvestre Ledru 2025-06-15 21:46:53 +02:00
parent f825409392
commit fdb1a2cf7f
4 changed files with 52 additions and 11 deletions

View file

@ -2,3 +2,19 @@ seq-about = Display numbers from FIRST to LAST, in steps of INCREMENT.
seq-usage = seq [OPTION]... LAST seq-usage = seq [OPTION]... LAST
seq [OPTION]... FIRST LAST seq [OPTION]... FIRST LAST
seq [OPTION]... FIRST INCREMENT LAST seq [OPTION]... FIRST INCREMENT LAST
# Help messages
seq-help-separator = Separator character (defaults to \n)
seq-help-terminator = Terminator character (defaults to \n)
seq-help-equal-width = Equalize widths of all numbers by padding with zeros
seq-help-format = use printf style floating-point FORMAT
# Error messages
seq-error-parse = invalid { $type } argument: { $arg }
seq-error-zero-increment = invalid Zero increment value: { $arg }
seq-error-no-arguments = missing operand
seq-error-format-and-equal-width = format string may not be specified when printing equal width strings
# Parse error types
seq-parse-error-type-float = floating point
seq-parse-error-type-nan = 'not-a-number'

View file

@ -0,0 +1,20 @@
seq-about = Afficher les nombres de PREMIER à DERNIER, par incréments d'INCRÉMENT.
seq-usage = seq [OPTION]... DERNIER
seq [OPTION]... PREMIER DERNIER
seq [OPTION]... PREMIER INCRÉMENT DERNIER
# Messages d'aide
seq-help-separator = Caractère séparateur (par défaut \n)
seq-help-terminator = Caractère terminateur (par défaut \n)
seq-help-equal-width = Égaliser les largeurs de tous les nombres en remplissant avec des zéros
seq-help-format = utiliser le FORMAT de nombre à virgule flottante de style printf
# Messages d'erreur
seq-error-parse = argument { $type } invalide : { $arg }
seq-error-zero-increment = valeur d'incrément zéro invalide : { $arg }
seq-error-no-arguments = opérande manquant
seq-error-format-and-equal-width = la chaîne de format ne peut pas être spécifiée lors de l'impression de chaînes de largeur égale
# Types d'erreur d'analyse
seq-parse-error-type-float = nombre à virgule flottante
seq-parse-error-type-nan = 'non-un-nombre'

View file

@ -5,9 +5,11 @@
// spell-checker:ignore numberparse // spell-checker:ignore numberparse
//! Errors returned by seq. //! Errors returned by seq.
use crate::numberparse::ParseNumberError; use crate::numberparse::ParseNumberError;
use std::collections::HashMap;
use thiserror::Error; use thiserror::Error;
use uucore::display::Quotable; use uucore::display::Quotable;
use uucore::error::UError; use uucore::error::UError;
use uucore::locale::{get_message, get_message_with_args};
#[derive(Debug, Error)] #[derive(Debug, Error)]
pub enum SeqError { pub enum SeqError {
@ -15,29 +17,32 @@ pub enum SeqError {
/// ///
/// The parameters are the [`String`] argument as read from the /// The parameters are the [`String`] argument as read from the
/// command line and the underlying parsing error itself. /// command line and the underlying parsing error itself.
#[error("invalid {} argument: {}", parse_error_type(.1), .0.quote())] #[error("{}", get_message_with_args("seq-error-parse", HashMap::from([("type".to_string(), parse_error_type(.1).to_string()), ("arg".to_string(), .0.quote().to_string())])))]
ParseError(String, ParseNumberError), ParseError(String, ParseNumberError),
/// The increment argument was zero, which is not allowed. /// The increment argument was zero, which is not allowed.
/// ///
/// The parameter is the increment argument as a [`String`] as read /// The parameter is the increment argument as a [`String`] as read
/// from the command line. /// from the command line.
#[error("invalid Zero increment value: {}", .0.quote())] #[error("{}", get_message_with_args("seq-error-zero-increment", HashMap::from([("arg".to_string(), .0.quote().to_string())])))]
ZeroIncrement(String), ZeroIncrement(String),
/// No arguments were passed to this function, 1 or more is required /// No arguments were passed to this function, 1 or more is required
#[error("missing operand")] #[error("{}", get_message_with_args("seq-error-no-arguments", HashMap::new()))]
NoArguments, NoArguments,
/// Both a format and equal width where passed to seq /// Both a format and equal width where passed to seq
#[error("format string may not be specified when printing equal width strings")] #[error(
"{}",
get_message_with_args("seq-error-format-and-equal-width", HashMap::new())
)]
FormatAndEqualWidth, FormatAndEqualWidth,
} }
fn parse_error_type(e: &ParseNumberError) -> &'static str { fn parse_error_type(e: &ParseNumberError) -> String {
match e { match e {
ParseNumberError::Float => "floating point", ParseNumberError::Float => get_message("seq-parse-error-type-float"),
ParseNumberError::Nan => "'not-a-number'", ParseNumberError::Nan => get_message("seq-parse-error-type-nan"),
} }
} }

View file

@ -227,26 +227,26 @@ pub fn uu_app() -> Command {
Arg::new(OPT_SEPARATOR) Arg::new(OPT_SEPARATOR)
.short('s') .short('s')
.long("separator") .long("separator")
.help("Separator character (defaults to \\n)"), .help(get_message("seq-help-separator")),
) )
.arg( .arg(
Arg::new(OPT_TERMINATOR) Arg::new(OPT_TERMINATOR)
.short('t') .short('t')
.long("terminator") .long("terminator")
.help("Terminator character (defaults to \\n)"), .help(get_message("seq-help-terminator")),
) )
.arg( .arg(
Arg::new(OPT_EQUAL_WIDTH) Arg::new(OPT_EQUAL_WIDTH)
.short('w') .short('w')
.long("equal-width") .long("equal-width")
.help("Equalize widths of all numbers by padding with zeros") .help(get_message("seq-help-equal-width"))
.action(ArgAction::SetTrue), .action(ArgAction::SetTrue),
) )
.arg( .arg(
Arg::new(OPT_FORMAT) Arg::new(OPT_FORMAT)
.short('f') .short('f')
.long(OPT_FORMAT) .long(OPT_FORMAT)
.help("use printf style floating-point FORMAT"), .help(get_message("seq-help-format")),
) )
.arg( .arg(
// we use allow_hyphen_values instead of allow_negative_numbers because clap removed // we use allow_hyphen_values instead of allow_negative_numbers because clap removed