diff --git a/src/uu/paste/locales/en-US.ftl b/src/uu/paste/locales/en-US.ftl index 15c39b0a6..8dc74ad2d 100644 --- a/src/uu/paste/locales/en-US.ftl +++ b/src/uu/paste/locales/en-US.ftl @@ -1,3 +1,12 @@ paste-about = Write lines consisting of the sequentially corresponding lines from each FILE, separated by TABs, to standard output. paste-usage = paste [OPTIONS] [FILE]... + +# Help messages +paste-help-serial = paste one file at a time instead of in parallel +paste-help-delimiter = reuse characters from LIST instead of TABs +paste-help-zero-terminated = line delimiter is NUL, not newline + +# Error messages +paste-error-delimiter-unescaped-backslash = delimiter list ends with an unescaped backslash: { $delimiters } +paste-error-stdin-borrow = failed to access standard input: { $error } diff --git a/src/uu/paste/locales/fr-FR.ftl b/src/uu/paste/locales/fr-FR.ftl new file mode 100644 index 000000000..320b9e422 --- /dev/null +++ b/src/uu/paste/locales/fr-FR.ftl @@ -0,0 +1,12 @@ +paste-about = Écrire les lignes composées des lignes correspondantes séquentiellement de chaque + FICHIER, séparées par des TABs, vers la sortie standard. +paste-usage = paste [OPTIONS] [FICHIER]... + +# Messages d'aide +paste-help-serial = coller un fichier à la fois au lieu d'en parallèle +paste-help-delimiter = réutiliser les caractères de LISTE au lieu des TABs +paste-help-zero-terminated = le délimiteur de ligne est NUL, pas une nouvelle ligne + +# Messages d'erreur +paste-error-delimiter-unescaped-backslash = la liste de délimiteurs se termine par une barre oblique inverse non échappée : { $delimiters } +paste-error-stdin-borrow = échec de l'accès à l'entrée standard : { $error } diff --git a/src/uu/paste/src/paste.rs b/src/uu/paste/src/paste.rs index 9bb94294f..856de30ef 100644 --- a/src/uu/paste/src/paste.rs +++ b/src/uu/paste/src/paste.rs @@ -5,6 +5,7 @@ use clap::{Arg, ArgAction, Command}; use std::cell::{OnceCell, RefCell}; +use std::collections::HashMap; use std::fs::File; use std::io::{BufRead, BufReader, Stdin, Write, stdin, stdout}; use std::iter::Cycle; @@ -13,8 +14,7 @@ use std::slice::Iter; use uucore::error::{UResult, USimpleError}; use uucore::format_usage; use uucore::line_ending::LineEnding; - -use uucore::locale::get_message; +use uucore::locale::{get_message, get_message_with_args}; mod options { pub const DELIMITER: &str = "delimiters"; @@ -49,14 +49,14 @@ pub fn uu_app() -> Command { Arg::new(options::SERIAL) .long(options::SERIAL) .short('s') - .help("paste one file at a time instead of in parallel") + .help(get_message("paste-help-serial")) .action(ArgAction::SetTrue), ) .arg( Arg::new(options::DELIMITER) .long(options::DELIMITER) .short('d') - .help("reuse characters from LIST instead of TABs") + .help(get_message("paste-help-delimiter")) .value_name("LIST") .default_value("\t") .hide_default_value(true), @@ -72,7 +72,7 @@ pub fn uu_app() -> Command { Arg::new(options::ZERO_TERMINATED) .long(options::ZERO_TERMINATED) .short('z') - .help("line delimiter is NUL, not newline") + .help(get_message("paste-help-zero-terminated")) .action(ArgAction::SetTrue), ) } @@ -237,7 +237,10 @@ fn parse_delimiters(delimiters: &str) -> UResult]>> { None => { return Err(USimpleError::new( 1, - format!("delimiter list ends with an unescaped backslash: {delimiters}"), + get_message_with_args( + "paste-error-delimiter-unescaped-backslash", + HashMap::from([("delimiters".to_string(), delimiters.to_string())]), + ), )); } }, @@ -365,7 +368,15 @@ impl InputSource { InputSource::File(bu) => bu.read_until(byte, buf)?, InputSource::StandardInput(rc) => rc .try_borrow() - .map_err(|bo| USimpleError::new(1, format!("{bo}")))? + .map_err(|bo| { + USimpleError::new( + 1, + get_message_with_args( + "paste-error-stdin-borrow", + HashMap::from([("error".to_string(), bo.to_string())]), + ), + ) + })? .lock() .read_until(byte, buf)?, };