mirror of
https://github.com/RGBCube/uutils-coreutils
synced 2025-07-28 11:37:44 +00:00
Merge pull request #8109 from sylvestre/l10n-unexpand
l10n: port unexpand to translation + add french
This commit is contained in:
commit
37cf6f516e
3 changed files with 43 additions and 13 deletions
|
@ -1,3 +1,16 @@
|
||||||
unexpand-about = Convert blanks in each FILE to tabs, writing to standard output.
|
unexpand-about = Convert blanks in each FILE to tabs, writing to standard output.
|
||||||
With no FILE, or when FILE is -, read standard input.
|
With no FILE, or when FILE is -, read standard input.
|
||||||
unexpand-usage = unexpand [OPTION]... [FILE]...
|
unexpand-usage = unexpand [OPTION]... [FILE]...
|
||||||
|
|
||||||
|
# Help messages
|
||||||
|
unexpand-help-all = convert all blanks, instead of just initial blanks
|
||||||
|
unexpand-help-first-only = convert only leading sequences of blanks (overrides -a)
|
||||||
|
unexpand-help-tabs = use comma separated LIST of tab positions or have tabs N characters apart instead of 8 (enables -a)
|
||||||
|
unexpand-help-no-utf8 = interpret input file as 8-bit ASCII rather than UTF-8
|
||||||
|
|
||||||
|
# Error messages
|
||||||
|
unexpand-error-invalid-character = tab size contains invalid character(s): { $char }
|
||||||
|
unexpand-error-tab-size-cannot-be-zero = tab size cannot be 0
|
||||||
|
unexpand-error-tab-size-too-large = tab stop value is too large
|
||||||
|
unexpand-error-tab-sizes-must-be-ascending = tab sizes must be ascending
|
||||||
|
unexpand-error-is-directory = { $path }: Is a directory
|
||||||
|
|
16
src/uu/unexpand/locales/fr-FR.ftl
Normal file
16
src/uu/unexpand/locales/fr-FR.ftl
Normal file
|
@ -0,0 +1,16 @@
|
||||||
|
unexpand-about = Convertir les espaces dans chaque FICHIER en tabulations, en écrivant vers la sortie standard.
|
||||||
|
Sans FICHIER, ou quand FICHIER est -, lire l'entrée standard.
|
||||||
|
unexpand-usage = unexpand [OPTION]... [FICHIER]...
|
||||||
|
|
||||||
|
# Messages d'aide
|
||||||
|
unexpand-help-all = convertir tous les espaces, au lieu de seulement les espaces initiaux
|
||||||
|
unexpand-help-first-only = convertir seulement les séquences d'espaces en début de ligne (remplace -a)
|
||||||
|
unexpand-help-tabs = utiliser une LISTE séparée par des virgules de positions de tabulations ou avoir des tabulations de N caractères au lieu de 8 (active -a)
|
||||||
|
unexpand-help-no-utf8 = interpréter le fichier d'entrée comme ASCII 8-bit plutôt que UTF-8
|
||||||
|
|
||||||
|
# Messages d'erreur
|
||||||
|
unexpand-error-invalid-character = la taille de tabulation contient des caractères invalides : { $char }
|
||||||
|
unexpand-error-tab-size-cannot-be-zero = la taille de tabulation ne peut pas être 0
|
||||||
|
unexpand-error-tab-size-too-large = la valeur d'arrêt de tabulation est trop grande
|
||||||
|
unexpand-error-tab-sizes-must-be-ascending = les tailles de tabulation doivent être croissantes
|
||||||
|
unexpand-error-is-directory = { $path } : Est un répertoire
|
|
@ -6,6 +6,7 @@
|
||||||
// spell-checker:ignore (ToDO) nums aflag uflag scol prevtab amode ctype cwidth nbytes lastcol pctype Preprocess
|
// spell-checker:ignore (ToDO) nums aflag uflag scol prevtab amode ctype cwidth nbytes lastcol pctype Preprocess
|
||||||
|
|
||||||
use clap::{Arg, ArgAction, Command};
|
use clap::{Arg, ArgAction, Command};
|
||||||
|
use std::collections::HashMap;
|
||||||
use std::fs::File;
|
use std::fs::File;
|
||||||
use std::io::{BufRead, BufReader, BufWriter, Read, Stdout, Write, stdin, stdout};
|
use std::io::{BufRead, BufReader, BufWriter, Read, Stdout, Write, stdin, stdout};
|
||||||
use std::num::IntErrorKind;
|
use std::num::IntErrorKind;
|
||||||
|
@ -17,19 +18,19 @@ use uucore::display::Quotable;
|
||||||
use uucore::error::{FromIo, UError, UResult, USimpleError};
|
use uucore::error::{FromIo, UError, UResult, USimpleError};
|
||||||
use uucore::{format_usage, show};
|
use uucore::{format_usage, show};
|
||||||
|
|
||||||
use uucore::locale::get_message;
|
use uucore::locale::{get_message, get_message_with_args};
|
||||||
|
|
||||||
const DEFAULT_TABSTOP: usize = 8;
|
const DEFAULT_TABSTOP: usize = 8;
|
||||||
|
|
||||||
#[derive(Debug, Error)]
|
#[derive(Debug, Error)]
|
||||||
enum ParseError {
|
enum ParseError {
|
||||||
#[error("tab size contains invalid character(s): {}", _0.quote())]
|
#[error("{}", get_message_with_args("unexpand-error-invalid-character", HashMap::from([("char".to_string(), _0.quote().to_string())])))]
|
||||||
InvalidCharacter(String),
|
InvalidCharacter(String),
|
||||||
#[error("tab size cannot be 0")]
|
#[error("{}", get_message("unexpand-error-tab-size-cannot-be-zero"))]
|
||||||
TabSizeCannotBeZero,
|
TabSizeCannotBeZero,
|
||||||
#[error("tab stop value is too large")]
|
#[error("{}", get_message("unexpand-error-tab-size-too-large"))]
|
||||||
TabSizeTooLarge,
|
TabSizeTooLarge,
|
||||||
#[error("tab sizes must be ascending")]
|
#[error("{}", get_message("unexpand-error-tab-sizes-must-be-ascending"))]
|
||||||
TabSizesMustBeAscending,
|
TabSizesMustBeAscending,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -169,23 +170,20 @@ pub fn uu_app() -> Command {
|
||||||
Arg::new(options::ALL)
|
Arg::new(options::ALL)
|
||||||
.short('a')
|
.short('a')
|
||||||
.long(options::ALL)
|
.long(options::ALL)
|
||||||
.help("convert all blanks, instead of just initial blanks")
|
.help(get_message("unexpand-help-all"))
|
||||||
.action(ArgAction::SetTrue),
|
.action(ArgAction::SetTrue),
|
||||||
)
|
)
|
||||||
.arg(
|
.arg(
|
||||||
Arg::new(options::FIRST_ONLY)
|
Arg::new(options::FIRST_ONLY)
|
||||||
.long(options::FIRST_ONLY)
|
.long(options::FIRST_ONLY)
|
||||||
.help("convert only leading sequences of blanks (overrides -a)")
|
.help(get_message("unexpand-help-first-only"))
|
||||||
.action(ArgAction::SetTrue),
|
.action(ArgAction::SetTrue),
|
||||||
)
|
)
|
||||||
.arg(
|
.arg(
|
||||||
Arg::new(options::TABS)
|
Arg::new(options::TABS)
|
||||||
.short('t')
|
.short('t')
|
||||||
.long(options::TABS)
|
.long(options::TABS)
|
||||||
.help(
|
.help(get_message("unexpand-help-tabs"))
|
||||||
"use comma separated LIST of tab positions or have tabs N characters \
|
|
||||||
apart instead of 8 (enables -a)",
|
|
||||||
)
|
|
||||||
.action(ArgAction::Append)
|
.action(ArgAction::Append)
|
||||||
.value_name("N, LIST"),
|
.value_name("N, LIST"),
|
||||||
)
|
)
|
||||||
|
@ -193,7 +191,7 @@ pub fn uu_app() -> Command {
|
||||||
Arg::new(options::NO_UTF8)
|
Arg::new(options::NO_UTF8)
|
||||||
.short('U')
|
.short('U')
|
||||||
.long(options::NO_UTF8)
|
.long(options::NO_UTF8)
|
||||||
.help("interpret input file as 8-bit ASCII rather than UTF-8")
|
.help(get_message("unexpand-help-no-utf8"))
|
||||||
.action(ArgAction::SetTrue),
|
.action(ArgAction::SetTrue),
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
@ -204,7 +202,10 @@ fn open(path: &str) -> UResult<BufReader<Box<dyn Read + 'static>>> {
|
||||||
if filename.is_dir() {
|
if filename.is_dir() {
|
||||||
Err(Box::new(USimpleError {
|
Err(Box::new(USimpleError {
|
||||||
code: 1,
|
code: 1,
|
||||||
message: format!("{}: Is a directory", filename.display()),
|
message: get_message_with_args(
|
||||||
|
"unexpand-error-is-directory",
|
||||||
|
HashMap::from([("path".to_string(), filename.display().to_string())]),
|
||||||
|
),
|
||||||
}))
|
}))
|
||||||
} else if path == "-" {
|
} else if path == "-" {
|
||||||
Ok(BufReader::new(Box::new(stdin()) as Box<dyn Read>))
|
Ok(BufReader::new(Box::new(stdin()) as Box<dyn Read>))
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue