mirror of
https://github.com/RGBCube/uutils-coreutils
synced 2025-07-27 19:17:43 +00:00
l10n: port factor for translation + add french
This commit is contained in:
parent
bcb76aca64
commit
f378f081a7
3 changed files with 35 additions and 7 deletions
|
@ -1,3 +1,12 @@
|
|||
factor-about = Print the prime factors of the given NUMBER(s).
|
||||
If none are specified, read from standard input.
|
||||
factor-usage = factor [OPTION]... [NUMBER]...
|
||||
|
||||
# Help messages
|
||||
factor-help-exponents = Print factors in the form p^e
|
||||
factor-help-help = Print help information.
|
||||
|
||||
# Error messages
|
||||
factor-error-factorization-incomplete = Factorization incomplete. Remainders exists.
|
||||
factor-error-write-error = write error
|
||||
factor-error-reading-input = error reading input: { $error }
|
||||
|
|
12
src/uu/factor/locales/fr-FR.ftl
Normal file
12
src/uu/factor/locales/fr-FR.ftl
Normal file
|
@ -0,0 +1,12 @@
|
|||
factor-about = Afficher les facteurs premiers du/des NOMBRE(s) donné(s).
|
||||
Si aucun n'est spécifié, lire depuis l'entrée standard.
|
||||
factor-usage = factor [OPTION]... [NOMBRE]...
|
||||
|
||||
# Messages d'aide
|
||||
factor-help-exponents = Afficher les facteurs sous la forme p^e
|
||||
factor-help-help = Afficher les informations d'aide.
|
||||
|
||||
# Messages d'erreur
|
||||
factor-error-factorization-incomplete = Factorisation incomplète. Des restes existent.
|
||||
factor-error-write-error = erreur d'écriture
|
||||
factor-error-reading-input = erreur de lecture de l'entrée : { $error }
|
|
@ -5,7 +5,7 @@
|
|||
|
||||
// spell-checker:ignore funcs
|
||||
|
||||
use std::collections::BTreeMap;
|
||||
use std::collections::{BTreeMap, HashMap};
|
||||
use std::io::BufRead;
|
||||
use std::io::{self, Write, stdin, stdout};
|
||||
|
||||
|
@ -16,7 +16,7 @@ use uucore::display::Quotable;
|
|||
use uucore::error::{FromIo, UResult, USimpleError, set_exit_code};
|
||||
use uucore::{format_usage, show_error, show_warning};
|
||||
|
||||
use uucore::locale::get_message;
|
||||
use uucore::locale::{get_message, get_message_with_args};
|
||||
|
||||
mod options {
|
||||
pub static EXPONENTS: &str = "exponents";
|
||||
|
@ -46,11 +46,12 @@ fn print_factors_str(
|
|||
if let Some(_remaining) = remaining {
|
||||
return Err(USimpleError::new(
|
||||
1,
|
||||
"Factorization incomplete. Remainders exists.",
|
||||
get_message("factor-error-factorization-incomplete"),
|
||||
));
|
||||
}
|
||||
|
||||
write_result(w, &x, factorization, print_exponents).map_err_context(|| "write error".into())?;
|
||||
write_result(w, &x, factorization, print_exponents)
|
||||
.map_err_context(|| get_message("factor-error-write-error"))?;
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
@ -104,7 +105,13 @@ pub fn uumain(args: impl uucore::Args) -> UResult<()> {
|
|||
}
|
||||
Err(e) => {
|
||||
set_exit_code(1);
|
||||
show_error!("error reading input: {e}");
|
||||
show_error!(
|
||||
"{}",
|
||||
get_message_with_args(
|
||||
"factor-error-reading-input",
|
||||
HashMap::from([("error".to_string(), e.to_string())])
|
||||
)
|
||||
);
|
||||
return Ok(());
|
||||
}
|
||||
}
|
||||
|
@ -131,13 +138,13 @@ pub fn uu_app() -> Command {
|
|||
Arg::new(options::EXPONENTS)
|
||||
.short('h')
|
||||
.long(options::EXPONENTS)
|
||||
.help("Print factors in the form p^e")
|
||||
.help(get_message("factor-help-exponents"))
|
||||
.action(ArgAction::SetTrue),
|
||||
)
|
||||
.arg(
|
||||
Arg::new(options::HELP)
|
||||
.long(options::HELP)
|
||||
.help("Print help information.")
|
||||
.help(get_message("factor-help-help"))
|
||||
.action(ArgAction::Help),
|
||||
)
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue