Skip to content

Commit fc011c8

Browse files
authored
Merge pull request #8082 from sylvestre/l10n-hostname
l10n: port hostname to translation + add french
2 parents 8d626cf + 63ef7c9 commit fc011c8

3 files changed

Lines changed: 32 additions & 6 deletions

File tree

src/uu/hostname/locales/en-US.ftl

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,13 @@
11
hostname-about = Display or set the system's host name.
22
hostname-usage = hostname [OPTION]... [HOSTNAME]
3+
hostname-help-domain = Display the name of the DNS domain if possible
4+
hostname-help-ip-address = Display the network address(es) of the host
5+
hostname-help-fqdn = Display the FQDN (Fully Qualified Domain Name) (default)
6+
hostname-help-short = Display the short hostname (the portion before the first dot) if possible
7+
hostname-error-permission = hostname: you must be root to change the host name
8+
hostname-error-invalid-name = hostname: invalid hostname '{ $name }'
9+
hostname-error-resolve-failed = hostname: unable to resolve host name '{ $name }'
10+
hostname-error-winsock = failed to start Winsock
11+
hostname-error-set-hostname = failed to set hostname
12+
hostname-error-get-hostname = failed to get hostname
13+
hostname-error-resolve-socket = failed to resolve socket addresses

src/uu/hostname/locales/fr-FR.ftl

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

src/uu/hostname/src/hostname.rs

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -63,11 +63,13 @@ pub fn uumain(args: impl uucore::Args) -> UResult<()> {
6363
let matches = uu_app().try_get_matches_from(args)?;
6464

6565
#[cfg(windows)]
66-
let _handle = wsa::start().map_err_context(|| "failed to start Winsock".to_owned())?;
66+
let _handle = wsa::start().map_err_context(|| get_message("hostname-error-winsock"))?;
6767

6868
match matches.get_one::<OsString>(OPT_HOST) {
6969
None => display_hostname(&matches),
70-
Some(host) => hostname::set(host).map_err_context(|| "failed to set hostname".to_owned()),
70+
Some(host) => {
71+
hostname::set(host).map_err_context(|| get_message("hostname-error-set-hostname"))
72+
}
7173
}
7274
}
7375

@@ -82,31 +84,31 @@ pub fn uu_app() -> Command {
8284
.short('d')
8385
.long("domain")
8486
.overrides_with_all([OPT_DOMAIN, OPT_IP_ADDRESS, OPT_FQDN, OPT_SHORT])
85-
.help("Display the name of the DNS domain if possible")
87+
.help(get_message("hostname-help-domain"))
8688
.action(ArgAction::SetTrue),
8789
)
8890
.arg(
8991
Arg::new(OPT_IP_ADDRESS)
9092
.short('i')
9193
.long("ip-address")
9294
.overrides_with_all([OPT_DOMAIN, OPT_IP_ADDRESS, OPT_FQDN, OPT_SHORT])
93-
.help("Display the network address(es) of the host")
95+
.help(get_message("hostname-help-ip-address"))
9496
.action(ArgAction::SetTrue),
9597
)
9698
.arg(
9799
Arg::new(OPT_FQDN)
98100
.short('f')
99101
.long("fqdn")
100102
.overrides_with_all([OPT_DOMAIN, OPT_IP_ADDRESS, OPT_FQDN, OPT_SHORT])
101-
.help("Display the FQDN (Fully Qualified Domain Name) (default)")
103+
.help(get_message("hostname-help-fqdn"))
102104
.action(ArgAction::SetTrue),
103105
)
104106
.arg(
105107
Arg::new(OPT_SHORT)
106108
.short('s')
107109
.long("short")
108110
.overrides_with_all([OPT_DOMAIN, OPT_IP_ADDRESS, OPT_FQDN, OPT_SHORT])
109-
.help("Display the short hostname (the portion before the first dot) if possible")
111+
.help(get_message("hostname-help-short"))
110112
.action(ArgAction::SetTrue),
111113
)
112114
.arg(

0 commit comments

Comments
 (0)