Merge pull request #8529 from sylvestre/cat-translation

cat: add support for translation
This commit is contained in:
Daniel Hofstetter
2025-09-01 07:24:16 +02:00
committed by GitHub
3 changed files with 53 additions and 14 deletions
+18
View File
@@ -1,3 +1,21 @@
cat-about = Concatenate FILE(s), or standard input, to standard output
With no FILE, or when FILE is -, read standard input.
cat-usage = cat [OPTION]... [FILE]...
# Help messages
cat-help-show-all = equivalent to -vET
cat-help-number-nonblank = number nonempty output lines, overrides -n
cat-help-show-nonprinting-ends = equivalent to -vE
cat-help-show-ends = display $ at end of each line
cat-help-number = number all output lines
cat-help-squeeze-blank = suppress repeated empty output lines
cat-help-show-nonprinting-tabs = equivalent to -vT
cat-help-show-tabs = display TAB characters at ^I
cat-help-show-nonprinting = use ^ and M- notation, except for LF (\n) and TAB (\t)
cat-help-ignored-u = (ignored)
# Error messages
cat-error-unknown-filetype = unknown filetype: { $ft_debug }
cat-error-is-directory = Is a directory
cat-error-input-file-is-output-file = input file is output file
cat-error-too-many-symbolic-links = Too many levels of symbolic links
+21
View File
@@ -0,0 +1,21 @@
cat-about = Concaténer les FICHIER(s), ou l'entrée standard, vers la sortie standard
Si aucun FICHIER, ou quand FICHIER est -, lire l'entrée standard.
cat-usage = cat [OPTION]... [FICHIER]...
# Messages d'aide
cat-help-show-all = équivalent à -vET
cat-help-number-nonblank = numéroter les lignes de sortie non vides, remplace -n
cat-help-show-nonprinting-ends = équivalent à -vE
cat-help-show-ends = afficher $ à la fin de chaque ligne
cat-help-number = numéroter toutes les lignes de sortie
cat-help-squeeze-blank = supprimer les lignes vides répétées en sortie
cat-help-show-nonprinting-tabs = équivalent à -vT
cat-help-show-tabs = afficher les caractères TAB comme ^I
cat-help-show-nonprinting = utiliser la notation ^ et M-, sauf pour LF (\n) et TAB (\t)
cat-help-ignored-u = (ignoré)
# Messages d'erreur
cat-error-unknown-filetype = type de fichier inconnu : { $ft_debug }
cat-error-is-directory = Est un répertoire
cat-error-input-file-is-output-file = le fichier d'entrée est le fichier de sortie
cat-error-too-many-symbolic-links = Trop de niveaux de liens symboliques
+14 -14
View File
@@ -97,16 +97,16 @@ enum CatError {
#[error("{0}")]
Nix(#[from] nix::Error),
/// Unknown file type; it's not a regular file, socket, etc.
#[error("unknown filetype: {ft_debug}")]
#[error("{}", translate!("cat-error-unknown-filetype", "ft_debug" => .ft_debug))]
UnknownFiletype {
/// A debug print of the file type
ft_debug: String,
},
#[error("Is a directory")]
#[error("{}", translate!("cat-error-is-directory"))]
IsDirectory,
#[error("input file is output file")]
#[error("{}", translate!("cat-error-input-file-is-output-file"))]
OutputIsInput,
#[error("Too many levels of symbolic links")]
#[error("{}", translate!("cat-error-too-many-symbolic-links"))]
TooManySymlinks,
}
@@ -302,14 +302,14 @@ pub fn uu_app() -> Command {
Arg::new(options::SHOW_ALL)
.short('A')
.long(options::SHOW_ALL)
.help("equivalent to -vET")
.help(translate!("cat-help-show-all"))
.action(ArgAction::SetTrue),
)
.arg(
Arg::new(options::NUMBER_NONBLANK)
.short('b')
.long(options::NUMBER_NONBLANK)
.help("number nonempty output lines, overrides -n")
.help(translate!("cat-help-number-nonblank"))
// Note: This MUST NOT .overrides_with(options::NUMBER)!
// In clap, overriding is symmetric, so "-b -n" counts as "-n", which is not what we want.
.action(ArgAction::SetTrue),
@@ -317,54 +317,54 @@ pub fn uu_app() -> Command {
.arg(
Arg::new(options::SHOW_NONPRINTING_ENDS)
.short('e')
.help("equivalent to -vE")
.help(translate!("cat-help-show-nonprinting-ends"))
.action(ArgAction::SetTrue),
)
.arg(
Arg::new(options::SHOW_ENDS)
.short('E')
.long(options::SHOW_ENDS)
.help("display $ at end of each line")
.help(translate!("cat-help-show-ends"))
.action(ArgAction::SetTrue),
)
.arg(
Arg::new(options::NUMBER)
.short('n')
.long(options::NUMBER)
.help("number all output lines")
.help(translate!("cat-help-number"))
.action(ArgAction::SetTrue),
)
.arg(
Arg::new(options::SQUEEZE_BLANK)
.short('s')
.long(options::SQUEEZE_BLANK)
.help("suppress repeated empty output lines")
.help(translate!("cat-help-squeeze-blank"))
.action(ArgAction::SetTrue),
)
.arg(
Arg::new(options::SHOW_NONPRINTING_TABS)
.short('t')
.help("equivalent to -vT")
.help(translate!("cat-help-show-nonprinting-tabs"))
.action(ArgAction::SetTrue),
)
.arg(
Arg::new(options::SHOW_TABS)
.short('T')
.long(options::SHOW_TABS)
.help("display TAB characters at ^I")
.help(translate!("cat-help-show-tabs"))
.action(ArgAction::SetTrue),
)
.arg(
Arg::new(options::SHOW_NONPRINTING)
.short('v')
.long(options::SHOW_NONPRINTING)
.help("use ^ and M- notation, except for LF (\\n) and TAB (\\t)")
.help(translate!("cat-help-show-nonprinting"))
.action(ArgAction::SetTrue),
)
.arg(
Arg::new(options::IGNORED_U)
.short('u')
.help("(ignored)")
.help(translate!("cat-help-ignored-u"))
.action(ArgAction::SetTrue),
)
}