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

l10n: port whoami to translation + add french

This commit is contained in:
Sylvestre Ledru 2025-06-04 23:26:23 +02:00
parent 1d11f85dd2
commit 980c81a6ce
3 changed files with 12 additions and 5 deletions

View file

@ -1 +1,5 @@
whoami-about = Print the current username.
# Error messages
whoami-error-failed-to-print = failed to print username
whoami-error-failed-to-get = failed to get username

View file

@ -0,0 +1,5 @@
whoami-about = Affiche le nom d'utilisateur actuel.
# Messages d'erreur
whoami-error-failed-to-print = échec de l'affichage du nom d'utilisateur
whoami-error-failed-to-get = échec de l'obtention du nom d'utilisateur

View file

@ -3,10 +3,8 @@
// For the full copyright and license information, please view the LICENSE
// file that was distributed with this source code.
use std::ffi::OsString;
use clap::Command;
use std::ffi::OsString;
use uucore::display::println_verbatim;
use uucore::error::{FromIo, UResult};
use uucore::locale::get_message;
@ -17,13 +15,13 @@ mod platform;
pub fn uumain(args: impl uucore::Args) -> UResult<()> {
uu_app().try_get_matches_from(args)?;
let username = whoami()?;
println_verbatim(username).map_err_context(|| "failed to print username".into())?;
println_verbatim(username).map_err_context(|| get_message("whoami-error-failed-to-print"))?;
Ok(())
}
/// Get the current username
pub fn whoami() -> UResult<OsString> {
platform::get_username().map_err_context(|| "failed to get username".into())
platform::get_username().map_err_context(|| get_message("whoami-error-failed-to-get"))
}
pub fn uu_app() -> Command {