mirror of
https://github.com/RGBCube/uutils-coreutils
synced 2025-07-28 03:27:44 +00:00
l10n: port expr for translation + add french
This commit is contained in:
parent
4128efad0f
commit
fd05bbcb12
3 changed files with 104 additions and 18 deletions
|
@ -43,3 +43,23 @@ expr-after-help = Print the value of EXPRESSION to standard output. A blank line
|
|||
- EXPR_DEBUG_RPN=1: dump expression represented in reverse polish notation
|
||||
- EXPR_DEBUG_SYA_STEP=1: dump each parser step
|
||||
- EXPR_DEBUG_AST=1: dump expression represented abstract syntax tree
|
||||
|
||||
# Help messages
|
||||
expr-help-version = output version information and exit
|
||||
expr-help-help = display this help and exit
|
||||
|
||||
# Error messages
|
||||
expr-error-unexpected-argument = syntax error: unexpected argument { $arg }
|
||||
expr-error-missing-argument = syntax error: missing argument after { $arg }
|
||||
expr-error-non-integer-argument = non-integer argument
|
||||
expr-error-missing-operand = missing operand
|
||||
expr-error-division-by-zero = division by zero
|
||||
expr-error-invalid-regex-expression = Invalid regex expression
|
||||
expr-error-expected-closing-brace-after = syntax error: expecting ')' after { $arg }
|
||||
expr-error-expected-closing-brace-instead-of = syntax error: expecting ')' instead of { $arg }
|
||||
expr-error-unmatched-opening-parenthesis = Unmatched ( or \(
|
||||
expr-error-unmatched-closing-parenthesis = Unmatched ) or \)
|
||||
expr-error-unmatched-opening-brace = Unmatched {"\\{"}
|
||||
expr-error-invalid-bracket-content = Invalid content of {"\\{\\}"}
|
||||
expr-error-trailing-backslash = Trailing backslash
|
||||
expr-error-too-big-range-quantifier-index = Regular expression too big
|
||||
|
|
65
src/uu/expr/locales/fr-FR.ftl
Normal file
65
src/uu/expr/locales/fr-FR.ftl
Normal file
|
@ -0,0 +1,65 @@
|
|||
expr-about = Afficher la valeur de EXPRESSION sur la sortie standard
|
||||
expr-usage = expr [EXPRESSION]
|
||||
expr [OPTIONS]
|
||||
expr-after-help = Afficher la valeur de EXPRESSION sur la sortie standard. Une ligne vide ci-dessous
|
||||
sépare les groupes de précédence croissante.
|
||||
|
||||
EXPRESSION peut être :
|
||||
|
||||
- ARG1 | ARG2: ARG1 s'il n'est ni nul ni 0, sinon ARG2
|
||||
- ARG1 & ARG2: ARG1 si aucun argument n'est nul ou 0, sinon 0
|
||||
- ARG1 < ARG2: ARG1 est inférieur à ARG2
|
||||
- ARG1 <= ARG2: ARG1 est inférieur ou égal à ARG2
|
||||
- ARG1 = ARG2: ARG1 est égal à ARG2
|
||||
- ARG1 != ARG2: ARG1 est différent de ARG2
|
||||
- ARG1 >= ARG2: ARG1 est supérieur ou égal à ARG2
|
||||
- ARG1 > ARG2: ARG1 est supérieur à ARG2
|
||||
- ARG1 + ARG2: somme arithmétique de ARG1 et ARG2
|
||||
- ARG1 - ARG2: différence arithmétique de ARG1 et ARG2
|
||||
- ARG1 * ARG2: produit arithmétique de ARG1 et ARG2
|
||||
- ARG1 / ARG2: quotient arithmétique de ARG1 divisé par ARG2
|
||||
- ARG1 % ARG2: reste arithmétique de ARG1 divisé par ARG2
|
||||
- STRING : REGEXP: correspondance de motif ancré de REGEXP dans STRING
|
||||
- match STRING REGEXP: identique à STRING : REGEXP
|
||||
- substr STRING POS LENGTH: sous-chaîne de STRING, POS compté à partir de 1
|
||||
- index STRING CHARS: index dans STRING où l'un des CHARS est trouvé, ou 0
|
||||
- length STRING: longueur de STRING
|
||||
- + TOKEN: interpréter TOKEN comme une chaîne, même si c'est un mot-clé comme match
|
||||
ou un opérateur comme /
|
||||
- ( EXPRESSION ): valeur de EXPRESSION
|
||||
|
||||
Attention : de nombreux opérateurs doivent être échappés ou mis entre guillemets pour les shells.
|
||||
Les comparaisons sont arithmétiques si les deux ARG sont des nombres, sinon lexicographiques.
|
||||
Les correspondances de motifs retournent la chaîne correspondant entre \( et \) ou null ; si
|
||||
\( et \) ne sont pas utilisés, elles retournent le nombre de caractères correspondants ou 0.
|
||||
|
||||
Le statut de sortie est 0 si EXPRESSION n'est ni nulle ni 0, 1 si EXPRESSION
|
||||
est nulle ou 0, 2 si EXPRESSION est syntaxiquement invalide, et 3 si une
|
||||
erreur s'est produite.
|
||||
|
||||
Variables d'environnement :
|
||||
|
||||
- EXPR_DEBUG_TOKENS=1: afficher les jetons de l'expression
|
||||
- EXPR_DEBUG_RPN=1: afficher l'expression représentée en notation polonaise inverse
|
||||
- EXPR_DEBUG_SYA_STEP=1: afficher chaque étape de l'analyseur
|
||||
- EXPR_DEBUG_AST=1: afficher l'arbre de syntaxe abstraite représentant l'expression
|
||||
|
||||
# Messages d'aide
|
||||
expr-help-version = afficher les informations de version et quitter
|
||||
expr-help-help = afficher cette aide et quitter
|
||||
|
||||
# Messages d'erreur
|
||||
expr-error-unexpected-argument = erreur de syntaxe : argument inattendu { $arg }
|
||||
expr-error-missing-argument = erreur de syntaxe : argument manquant après { $arg }
|
||||
expr-error-non-integer-argument = argument non entier
|
||||
expr-error-missing-operand = opérande manquant
|
||||
expr-error-division-by-zero = division par zéro
|
||||
expr-error-invalid-regex-expression = Expression regex invalide
|
||||
expr-error-expected-closing-brace-after = erreur de syntaxe : ')' attendu après { $arg }
|
||||
expr-error-expected-closing-brace-instead-of = erreur de syntaxe : ')' attendu au lieu de { $arg }
|
||||
expr-error-unmatched-opening-parenthesis = Parenthèse ouvrante ( ou \( non appariée
|
||||
expr-error-unmatched-closing-parenthesis = Parenthèse fermante ) ou \) non appariée
|
||||
expr-error-unmatched-opening-brace = Accolade ouvrante {"\\{"} non appariée
|
||||
expr-error-invalid-bracket-content = Contenu invalide de {"\\{\\}"}
|
||||
expr-error-trailing-backslash = Barre oblique inverse en fin
|
||||
expr-error-too-big-range-quantifier-index = Expression régulière trop grande
|
|
@ -4,9 +4,10 @@
|
|||
// file that was distributed with this source code.
|
||||
|
||||
use clap::{Arg, ArgAction, Command};
|
||||
use std::collections::HashMap;
|
||||
use syntax_tree::{AstNode, is_truthy};
|
||||
use thiserror::Error;
|
||||
use uucore::locale::get_message;
|
||||
use uucore::locale::{get_message, get_message_with_args};
|
||||
use uucore::{
|
||||
display::Quotable,
|
||||
error::{UError, UResult},
|
||||
|
@ -25,33 +26,33 @@ pub type ExprResult<T> = Result<T, ExprError>;
|
|||
|
||||
#[derive(Error, Clone, Debug, PartialEq, Eq)]
|
||||
pub enum ExprError {
|
||||
#[error("syntax error: unexpected argument {}", .0.quote())]
|
||||
#[error("{}", get_message_with_args("expr-error-unexpected-argument", HashMap::from([("arg".to_string(), _0.quote().to_string())])))]
|
||||
UnexpectedArgument(String),
|
||||
#[error("syntax error: missing argument after {}", .0.quote())]
|
||||
#[error("{}", get_message_with_args("expr-error-missing-argument", HashMap::from([("arg".to_string(), _0.quote().to_string())])))]
|
||||
MissingArgument(String),
|
||||
#[error("non-integer argument")]
|
||||
#[error("{}", get_message("expr-error-non-integer-argument"))]
|
||||
NonIntegerArgument,
|
||||
#[error("missing operand")]
|
||||
#[error("{}", get_message("expr-error-missing-operand"))]
|
||||
MissingOperand,
|
||||
#[error("division by zero")]
|
||||
#[error("{}", get_message("expr-error-division-by-zero"))]
|
||||
DivisionByZero,
|
||||
#[error("Invalid regex expression")]
|
||||
#[error("{}", get_message("expr-error-invalid-regex-expression"))]
|
||||
InvalidRegexExpression,
|
||||
#[error("syntax error: expecting ')' after {}", .0.quote())]
|
||||
#[error("{}", get_message_with_args("expr-error-expected-closing-brace-after", HashMap::from([("arg".to_string(), _0.quote().to_string())])))]
|
||||
ExpectedClosingBraceAfter(String),
|
||||
#[error("syntax error: expecting ')' instead of {}", .0.quote())]
|
||||
#[error("{}", get_message_with_args("expr-error-expected-closing-brace-instead-of", HashMap::from([("arg".to_string(), _0.quote().to_string())])))]
|
||||
ExpectedClosingBraceInsteadOf(String),
|
||||
#[error("Unmatched ( or \\(")]
|
||||
#[error("{}", get_message("expr-error-unmatched-opening-parenthesis"))]
|
||||
UnmatchedOpeningParenthesis,
|
||||
#[error("Unmatched ) or \\)")]
|
||||
#[error("{}", get_message("expr-error-unmatched-closing-parenthesis"))]
|
||||
UnmatchedClosingParenthesis,
|
||||
#[error("Unmatched \\{{")]
|
||||
#[error("{}", get_message("expr-error-unmatched-opening-brace"))]
|
||||
UnmatchedOpeningBrace,
|
||||
#[error("Invalid content of \\{{\\}}")]
|
||||
#[error("{}", get_message("expr-error-invalid-bracket-content"))]
|
||||
InvalidBracketContent,
|
||||
#[error("Trailing backslash")]
|
||||
#[error("{}", get_message("expr-error-trailing-backslash"))]
|
||||
TrailingBackslash,
|
||||
#[error("Regular expression too big")]
|
||||
#[error("{}", get_message("expr-error-too-big-range-quantifier-index"))]
|
||||
TooBigRangeQuantifierIndex,
|
||||
}
|
||||
|
||||
|
@ -77,13 +78,13 @@ pub fn uu_app() -> Command {
|
|||
.arg(
|
||||
Arg::new(options::VERSION)
|
||||
.long(options::VERSION)
|
||||
.help("output version information and exit")
|
||||
.help(get_message("expr-help-version"))
|
||||
.action(ArgAction::Version),
|
||||
)
|
||||
.arg(
|
||||
Arg::new(options::HELP)
|
||||
.long(options::HELP)
|
||||
.help("display this help and exit")
|
||||
.help(get_message("expr-help-help"))
|
||||
.action(ArgAction::Help),
|
||||
)
|
||||
.arg(
|
||||
|
@ -96,7 +97,7 @@ pub fn uu_app() -> Command {
|
|||
#[uucore::main]
|
||||
pub fn uumain(args: impl uucore::Args) -> UResult<()> {
|
||||
// For expr utility we do not want getopts.
|
||||
// The following usage should work without escaping hyphens: `expr -15 = 1 + 2 \* \( 3 - -4 \)`
|
||||
// The following usage should work without escaping hyphens: `expr -15 = 1 + 2 \* \( 3 - -4 \)`
|
||||
let args: Vec<String> = args
|
||||
.skip(1) // Skip binary name
|
||||
.map(|a| a.to_string_lossy().to_string())
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue