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

l10n: port hostname to translation + add french

This commit is contained in:
Sylvestre Ledru 2025-06-05 00:02:05 +02:00
parent 1d11f85dd2
commit 63ef7c9a1d
3 changed files with 32 additions and 6 deletions

View file

@ -1,2 +1,13 @@
hostname-about = Display or set the system's host name.
hostname-usage = hostname [OPTION]... [HOSTNAME]
hostname-help-domain = Display the name of the DNS domain if possible
hostname-help-ip-address = Display the network address(es) of the host
hostname-help-fqdn = Display the FQDN (Fully Qualified Domain Name) (default)
hostname-help-short = Display the short hostname (the portion before the first dot) if possible
hostname-error-permission = hostname: you must be root to change the host name
hostname-error-invalid-name = hostname: invalid hostname '{ $name }'
hostname-error-resolve-failed = hostname: unable to resolve host name '{ $name }'
hostname-error-winsock = failed to start Winsock
hostname-error-set-hostname = failed to set hostname
hostname-error-get-hostname = failed to get hostname
hostname-error-resolve-socket = failed to resolve socket addresses

View file

@ -0,0 +1,13 @@
hostname-about = Afficher ou définir le nom d'hôte du système.
hostname-usage = hostname [OPTION]... [NOM_HÔTE]
hostname-help-domain = Afficher le nom du domaine DNS si possible
hostname-help-ip-address = Afficher la ou les adresses réseau de l'hôte
hostname-help-fqdn = Afficher le FQDN (nom de domaine pleinement qualifié) (par défaut)
hostname-help-short = Afficher le nom d'hôte court (la partie avant le premier point) si possible
hostname-error-permission = hostname : vous devez être root pour changer le nom d'hôte
hostname-error-invalid-name = hostname : nom d'hôte invalide '{ $name }'
hostname-error-resolve-failed = hostname : impossible de résoudre le nom d'hôte '{ $name }'
hostname-error-winsock = échec du démarrage de Winsock
hostname-error-set-hostname = échec de la définition du nom d'hôte
hostname-error-get-hostname = échec de l'obtention du nom d'hôte
hostname-error-resolve-socket = échec de la résolution des adresses de socket

View file

@ -63,11 +63,13 @@ pub fn uumain(args: impl uucore::Args) -> UResult<()> {
let matches = uu_app().try_get_matches_from(args)?;
#[cfg(windows)]
let _handle = wsa::start().map_err_context(|| "failed to start Winsock".to_owned())?;
let _handle = wsa::start().map_err_context(|| get_message("hostname-error-winsock"))?;
match matches.get_one::<OsString>(OPT_HOST) {
None => display_hostname(&matches),
Some(host) => hostname::set(host).map_err_context(|| "failed to set hostname".to_owned()),
Some(host) => {
hostname::set(host).map_err_context(|| get_message("hostname-error-set-hostname"))
}
}
}
@ -82,7 +84,7 @@ pub fn uu_app() -> Command {
.short('d')
.long("domain")
.overrides_with_all([OPT_DOMAIN, OPT_IP_ADDRESS, OPT_FQDN, OPT_SHORT])
.help("Display the name of the DNS domain if possible")
.help(get_message("hostname-help-domain"))
.action(ArgAction::SetTrue),
)
.arg(
@ -90,7 +92,7 @@ pub fn uu_app() -> Command {
.short('i')
.long("ip-address")
.overrides_with_all([OPT_DOMAIN, OPT_IP_ADDRESS, OPT_FQDN, OPT_SHORT])
.help("Display the network address(es) of the host")
.help(get_message("hostname-help-ip-address"))
.action(ArgAction::SetTrue),
)
.arg(
@ -98,7 +100,7 @@ pub fn uu_app() -> Command {
.short('f')
.long("fqdn")
.overrides_with_all([OPT_DOMAIN, OPT_IP_ADDRESS, OPT_FQDN, OPT_SHORT])
.help("Display the FQDN (Fully Qualified Domain Name) (default)")
.help(get_message("hostname-help-fqdn"))
.action(ArgAction::SetTrue),
)
.arg(
@ -106,7 +108,7 @@ pub fn uu_app() -> Command {
.short('s')
.long("short")
.overrides_with_all([OPT_DOMAIN, OPT_IP_ADDRESS, OPT_FQDN, OPT_SHORT])
.help("Display the short hostname (the portion before the first dot) if possible")
.help(get_message("hostname-help-short"))
.action(ArgAction::SetTrue),
)
.arg(