mirror of
https://github.com/RGBCube/uutils-coreutils
synced 2025-07-27 19:17:43 +00:00
l10n: port dircolors for translation + add french
This commit is contained in:
parent
7e4877fb30
commit
ff184c8973
3 changed files with 71 additions and 20 deletions
|
@ -3,3 +3,21 @@ dircolors-usage = dircolors [OPTION]... [FILE]
|
|||
dircolors-after-help = If FILE is specified, read it to determine which colors to use for which
|
||||
file types and extensions. Otherwise, a precompiled database is used.
|
||||
For details on the format of these files, run 'dircolors --print-database'
|
||||
|
||||
# Help messages
|
||||
dircolors-help-bourne-shell = output Bourne shell code to set LS_COLORS
|
||||
dircolors-help-c-shell = output C shell code to set LS_COLORS
|
||||
dircolors-help-print-database = print the byte counts
|
||||
dircolors-help-print-ls-colors = output fully escaped colors for display
|
||||
|
||||
# Error messages
|
||||
dircolors-error-shell-and-output-exclusive = the options to output non shell syntax,
|
||||
and to select a shell syntax are mutually exclusive
|
||||
dircolors-error-print-database-and-ls-colors-exclusive = options --print-database and --print-ls-colors are mutually exclusive
|
||||
dircolors-error-extra-operand-print-database = extra operand { $operand }
|
||||
file operands cannot be combined with --print-database (-p)
|
||||
dircolors-error-no-shell-environment = no SHELL environment variable, and no shell type option given
|
||||
dircolors-error-extra-operand = extra operand { $operand }
|
||||
dircolors-error-expected-file-got-directory = expected file, got directory { $path }
|
||||
dircolors-error-invalid-line-missing-token = { $file }:{ $line }: invalid line; missing second token
|
||||
dircolors-error-unrecognized-keyword = unrecognized keyword { $keyword }
|
||||
|
|
23
src/uu/dircolors/locales/fr-FR.ftl
Normal file
23
src/uu/dircolors/locales/fr-FR.ftl
Normal file
|
@ -0,0 +1,23 @@
|
|||
dircolors-about = Afficher les commandes pour définir la variable d'environnement LS_COLORS.
|
||||
dircolors-usage = dircolors [OPTION]... [FICHIER]
|
||||
dircolors-after-help = Si FICHIER est spécifié, le lire pour déterminer quelles couleurs utiliser pour quels
|
||||
types de fichiers et extensions. Sinon, une base de données précompilée est utilisée.
|
||||
Pour les détails sur le format de ces fichiers, exécutez 'dircolors --print-database'
|
||||
|
||||
# Messages d'aide
|
||||
dircolors-help-bourne-shell = afficher le code Bourne shell pour définir LS_COLORS
|
||||
dircolors-help-c-shell = afficher le code C shell pour définir LS_COLORS
|
||||
dircolors-help-print-database = afficher la base de données de configuration
|
||||
dircolors-help-print-ls-colors = afficher les couleurs entièrement échappées pour l'affichage
|
||||
|
||||
# Messages d'erreur
|
||||
dircolors-error-shell-and-output-exclusive = les options pour afficher une syntaxe non-shell
|
||||
et pour sélectionner une syntaxe shell sont mutuellement exclusives
|
||||
dircolors-error-print-database-and-ls-colors-exclusive = les options --print-database et --print-ls-colors sont mutuellement exclusives
|
||||
dircolors-error-extra-operand-print-database = opérande supplémentaire { $operand }
|
||||
les opérandes de fichier ne peuvent pas être combinées avec --print-database (-p)
|
||||
dircolors-error-no-shell-environment = aucune variable d'environnement SHELL, et aucune option de type de shell donnée
|
||||
dircolors-error-extra-operand = opérande supplémentaire { $operand }
|
||||
dircolors-error-expected-file-got-directory = fichier attendu, répertoire obtenu { $path }
|
||||
dircolors-error-invalid-line-missing-token = { $file }:{ $line } : ligne invalide ; jeton manquant
|
||||
dircolors-error-unrecognized-keyword = mot-clé non reconnu { $keyword }
|
|
@ -6,6 +6,7 @@
|
|||
// spell-checker:ignore (ToDO) clrtoeol dircolors eightbit endcode fnmatch leftcode multihardlink rightcode setenv sgid suid colorterm disp
|
||||
|
||||
use std::borrow::Borrow;
|
||||
use std::collections::HashMap;
|
||||
use std::env;
|
||||
use std::fmt::Write as _;
|
||||
use std::fs::File;
|
||||
|
@ -16,7 +17,7 @@ use clap::{Arg, ArgAction, Command};
|
|||
use uucore::colors::{FILE_ATTRIBUTE_CODES, FILE_COLORS, FILE_TYPES, TERMS};
|
||||
use uucore::display::Quotable;
|
||||
use uucore::error::{UResult, USimpleError, UUsageError};
|
||||
use uucore::locale::get_message;
|
||||
use uucore::locale::{get_message, get_message_with_args};
|
||||
use uucore::{format_usage, parser::parse_glob};
|
||||
|
||||
mod options {
|
||||
|
@ -132,15 +133,14 @@ pub fn uumain(args: impl uucore::Args) -> UResult<()> {
|
|||
{
|
||||
return Err(UUsageError::new(
|
||||
1,
|
||||
"the options to output non shell syntax,\n\
|
||||
and to select a shell syntax are mutually exclusive",
|
||||
get_message("dircolors-error-shell-and-output-exclusive"),
|
||||
));
|
||||
}
|
||||
|
||||
if matches.get_flag(options::PRINT_DATABASE) && matches.get_flag(options::PRINT_LS_COLORS) {
|
||||
return Err(UUsageError::new(
|
||||
1,
|
||||
"options --print-database and --print-ls-colors are mutually exclusive",
|
||||
get_message("dircolors-error-print-database-and-ls-colors-exclusive"),
|
||||
));
|
||||
}
|
||||
|
||||
|
@ -148,10 +148,9 @@ pub fn uumain(args: impl uucore::Args) -> UResult<()> {
|
|||
if !files.is_empty() {
|
||||
return Err(UUsageError::new(
|
||||
1,
|
||||
format!(
|
||||
"extra operand {}\nfile operands cannot be combined with \
|
||||
--print-database (-p)",
|
||||
files[0].quote()
|
||||
get_message_with_args(
|
||||
"dircolors-error-extra-operand-print-database",
|
||||
HashMap::from([("operand".to_string(), files[0].quote().to_string())]),
|
||||
),
|
||||
));
|
||||
}
|
||||
|
@ -175,7 +174,7 @@ pub fn uumain(args: impl uucore::Args) -> UResult<()> {
|
|||
OutputFmt::Unknown => {
|
||||
return Err(USimpleError::new(
|
||||
1,
|
||||
"no SHELL environment variable, and no shell type option given",
|
||||
get_message("dircolors-error-no-shell-environment"),
|
||||
));
|
||||
}
|
||||
fmt => out_format = fmt,
|
||||
|
@ -201,7 +200,10 @@ pub fn uumain(args: impl uucore::Args) -> UResult<()> {
|
|||
} else if files.len() > 1 {
|
||||
return Err(UUsageError::new(
|
||||
1,
|
||||
format!("extra operand {}", files[1].quote()),
|
||||
get_message_with_args(
|
||||
"dircolors-error-extra-operand",
|
||||
HashMap::from([("operand".to_string(), files[1].quote().to_string())]),
|
||||
),
|
||||
));
|
||||
} else if files[0].eq("-") {
|
||||
let fin = BufReader::new(std::io::stdin());
|
||||
|
@ -212,7 +214,10 @@ pub fn uumain(args: impl uucore::Args) -> UResult<()> {
|
|||
if path.is_dir() {
|
||||
return Err(USimpleError::new(
|
||||
2,
|
||||
format!("expected file, got directory {}", path.quote()),
|
||||
get_message_with_args(
|
||||
"dircolors-error-expected-file-got-directory",
|
||||
HashMap::from([("path".to_string(), path.quote().to_string())]),
|
||||
),
|
||||
));
|
||||
}
|
||||
match File::open(path) {
|
||||
|
@ -253,7 +258,7 @@ pub fn uu_app() -> Command {
|
|||
.short('b')
|
||||
.visible_alias("bourne-shell")
|
||||
.overrides_with(options::C_SHELL)
|
||||
.help("output Bourne shell code to set LS_COLORS")
|
||||
.help(get_message("dircolors-help-bourne-shell"))
|
||||
.action(ArgAction::SetTrue),
|
||||
)
|
||||
.arg(
|
||||
|
@ -262,20 +267,20 @@ pub fn uu_app() -> Command {
|
|||
.short('c')
|
||||
.visible_alias("c-shell")
|
||||
.overrides_with(options::BOURNE_SHELL)
|
||||
.help("output C shell code to set LS_COLORS")
|
||||
.help(get_message("dircolors-help-c-shell"))
|
||||
.action(ArgAction::SetTrue),
|
||||
)
|
||||
.arg(
|
||||
Arg::new(options::PRINT_DATABASE)
|
||||
.long("print-database")
|
||||
.short('p')
|
||||
.help("print the byte counts")
|
||||
.help(get_message("dircolors-help-print-database"))
|
||||
.action(ArgAction::SetTrue),
|
||||
)
|
||||
.arg(
|
||||
Arg::new(options::PRINT_LS_COLORS)
|
||||
.long("print-ls-colors")
|
||||
.help("output fully escaped colors for display")
|
||||
.help(get_message("dircolors-help-print-ls-colors"))
|
||||
.action(ArgAction::SetTrue),
|
||||
)
|
||||
.arg(
|
||||
|
@ -375,10 +380,12 @@ where
|
|||
|
||||
let (key, val) = line.split_two();
|
||||
if val.is_empty() {
|
||||
return Err(format!(
|
||||
// The double space is what GNU is doing
|
||||
"{}:{num}: invalid line; missing second token",
|
||||
fp.maybe_quote(),
|
||||
return Err(get_message_with_args(
|
||||
"dircolors-error-invalid-line-missing-token",
|
||||
HashMap::from([
|
||||
("file".to_string(), fp.maybe_quote().to_string()),
|
||||
("line".to_string(), num.to_string()),
|
||||
]),
|
||||
));
|
||||
}
|
||||
|
||||
|
@ -461,7 +468,10 @@ fn append_entry(
|
|||
result.push_str(&disp);
|
||||
Ok(())
|
||||
} else {
|
||||
Err(format!("unrecognized keyword {key}"))
|
||||
Err(get_message_with_args(
|
||||
"dircolors-error-unrecognized-keyword",
|
||||
HashMap::from([("keyword".to_string(), key.to_string())]),
|
||||
))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue