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

l10n: port tee for translation + add french

This commit is contained in:
Sylvestre Ledru 2025-06-08 21:01:57 +02:00
parent 4128efad0f
commit 4e248d511f
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-usage = tee [OPTION]... [FILE]...
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)]
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 {
pub const APPEND: &str = "append";
@ -106,21 +107,21 @@ pub fn uu_app() -> Command {
Arg::new("--help")
.short('h')
.long("help")
.help("Print help")
.action(ArgAction::HelpLong)
.help(get_message("tee-help-help"))
.action(ArgAction::HelpLong),
)
.arg(
Arg::new(options::APPEND)
.long(options::APPEND)
.short('a')
.help("append to the given FILEs, do not overwrite")
.help(get_message("tee-help-append"))
.action(ArgAction::SetTrue),
)
.arg(
Arg::new(options::IGNORE_INTERRUPTS)
.long(options::IGNORE_INTERRUPTS)
.short('i')
.help("ignore interrupt signals (ignored on non-Unix platforms)")
.help(get_message("tee-help-ignore-interrupts"))
.action(ArgAction::SetTrue),
)
.arg(
@ -131,7 +132,7 @@ pub fn uu_app() -> Command {
.arg(
Arg::new(options::IGNORE_PIPE_ERRORS)
.short('p')
.help("set write error behavior (ignored on non-Unix platforms)")
.help(get_message("tee-help-ignore-pipe-errors"))
.action(ArgAction::SetTrue),
)
.arg(
@ -140,15 +141,14 @@ pub fn uu_app() -> Command {
.require_equals(true)
.num_args(0..=1)
.value_parser(ShortcutValueParser::new([
PossibleValue::new("warn")
.help("produce warnings for errors writing to any output"),
PossibleValue::new("warn").help(get_message("tee-help-output-error-warn")),
PossibleValue::new("warn-nopipe")
.help("produce warnings for errors that are not pipe errors (ignored on non-unix platforms)"),
PossibleValue::new("exit").help("exit on write errors to any output"),
.help(get_message("tee-help-output-error-warn-nopipe")),
PossibleValue::new("exit").help(get_message("tee-help-output-error-exit")),
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(
0,
NamedWriter {
name: "'standard output'".to_owned(),
name: get_message("tee-standard-output"),
inner: Box::new(stdout()),
},
);
@ -373,7 +373,13 @@ impl Read for NamedReader {
fn read(&mut self, buf: &mut [u8]) -> Result<usize> {
match self.inner.read(buf) {
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)
}
okay => okay,