mirror of
https://github.com/RGBCube/uutils-coreutils
synced 2025-07-28 03:27:44 +00:00
arch: support translations
This commit is contained in:
parent
075cdcf21f
commit
7847894acf
4 changed files with 16 additions and 18 deletions
|
@ -1,11 +0,0 @@
|
||||||
# arch
|
|
||||||
|
|
||||||
```
|
|
||||||
arch
|
|
||||||
```
|
|
||||||
|
|
||||||
Display machine architecture
|
|
||||||
|
|
||||||
## After Help
|
|
||||||
|
|
||||||
Determine architecture name for current machine.
|
|
5
src/uu/arch/locales/en-US.ftl
Normal file
5
src/uu/arch/locales/en-US.ftl
Normal 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.
|
5
src/uu/arch/locales/fr-FR.ftl
Normal file
5
src/uu/arch/locales/fr-FR.ftl
Normal 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.
|
|
@ -7,16 +7,15 @@ use platform_info::*;
|
||||||
|
|
||||||
use clap::Command;
|
use clap::Command;
|
||||||
use uucore::error::{UResult, USimpleError};
|
use uucore::error::{UResult, USimpleError};
|
||||||
use uucore::{help_about, help_section};
|
use uucore::locale::{self, get_message};
|
||||||
|
|
||||||
static ABOUT: &str = help_about!("arch.md");
|
|
||||||
static SUMMARY: &str = help_section!("after help", "arch.md");
|
|
||||||
|
|
||||||
#[uucore::main]
|
#[uucore::main]
|
||||||
pub fn uumain(args: impl uucore::Args) -> UResult<()> {
|
pub fn uumain(args: impl uucore::Args) -> UResult<()> {
|
||||||
|
locale::setup_localization(uucore::util_name())?;
|
||||||
uu_app().try_get_matches_from(args)?;
|
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());
|
println!("{}", uts.machine().to_string_lossy().trim());
|
||||||
Ok(())
|
Ok(())
|
||||||
|
@ -25,7 +24,7 @@ pub fn uumain(args: impl uucore::Args) -> UResult<()> {
|
||||||
pub fn uu_app() -> Command {
|
pub fn uu_app() -> Command {
|
||||||
Command::new(uucore::util_name())
|
Command::new(uucore::util_name())
|
||||||
.version(uucore::crate_version!())
|
.version(uucore::crate_version!())
|
||||||
.about(ABOUT)
|
.about(get_message("arch-about"))
|
||||||
.after_help(SUMMARY)
|
.after_help(get_message("arch-after-help"))
|
||||||
.infer_long_args(true)
|
.infer_long_args(true)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue