1
Fork 0
mirror of https://github.com/RGBCube/uutils-coreutils synced 2025-07-28 03:27:44 +00:00

Merge pull request #8145 from sylvestre/l10n-readlink

l10n: port readlink for translation + add french
This commit is contained in:
Daniel Hofstetter 2025-06-11 10:40:32 +02:00 committed by GitHub
commit 38fd13f908
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 47 additions and 20 deletions

View file

@ -1,2 +1,16 @@
readlink-about = Print value of a symbolic link or canonical file name. readlink-about = Print value of a symbolic link or canonical file name.
readlink-usage = readlink [OPTION]... [FILE]... readlink-usage = readlink [OPTION]... [FILE]...
# Help messages
readlink-help-canonicalize = canonicalize by following every symlink in every component of the given name recursively; all but the last component must exist
readlink-help-canonicalize-existing = canonicalize by following every symlink in every component of the given name recursively, all components must exist
readlink-help-canonicalize-missing = canonicalize by following every symlink in every component of the given name recursively, without requirements on components existence
readlink-help-no-newline = do not output the trailing delimiter
readlink-help-quiet = suppress most error messages
readlink-help-silent = suppress most error messages
readlink-help-verbose = report error message
readlink-help-zero = separate output with NUL rather than newline
# Error messages
readlink-error-missing-operand = missing operand
readlink-error-ignoring-no-newline = ignoring --no-newline with multiple arguments

View file

@ -0,0 +1,16 @@
readlink-about = Afficher la valeur d'un lien symbolique ou le nom de fichier canonique.
readlink-usage = readlink [OPTION]... [FICHIER]...
# Messages d'aide
readlink-help-canonicalize = canonicaliser en suivant chaque lien symbolique dans chaque composant du nom donné de manière récursive ; tous les composants sauf le dernier doivent exister
readlink-help-canonicalize-existing = canonicaliser en suivant chaque lien symbolique dans chaque composant du nom donné de manière récursive, tous les composants doivent exister
readlink-help-canonicalize-missing = canonicaliser en suivant chaque lien symbolique dans chaque composant du nom donné de manière récursive, sans exigences sur l'existence des composants
readlink-help-no-newline = ne pas afficher le délimiteur final
readlink-help-quiet = supprimer la plupart des messages d'erreur
readlink-help-silent = supprimer la plupart des messages d'erreur
readlink-help-verbose = signaler les messages d'erreur
readlink-help-zero = séparer la sortie avec NUL plutôt qu'une nouvelle ligne
# Messages d'erreur
readlink-error-missing-operand = opérande manquant
readlink-error-ignoring-no-newline = ignorer --no-newline avec plusieurs arguments

View file

