1
Fork 0
mirror of https://github.com/RGBCube/uutils-coreutils synced 2025-07-28 11:37:44 +00:00

Merge pull request #8122 from sylvestre/l10n-tee

l10n: port tee for translation + add french
This commit is contained in:
Daniel Hofstetter 2025-06-09 07:24:23 +02:00 committed by GitHub
commit 308bf0eeae
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 57 additions and 14 deletions

View file

@ -1,3 +1,20 @@
tee-about = Copy standard input to each FILE, and also to standard output. tee-about = Copy standard input to each FILE, and also to standard output.
tee-usage = tee [OPTION]... [FILE]... tee-usage = tee [OPTION]... [FILE]...
tee-after-help = If a FILE is -, it refers to a file named - . tee-after-help = If a FILE is -, it refers to a file named - .
# Help messages
tee-help-help = Print help
tee-help-append = append to the given FILEs, do not overwrite
tee-help-ignore-interrupts = ignore interrupt signals (ignored on non-Unix platforms)
tee-help-ignore-pipe-errors = set write error behavior (ignored on non-Unix platforms)
tee-help-output-error = set write error behavior
tee-help-output-error-warn = produce warnings for errors writing to any output
tee-help-output-error-warn-nopipe = produce warnings for errors that are not pipe errors (ignored on non-unix platforms)
tee-help-output-error-exit = exit on write errors to any output
tee-help-output-error-exit-nopipe = exit on write errors to any output that are not pipe errors (equivalent to exit on non-unix platforms)
# Error messages
tee-error-stdin = stdin: { $error }
# Other messages
tee-standard-output = 'standard output'

View file

@ -0,0 +1,20 @@
tee-about = Copier l'entrée standard vers chaque FICHIER, et aussi vers la sortie standard.
tee-usage = tee [OPTION]... [FICHIER]...
tee-after-help = Si un FICHIER est -, il fait référence à un fichier nommé - .
# Messages d'aide
tee-help-help = Afficher l'aide
tee-help-append = ajouter aux FICHIERs donnés, ne pas écraser
tee-help-ignore-interrupts = ignorer les signaux d'interruption (ignoré sur les plateformes non-Unix)
tee-help-ignore-pipe-errors = définir le comportement d'erreur d'écriture (ignoré sur les plateformes non-Unix)
tee-help-output-error = définir le comportement d'erreur d'écriture
tee-help-output-error-warn = produire des avertissements pour les erreurs d'écriture vers toute sortie
tee-help-output-error-warn-nopipe = produire des avertissements pour les erreurs qui ne sont pas des erreurs de tube (ignoré sur les plateformes non-unix)
tee-help-output-error-exit = quitter en cas d'erreurs d'écriture vers toute sortie
tee-help-output-error-exit-nopipe = quitter en cas d'erreurs d'écriture vers toute sortie qui ne sont pas des erreurs de tube (équivalent à exit sur les plateformes non-unix)
# Messages d'erreur
tee-error-stdin = stdin : { $error }
# Autres messages
tee-standard-output = 'sortie standard'

View file

@ -19,7 +19,8 @@ use uucore::{format_usage, show_error};
#[cfg(unix)] #[cfg(unix)]
use uucore::signals::{enable_pipe_errors, ignore_interrupts}; use uucore::signals::{enable_pipe_errors, ignore_interrupts};
use uucore::locale::get_message; use std::collections::HashMap;
use uucore::locale::{get_message, get_message_with_args};
mod options { mod options {
pub const APPEND: &str = "append"; pub const APPEND: &str = "append";
@ -106,21 +107,21 @@ pub fn uu_app() -> Command {
Arg::new("--help") Arg::new("--help")
.short('h') .short('h')
.long("help") .long("help")
.help("Print help") .help(get_message("tee-help-help"))
.action(ArgAction::HelpLong) .action(ArgAction::HelpLong),
) )
.arg( .arg(
Arg::new(options::APPEND) Arg::new(options::APPEND)
.long(options::APPEND) .long(options::APPEND)
.short('a') .short('a')
.help("append to the given FILEs, do not overwrite") .help(get_message("tee-help-append"))
.action(ArgAction::SetTrue), .action(ArgAction::SetTrue),
) )
.arg( .arg(
Arg::new(options::IGNORE_INTERRUPTS) Arg::new(options::IGNORE_INTERRUPTS)
.long(options::IGNORE_INTERRUPTS) .long(options::IGNORE_INTERRUPTS)
.short('i') .short('i')
.help("ignore interrupt signals (ignored on non-Unix platforms)") .help(get_message("tee-help-ignore-interrupts"))
.action(ArgAction::SetTrue), .action(ArgAction::SetTrue),
) )
.arg( .arg(
@ -131,7 +132,7 @@ pub fn uu_app() -> Command {
.arg( .arg(
Arg::new(options::IGNORE_PIPE_ERRORS) Arg::new(options::IGNORE_PIPE_ERRORS)
.short('p') .short('p')
.help("set write error behavior (ignored on non-Unix platforms)") .help(get_message("tee-help-ignore-pipe-errors"))
.action(ArgAction::SetTrue), .action(ArgAction::SetTrue),
) )
.arg( .arg(
@ -140,15 +141,14 @@ pub fn uu_app() -> Command {
.require_equals(true) .require_equals(true)
.num_args(0..=1) .num_args(0..=1)
.value_parser(ShortcutValueParser::new([ .value_parser(ShortcutValueParser::new([
PossibleValue::new("warn") PossibleValue::new("warn").help(get_message("tee-help-output-error-warn")),
.help("produce warnings for errors writing to any output"),
PossibleValue::new("warn-nopipe") PossibleValue::new("warn-nopipe")
.help("produce warnings for errors that are not pipe errors (ignored on non-unix platforms)"), .help(get_message("tee-help-output-error-warn-nopipe")),
PossibleValue::new("exit").help("exit on write errors to any output"), PossibleValue::new("exit").help(get_message("tee-help-output-error-exit")),
PossibleValue::new("exit-nopipe") PossibleValue::new("exit-nopipe")
.help("exit on write errors to any output that are not pipe errors (equivalent to exit on non-unix platforms)"), .help(get_message("tee-help-output-error-exit-nopipe")),
])) ]))
.help("set write error behavior") .help(get_message("tee-help-output-error")),
) )
} }
@ -175,7 +175,7 @@ fn tee(options: &Options) -> Result<()> {
writers.insert( writers.insert(
0, 0,
NamedWriter { NamedWriter {
name: "'standard output'".to_owned(), name: get_message("tee-standard-output"),
inner: Box::new(stdout()), inner: Box::new(stdout()),
}, },
); );
@ -373,7 +373,13 @@ impl Read for NamedReader {
fn read(&mut self, buf: &mut [u8]) -> Result<usize> { fn read(&mut self, buf: &mut [u8]) -> Result<usize> {
match self.inner.read(buf) { match self.inner.read(buf) {
Err(f) => { Err(f) => {
show_error!("stdin: {f}"); show_error!(
"{}",
get_message_with_args(
"tee-error-stdin",
HashMap::from([("error".to_string(), f.to_string())])
)
);
Err(f) Err(f)
} }
okay => okay, okay => okay,