Skip to content

Commit d41fe09

Browse files
authored
Merge pull request #8142 from sylvestre/l10n-paste
l10n: port paste for translation + add french
2 parents 143adfa + 09c1f0b commit d41fe09

File tree

3 files changed

+39
-7
lines changed

3 files changed

+39
-7
lines changed

src/uu/paste/locales/en-US.ftl

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,12 @@
11
paste-about = Write lines consisting of the sequentially corresponding lines from each
22
FILE, separated by TABs, to standard output.
33
paste-usage = paste [OPTIONS] [FILE]...
4+
5+
# Help messages
6+
paste-help-serial = paste one file at a time instead of in parallel
7+
paste-help-delimiter = reuse characters from LIST instead of TABs
8+
paste-help-zero-terminated = line delimiter is NUL, not newline
9+
10+
# Error messages
11+
paste-error-delimiter-unescaped-backslash = delimiter list ends with an unescaped backslash: { $delimiters }
12+
paste-error-stdin-borrow = failed to access standard input: { $error }

src/uu/paste/locales/fr-FR.ftl

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
paste-about = Écrire les lignes composées des lignes correspondantes séquentiellement de chaque
2+
FICHIER, séparées par des TABs, vers la sortie standard.
3+
paste-usage = paste [OPTIONS] [FICHIER]...
4+
5+
# Messages d'aide
6+
paste-help-serial = coller un fichier à la fois au lieu d'en parallèle
7+
paste-help-delimiter = réutiliser les caractères de LISTE au lieu des TABs
8+
paste-help-zero-terminated = le délimiteur de ligne est NUL, pas une nouvelle ligne
9+
10+
# Messages d'erreur
11+
paste-error-delimiter-unescaped-backslash = la liste de délimiteurs se termine par une barre oblique inverse non échappée : { $delimiters }
12+
paste-error-stdin-borrow = échec de l'accès à l'entrée standard : { $error }

src/uu/paste/src/paste.rs

Lines changed: 18 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55

66
use clap::{Arg, ArgAction, Command};
77
use std::cell::{OnceCell, RefCell};
8+
use std::collections::HashMap;
89
use std::fs::File;
910
use std::io::{BufRead, BufReader, Stdin, Write, stdin, stdout};
1011
use std::iter::Cycle;
@@ -13,8 +14,7 @@ use std::slice::Iter;
1314
use uucore::error::{UResult, USimpleError};
1415
use uucore::format_usage;
1516
use uucore::line_ending::LineEnding;
16-
17-
use uucore::locale::get_message;
17+
use uucore::locale::{get_message, get_message_with_args};
1818

1919
mod options {
2020
pub const DELIMITER: &str = "delimiters";
@@ -49,14 +49,14 @@ pub fn uu_app() -> Command {
4949
Arg::new(options::SERIAL)
5050
.long(options::SERIAL)
5151
.short('s')
52-
.help("paste one file at a time instead of in parallel")
52+
.help(get_message("paste-help-serial"))
5353
.action(ArgAction::SetTrue),
5454
)
5555
.arg(
5656
Arg::new(options::DELIMITER)
5757
.long(options::DELIMITER)
5858
.short('d')
59-
.help("reuse characters from LIST instead of TABs")
59+
.help(get_message("paste-help-delimiter"))
6060
.value_name("LIST")
6161
.default_value("\t")
6262
.hide_default_value(true),
@@ -72,7 +72,7 @@ pub fn uu_app() -> Command {
7272
Arg::new(options::ZERO_TERMINATED)
7373
.long(options::ZERO_TERMINATED)
7474
.short('z')
75-
.help("line delimiter is NUL, not newline")
75+
.help(get_message("paste-help-zero-terminated"))
7676
.action(ArgAction::SetTrue),
7777
)
7878
}
@@ -237,7 +237,10 @@ fn parse_delimiters(delimiters: &str) -> UResult<Box<[Box<[u8]>]>> {
237237
None => {
238238
return Err(USimpleError::new(
239239
1,
240-
format!("delimiter list ends with an unescaped backslash: {delimiters}"),
240+
get_message_with_args(
241+
"paste-error-delimiter-unescaped-backslash",
242+
HashMap::from([("delimiters".to_string(), delimiters.to_string())]),
243+
),
241244
));
242245
}
243246
},
@@ -365,7 +368,15 @@ impl InputSource {
365368
InputSource::File(bu) => bu.read_until(byte, buf)?,
366369
InputSource::StandardInput(rc) => rc
367370
.try_borrow()
368-
.map_err(|bo| USimpleError::new(1, format!("{bo}")))?
371+
.map_err(|bo| {
372+
USimpleError::new(
373+
1,
374+
get_message_with_args(
375+
"paste-error-stdin-borrow",
376+
HashMap::from([("error".to_string(), bo.to_string())]),
377+
),
378+
)
379+
})?
369380
.lock()
370381
.read_until(byte, buf)?,
371382
};

0 commit comments

Comments
 (0)