mirror of
https://github.com/uutils/coreutils.git
synced 2026-06-10 15:48:22 -07:00
Merge pull request #8081 from sylvestre/l10n-whoami
l10n: port whoami to translation + add french
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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
|
||||
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user