@ -13,9 +13,9 @@ use uucore::display::Quotable;
use uucore::error::{FromIo, UResult, USimpleError, UUsageError}; use uucore::error::{FromIo, UResult, USimpleError, UUsageError};
use uucore::fs::{MissingHandling, ResolveMode, canonicalize}; use uucore::fs::{MissingHandling, ResolveMode, canonicalize};
use uucore::line_ending::LineEnding; use uucore::line_ending::LineEnding;
use uucore::locale::get_message;
use uucore::{format_usage, show_error}; use uucore::{format_usage, show_error};
use uucore::locale::get_message;
const OPT_CANONICALIZE: &str = "canonicalize"; const OPT_CANONICALIZE: &str = "canonicalize";
const OPT_CANONICALIZE_MISSING: &str = "canonicalize-missing"; const OPT_CANONICALIZE_MISSING: &str = "canonicalize-missing";
const OPT_CANONICALIZE_EXISTING: &str = "canonicalize-existing"; const OPT_CANONICALIZE_EXISTING: &str = "canonicalize-existing";
@ -57,14 +57,19 @@ pub fn uumain(args: impl uucore::Args) -> UResult<()> {
.get_many::<String>(ARG_FILES) .get_many::<String>(ARG_FILES)
.map(|v| v.map(ToString::to_string).collect()) .map(|v| v.map(ToString::to_string).collect())
.unwrap_or_default(); .unwrap_or_default();
if files.is_empty() { if files.is_empty() {
return Err(UUsageError::new(1, "missing operand")); return Err(UUsageError::new(
1,
get_message("readlink-error-missing-operand"),
));
} }
if no_trailing_delimiter && files.len() > 1 && !silent { if no_trailing_delimiter && files.len() > 1 && !silent {
show_error!("ignoring --no-newline with multiple arguments"); show_error!("{}", get_message("readlink-error-ignoring-no-newline"));
no_trailing_delimiter = false; no_trailing_delimiter = false;
} }
let line_ending = if no_trailing_delimiter { let line_ending = if no_trailing_delimiter {
None None
} else { } else {
@ -78,6 +83,7 @@ pub fn uumain(args: impl uucore::Args) -> UResult<()> {
} else { } else {
canonicalize(&p, can_mode, res_mode) canonicalize(&p, can_mode, res_mode)
}; };
match path_result { match path_result {
Ok(path) => { Ok(path) => {
show(&path, line_ending).map_err_context(String::new)?; show(&path, line_ending).map_err_context(String::new)?;
@ -108,65 +114,56 @@ pub fn uu_app() -> Command {
Arg::new(OPT_CANONICALIZE) Arg::new(OPT_CANONICALIZE)
.short('f') .short('f')
.long(OPT_CANONICALIZE) .long(OPT_CANONICALIZE)
.help( .help(get_message("readlink-help-canonicalize"))
"canonicalize by following every symlink in every component of the \
given name recursively; all but the last component must exist",
)
.action(ArgAction::SetTrue), .action(ArgAction::SetTrue),
) )
.arg( .arg(
Arg::new(OPT_CANONICALIZE_EXISTING) Arg::new(OPT_CANONICALIZE_EXISTING)
.short('e') .short('e')
.long("canonicalize-existing") .long("canonicalize-existing")
.help( .help(get_message("readlink-help-canonicalize-existing"))
"canonicalize by following every symlink in every component of the \
given name recursively, all components must exist",
)
.action(ArgAction::SetTrue), .action(ArgAction::SetTrue),
) )
.arg( .arg(
Arg::new(OPT_CANONICALIZE_MISSING) Arg::new(OPT_CANONICALIZE_MISSING)
.short('m') .short('m')
.long(OPT_CANONICALIZE_MISSING) .long(OPT_CANONICALIZE_MISSING)
.help( .help(get_message("readlink-help-canonicalize-missing"))
"canonicalize by following every symlink in every component of the \
given name recursively, without requirements on components existence",
)
.action(ArgAction::SetTrue), .action(ArgAction::SetTrue),
) )
.arg( .arg(
Arg::new(OPT_NO_NEWLINE) Arg::new(OPT_NO_NEWLINE)
.short('n') .short('n')
.long(OPT_NO_NEWLINE) .long(OPT_NO_NEWLINE)
.help("do not output the trailing delimiter") .help(get_message("readlink-help-no-newline"))
.action(ArgAction::SetTrue), .action(ArgAction::SetTrue),
) )
.arg( .arg(
Arg::new(OPT_QUIET) Arg::new(OPT_QUIET)
.short('q') .short('q')
.long(OPT_QUIET) .long(OPT_QUIET)
.help("suppress most error messages") .help(get_message("readlink-help-quiet"))
.action(ArgAction::SetTrue), .action(ArgAction::SetTrue),
) )
.arg( .arg(
Arg::new(OPT_SILENT) Arg::new(OPT_SILENT)
.short('s') .short('s')
.long(OPT_SILENT) .long(OPT_SILENT)
.help("suppress most error messages") .help(get_message("readlink-help-silent"))
.action(ArgAction::SetTrue), .action(ArgAction::SetTrue),
) )
.arg( .arg(
Arg::new(OPT_VERBOSE) Arg::new(OPT_VERBOSE)
.short('v') .short('v')
.long(OPT_VERBOSE) .long(OPT_VERBOSE)
.help("report error message") .help(get_message("readlink-help-verbose"))
.action(ArgAction::SetTrue), .action(ArgAction::SetTrue),
) )
.arg( .arg(
Arg::new(OPT_ZERO) Arg::new(OPT_ZERO)
.short('z') .short('z')
.long(OPT_ZERO) .long(OPT_ZERO)
.help("separate output with NUL rather than newline") .help(get_message("readlink-help-zero"))
.action(ArgAction::SetTrue), .action(ArgAction::SetTrue),
) )
.arg( .arg(