From 941ac4c024b3d8e474da3df7a8455753a28e1901 Mon Sep 17 00:00:00 2001 From: Sylvestre Ledru Date: Tue, 10 Jun 2025 22:50:33 +0200 Subject: [PATCH] l10n: port pinky for translation + add french --- src/uu/pinky/locales/en-US.ftl | 35 ++++++++++++++++++++++++ src/uu/pinky/locales/fr-FR.ftl | 41 ++++++++++++++++++++++++++++ src/uu/pinky/src/pinky.rs | 20 +++++++------- src/uu/pinky/src/platform/openbsd.rs | 6 ++-- src/uu/pinky/src/platform/unix.rs | 31 ++++++++++++--------- 5 files changed, 106 insertions(+), 27 deletions(-) create mode 100644 src/uu/pinky/locales/fr-FR.ftl diff --git a/src/uu/pinky/locales/en-US.ftl b/src/uu/pinky/locales/en-US.ftl index d3b62d123..65b12d0ca 100644 --- a/src/uu/pinky/locales/en-US.ftl +++ b/src/uu/pinky/locales/en-US.ftl @@ -4,3 +4,38 @@ pinky-about-musl-warning = Warning: When built with musl libc, the `pinky` utili or missing user information due to musl's stub implementation of `utmpx` functions. This limitation affects the ability to retrieve accurate details about logged-in users. + +# Long usage description +pinky-long-usage-description = A lightweight 'finger' program; print user information. + The utmp file will be + +# Help messages +pinky-help-long-format = produce long format output for the specified USERs +pinky-help-omit-home-dir = omit the user's home directory and shell in long format +pinky-help-omit-project-file = omit the user's project file in long format +pinky-help-omit-plan-file = omit the user's plan file in long format +pinky-help-short-format = do short format output, this is the default +pinky-help-omit-headings = omit the line of column headings in short format +pinky-help-omit-name = omit the user's full name in short format +pinky-help-omit-name-host = omit the user's full name and remote host in short format +pinky-help-omit-name-host-time = omit the user's full name, remote host and idle time in short format +pinky-help-help = Print help information + +# Column headers for short format +pinky-column-login = Login +pinky-column-name = Name +pinky-column-tty = TTY +pinky-column-idle = Idle +pinky-column-when = When +pinky-column-where = Where + +# Labels for long format +pinky-login-name-label = Login name: +pinky-real-life-label = In real life: +pinky-directory-label = Directory: +pinky-shell-label = Shell: +pinky-project-label = Project: +pinky-plan-label = Plan + +# Status messages +pinky-unsupported-openbsd = unsupported command on OpenBSD diff --git a/src/uu/pinky/locales/fr-FR.ftl b/src/uu/pinky/locales/fr-FR.ftl new file mode 100644 index 000000000..3be28ec7a --- /dev/null +++ b/src/uu/pinky/locales/fr-FR.ftl @@ -0,0 +1,41 @@ +pinky-about = Affiche des informations brèves sur les utilisateurs des systèmes Unix +pinky-usage = pinky [OPTION]... [UTILISATEUR]... +pinky-about-musl-warning = Avertissement : Lorsque compilé avec musl libc, l'utilitaire `pinky` peut afficher des + informations utilisateur incomplètes ou manquantes en raison de l'implémentation + factice des fonctions `utmpx` de musl. Cette limitation affecte la capacité + à récupérer des détails précis sur les utilisateurs connectés. + +# Description d'utilisation longue +pinky-long-usage-description = Un programme 'finger' léger ; affiche les informations utilisateur. + Le fichier utmp sera + +# Messages d'aide +pinky-help-long-format = produire une sortie au format long pour les UTILISATEURS spécifiés +pinky-help-omit-home-dir = omettre le répertoire personnel et le shell de l'utilisateur en format long +pinky-help-omit-project-file = omettre le fichier projet de l'utilisateur en format long +pinky-help-omit-plan-file = omettre le fichier plan de l'utilisateur en format long +pinky-help-short-format = faire une sortie au format court, c'est le défaut +pinky-help-omit-headings = omettre la ligne des en-têtes de colonnes en format court +pinky-help-omit-name = omettre le nom complet de l'utilisateur en format court +pinky-help-omit-name-host = omettre le nom complet et l'hôte distant de l'utilisateur en format court +pinky-help-omit-name-host-time = omettre le nom complet, l'hôte distant et le temps d'inactivité de l'utilisateur en format court +pinky-help-help = Afficher les informations d'aide + +# En-têtes de colonnes pour le format court +pinky-column-login = Connexion +pinky-column-name = Nom +pinky-column-tty = TTY +pinky-column-idle = Inactif +pinky-column-when = Quand +pinky-column-where = Où + +# Étiquettes pour le format long +pinky-login-name-label = Nom de connexion : +pinky-real-life-label = Dans la vraie vie : +pinky-directory-label = Répertoire : +pinky-shell-label = Shell : +pinky-project-label = Projet : +pinky-plan-label = Plan + +# Messages de statut +pinky-unsupported-openbsd = commande non supportée sur OpenBSD diff --git a/src/uu/pinky/src/pinky.rs b/src/uu/pinky/src/pinky.rs index 3f0f13d97..165bd8233 100644 --- a/src/uu/pinky/src/pinky.rs +++ b/src/uu/pinky/src/pinky.rs @@ -44,55 +44,55 @@ pub fn uu_app() -> Command { Arg::new(options::LONG_FORMAT) .short('l') .requires(options::USER) - .help("produce long format output for the specified USERs") + .help(get_message("pinky-help-long-format")) .action(ArgAction::SetTrue), ) .arg( Arg::new(options::OMIT_HOME_DIR) .short('b') - .help("omit the user's home directory and shell in long format") + .help(get_message("pinky-help-omit-home-dir")) .action(ArgAction::SetTrue), ) .arg( Arg::new(options::OMIT_PROJECT_FILE) .short('h') - .help("omit the user's project file in long format") + .help(get_message("pinky-help-omit-project-file")) .action(ArgAction::SetTrue), ) .arg( Arg::new(options::OMIT_PLAN_FILE) .short('p') - .help("omit the user's plan file in long format") + .help(get_message("pinky-help-omit-plan-file")) .action(ArgAction::SetTrue), ) .arg( Arg::new(options::SHORT_FORMAT) .short('s') - .help("do short format output, this is the default") + .help(get_message("pinky-help-short-format")) .action(ArgAction::SetTrue), ) .arg( Arg::new(options::OMIT_HEADINGS) .short('f') - .help("omit the line of column headings in short format") + .help(get_message("pinky-help-omit-headings")) .action(ArgAction::SetTrue), ) .arg( Arg::new(options::OMIT_NAME) .short('w') - .help("omit the user's full name in short format") + .help(get_message("pinky-help-omit-name")) .action(ArgAction::SetTrue), ) .arg( Arg::new(options::OMIT_NAME_HOST) .short('i') - .help("omit the user's full name and remote host in short format") + .help(get_message("pinky-help-omit-name-host")) .action(ArgAction::SetTrue), ) .arg( Arg::new(options::OMIT_NAME_HOST_TIME) .short('q') - .help("omit the user's full name, remote host and idle time in short format") + .help(get_message("pinky-help-omit-name-host-time")) .action(ArgAction::SetTrue), ) .arg( @@ -105,7 +105,7 @@ pub fn uu_app() -> Command { // since that conflicts with omit_project_file. Arg::new(options::HELP) .long(options::HELP) - .help("Print help information") + .help(get_message("pinky-help-help")) .action(ArgAction::Help), ) } diff --git a/src/uu/pinky/src/platform/openbsd.rs b/src/uu/pinky/src/platform/openbsd.rs index 7e6970c1f..568d36e55 100644 --- a/src/uu/pinky/src/platform/openbsd.rs +++ b/src/uu/pinky/src/platform/openbsd.rs @@ -2,16 +2,14 @@ // // For the full copyright and license information, please view the LICENSE // file that was distributed with this source code. - // Specific implementation for OpenBSD: tool unsupported (utmpx not supported) use crate::uu_app; - use uucore::error::UResult; +use uucore::locale::get_message; pub fn uumain(args: impl uucore::Args) -> UResult<()> { let _matches = uu_app().try_get_matches_from(args)?; - - println!("unsupported command on OpenBSD"); + println!("{}", get_message("pinky-unsupported-openbsd")); Ok(()) } diff --git a/src/uu/pinky/src/platform/unix.rs b/src/uu/pinky/src/platform/unix.rs index 5c74abc3d..36e10062c 100644 --- a/src/uu/pinky/src/platform/unix.rs +++ b/src/uu/pinky/src/platform/unix.rs @@ -12,6 +12,7 @@ use crate::uu_app; use uucore::entries::{Locate, Passwd}; use uucore::error::{FromIo, UResult}; use uucore::libc::S_IWGRP; +use uucore::locale::get_message; use uucore::utmpx::{self, Utmpx, time}; use std::io::BufReader; @@ -24,8 +25,8 @@ use std::path::PathBuf; fn get_long_usage() -> String { format!( - "A lightweight 'finger' program; print user information.\n\ - The utmp file will be {}.", + "{}{}", + get_message("pinky-long-usage-description"), utmpx::DEFAULT_FILE ) } @@ -217,17 +218,17 @@ impl Pinky { } fn print_heading(&self) { - print!("{:<8}", "Login"); + print!("{:<8}", get_message("pinky-column-login")); if self.include_fullname { - print!(" {:<19}", "Name"); + print!(" {:<19}", get_message("pinky-column-name")); } - print!(" {:<9}", " TTY"); + print!(" {:<9}", get_message("pinky-column-tty")); if self.include_idle { - print!(" {:<6}", "Idle"); + print!(" {:<6}", get_message("pinky-column-idle")); } - print!(" {:<16}", "When"); + print!(" {:<16}", get_message("pinky-column-when")); if self.include_where { - print!(" Where"); + print!(" {}", get_message("pinky-column-where")); } println!(); } @@ -248,21 +249,25 @@ impl Pinky { fn long_pinky(&self) { for u in &self.names { - print!("Login name: {u:<28}In real life: "); + print!( + "{} {u:<28}{} ", + get_message("pinky-login-name-label"), + get_message("pinky-real-life-label") + ); if let Ok(pw) = Passwd::locate(u.as_str()) { let fullname = gecos_to_fullname(&pw).unwrap_or_default(); let user_dir = pw.user_dir.unwrap_or_default(); let user_shell = pw.user_shell.unwrap_or_default(); println!(" {fullname}"); if self.include_home_and_shell { - print!("Directory: {user_dir:<29}"); - println!("Shell: {user_shell}"); + print!("{} {user_dir:<29}", get_message("pinky-directory-label")); + println!("{} {user_shell}", get_message("pinky-shell-label")); } if self.include_project { let mut p = PathBuf::from(&user_dir); p.push(".project"); if let Ok(f) = File::open(p) { - print!("Project: "); + print!("{} ", get_message("pinky-project-label")); read_to_console(f); } } @@ -270,7 +275,7 @@ impl Pinky { let mut p = PathBuf::from(&user_dir); p.push(".plan"); if let Ok(f) = File::open(p) { - println!("Plan:"); + println!("{}:", get_message("pinky-plan-label")); read_to_console(f); } }