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

Merge pull request #8081 from sylvestre/l10n-whoami

l10n: port whoami to translation + add french
This commit is contained in:
Daniel Hofstetter 2025-06-06 10:49:46 +02:00 committed by GitHub
commit 6619a93777
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
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 {