1
Fork 0
mirror of https://github.com/RGBCube/uutils-coreutils synced 2025-07-27 19:17:43 +00:00

arch: support translations

This commit is contained in:
Sylvestre Ledru 2025-05-24 20:54:17 +02:00
parent 075cdcf21f
commit 7847894acf
4 changed files with 16 additions and 18 deletions

View file

@ -1,11 +0,0 @@
# arch
```
arch
```
Display machine architecture
## After Help
Determine architecture name for current machine.

View file

@ -0,0 +1,5 @@
# Error message when system architecture information cannot be retrieved
cannot-get-system = cannot get system name
arch-about = Display machine architecture
arch-after-help = Determine architecture name for current machine.

View file

@ -0,0 +1,5 @@
# Error message when system architecture information cannot be retrieved
cannot-get-system = impossible d'obtenir le nom du système
arch-about = Afficher l'architecture de la machine
arch-after-help = Déterminer le nom de l'architecture pour la machine actuelle.

View file

@ -7,16 +7,15 @@ use platform_info::*;
use clap::Command;
use uucore::error::{UResult, USimpleError};
use uucore::{help_about, help_section};
static ABOUT: &str = help_about!("arch.md");
static SUMMARY: &str = help_section!("after help", "arch.md");
use uucore::locale::{self, get_message};
#[uucore::main]
pub fn uumain(args: impl uucore::Args) -> UResult<()> {
locale::setup_localization(uucore::util_name())?;
uu_app().try_get_matches_from(args)?;
let uts = PlatformInfo::new().map_err(|_e| USimpleError::new(1, "cannot get system name"))?;
let uts =
PlatformInfo::new().map_err(|_e| USimpleError::new(1, get_message("cannot-get-system")))?;
println!("{}", uts.machine().to_string_lossy().trim());
Ok(())
@ -25,7 +24,7 @@ pub fn uumain(args: impl uucore::Args) -> UResult<()> {
pub fn uu_app() -> Command {
Command::new(uucore::util_name())
.version(uucore::crate_version!())
.about(ABOUT)
.after_help(SUMMARY)
.about(get_message("arch-about"))
.after_help(get_message("arch-after-help"))
.infer_long_args(true)
}