Skip to content

Commit 5d7183a

Browse files
committed
arch: support translations
1 parent 24f939c commit 5d7183a

File tree

4 files changed

+18
-18
lines changed

4 files changed

+18
-18
lines changed

src/uu/arch/arch.md

Lines changed: 0 additions & 11 deletions
This file was deleted.

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

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
# Error message when system architecture information cannot be retrieved
2+
cannot-get-system = cannot get system name
3+
4+
arch-usage = arch
5+
arch-about = Display machine architecture
6+
arch-after-help = Determine architecture name for current machine.

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

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
# Error message when system architecture information cannot be retrieved
2+
cannot-get-system = impossible d'obtenir le nom du système
3+
4+
arch-usage = arch
5+
arch-about = Afficher l'architecture de la machine
6+
arch-after-help = Déterminer le nom de l'architecture pour la machine actuelle.

src/uu/arch/src/arch.rs

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,16 +7,15 @@ use platform_info::*;
77

88
use clap::Command;
99
use uucore::error::{UResult, USimpleError};
10-
use uucore::{help_about, help_section};
11-
12-
static ABOUT: &str = help_about!("arch.md");
13-
static SUMMARY: &str = help_section!("after help", "arch.md");
10+
use uucore::locale::{self, get_message};
1411

1512
#[uucore::main]
1613
pub fn uumain(args: impl uucore::Args) -> UResult<()> {
14+
locale::setup_localization("src/uu/arch/locales/")?;
1715
uu_app().try_get_matches_from(args)?;
1816

19-
let uts = PlatformInfo::new().map_err(|_e| USimpleError::new(1, "cannot get system name"))?;
17+
let uts =
18+
PlatformInfo::new().map_err(|_e| USimpleError::new(1, get_message("cannot-get-system")))?;
2019

2120
println!("{}", uts.machine().to_string_lossy().trim());
2221
Ok(())
@@ -25,7 +24,7 @@ pub fn uumain(args: impl uucore::Args) -> UResult<()> {
2524
pub fn uu_app() -> Command {
2625
Command::new(uucore::util_name())
2726
.version(uucore::crate_version!())
28-
.about(ABOUT)
29-
.after_help(SUMMARY)
27+
.about(get_message("arch-about"))
28+
.after_help(get_message("arch-after-help"))
3029
.infer_long_args(true)
3130
}

0 commit comments

Comments
 (0)