mirror of
https://github.com/RGBCube/uutils-coreutils
synced 2025-07-28 11:37:44 +00:00
Merge pull request #8141 from sylvestre/l10n-dircolors
l10n: port dircolors for translation + add french
This commit is contained in:
commit
143adfa010
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
|
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.
|
file types and extensions. Otherwise, a precompiled database is used.
|
||||||
For details on the format of these files, run 'dircolors --print-database'
|
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
|
// spell-checker:ignore (ToDO) clrtoeol dircolors eightbit endcode fnmatch leftcode multihardlink rightcode setenv sgid suid colorterm disp
|
||||||
|
|
||||||
use std::borrow::Borrow;
|
use std::borrow::Borrow;
|
||||||
|
use std::collections::HashMap;
|
||||||
use std::env;
|
use std::env;
|
||||||
use std::fmt::Write as _;
|
use std::fmt::Write as _;
|
||||||
use std::fs::File;
|
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::colors::{FILE_ATTRIBUTE_CODES, FILE_COLORS, FILE_TYPES, TERMS};
|
||||||
use uucore::display::Quotable;
|
use uucore::display::Quotable;
|
||||||
use uucore::error::{UResult, USimpleError, UUsageError};
|
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};
|
use uucore::{format_usage, parser::parse_glob};
|
||||||
|
|
||||||
mod options {
|
mod options {
|
||||||
|
@ -132,15 +133,14 @@ pub fn uumain(args: impl uucore::Args) -> UResult<()> {
|
||||||
{
|
{
|
||||||
return Err(UUsageError::new(
|
return Err(UUsageError::new(
|
||||||
1,
|
1,
|
||||||
"the options to output non shell syntax,\n\
|
get_message("dircolors-error-shell-and-output-exclusive"),
|
||||||
and to select a shell syntax are mutually exclusive",
|
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
if matches.get_flag(options::PRINT_DATABASE) && matches.get_flag(options::PRINT_LS_COLORS) {
|
if matches.get_flag(options::PRINT_DATABASE) && matches.get_flag(options::PRINT_LS_COLORS) {
|
||||||
return Err(UUsageError::new(
|
return Err(UUsageError::new(
|
||||||
1,
|
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() {
|
if !files.is_empty() {
|
||||||
return Err(UUsageError::new(
|
return Err(UUsageError::new(
|
||||||
1,
|
1,
|
||||||
format!(
|
get_message_with_args(
|
||||||
"extra operand {}\nfile operands cannot be combined with \
|
"dircolors-error-extra-operand-print-database",
|
||||||
--print-database (-p)",
|
HashMap::from([("operand".to_string(), files[0].quote().to_string())]),
|
||||||
files[0].quote()
|
|
||||||
),
|
),
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
@ -175,7 +174,7 @@ pub fn uumain(args: impl uucore::Args) -> UResult<()> {
|
||||||
OutputFmt::Unknown => {
|
OutputFmt::Unknown => {
|
||||||
return Err(USimpleError::new(
|
return Err(USimpleError::new(
|
||||||
1,
|
1,
|
||||||
"no SHELL environment variable, and no shell type option given",
|
get_message("dircolors-error-no-shell-environment"),
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
fmt => out_format = fmt,
|
fmt => out_format = fmt,
|
||||||
|
@ -201,7 +200,10 @@ pub fn uumain(args: impl uucore::Args) -> UResult<()> {
|
||||||
} else if files.len() > 1 {
|
} else if files.len() > 1 {
|
||||||
return Err(UUsageError::new(
|
return Err(UUsageError::new(
|
||||||
1,
|
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("-") {
|
} else if files[0].eq("-") {
|
||||||
let fin = BufReader::new(std::io::stdin());
|
let fin = BufReader::new(std::io::stdin());
|
||||||
|
@ -212,7 +214,10 @@ pub fn uumain(args: impl uucore::Args) -> UResult<()> {
|
||||||
if path.is_dir() {
|
if path.is_dir() {
|
||||||
return Err(USimpleError::new(
|
return Err(USimpleError::new(
|
||||||
2,
|
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) {
|
match File::open(path) {
|
||||||
|
@ -253,7 +258,7 @@ pub fn uu_app() -> Command {
|
||||||
.short('b')
|
.short('b')
|
||||||
.visible_alias("bourne-shell")
|
.visible_alias("bourne-shell")
|
||||||
.overrides_with(options::C_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),
|
.action(ArgAction::SetTrue),
|
||||||
)
|
)
|
||||||
.arg(
|
.arg(
|
||||||
|
@ -262,20 +267,20 @@ pub fn uu_app() -> Command {
|
||||||
.short('c')
|
.short('c')
|
||||||
.visible_alias("c-shell")
|
.visible_alias("c-shell")
|
||||||
.overrides_with(options::BOURNE_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),
|
.action(ArgAction::SetTrue),
|
||||||
)
|
)
|
||||||
.arg(
|
.arg(
|
||||||
Arg::new(options::PRINT_DATABASE)
|
Arg::new(options::PRINT_DATABASE)
|
||||||
.long("print-database")
|
.long("print-database")
|
||||||
.short('p')
|
.short('p')
|
||||||
.help("print the byte counts")
|
.help(get_message("dircolors-help-print-database"))
|
||||||
.action(ArgAction::SetTrue),
|
.action(ArgAction::SetTrue),
|
||||||
)
|
)
|
||||||
.arg(
|
.arg(
|
||||||
Arg::new(options::PRINT_LS_COLORS)
|
Arg::new(options::PRINT_LS_COLORS)
|
||||||
.long("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),
|
.action(ArgAction::SetTrue),
|
||||||
)
|
)
|
||||||
.arg(
|
.arg(
|
||||||
|
@ -375,10 +380,12 @@ where
|
||||||
|
|
||||||
let (key, val) = line.split_two();
|
let (key, val) = line.split_two();
|
||||||
if val.is_empty() {
|
if val.is_empty() {
|
||||||
return Err(format!(
|
return Err(get_message_with_args(
|
||||||
// The double space is what GNU is doing
|
"dircolors-error-invalid-line-missing-token",
|
||||||
"{}:{num}: invalid line; missing second token",
|
HashMap::from([
|
||||||
fp.maybe_quote(),
|
("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);
|
result.push_str(&disp);
|
||||||
Ok(())
|
Ok(())
|
||||||
} else {
|
} 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