mirror of
https://github.com/RGBCube/uutils-coreutils
synced 2025-07-28 11:37:44 +00:00
Merge pull request #8120 from sylvestre/l10n-sum
l10n: port sum for translation + add french
This commit is contained in:
commit
bd9b5d12d0
3 changed files with 32 additions and 6 deletions
|
@ -2,3 +2,11 @@ sum-about = Checksum and count the blocks in a file.
|
|||
|
||||
With no FILE, or when FILE is -, read standard input.
|
||||
sum-usage = sum [OPTION]... [FILE]...
|
||||
|
||||
# Help messages
|
||||
sum-help-bsd-compatible = use the BSD sum algorithm, use 1K blocks (default)
|
||||
sum-help-sysv-compatible = use System V sum algorithm, use 512 bytes blocks
|
||||
|
||||
# Error messages
|
||||
sum-error-is-directory = { $name }: Is a directory
|
||||
sum-error-no-such-file-or-directory = { $name }: No such file or directory
|
||||
|
|
12
src/uu/sum/locales/fr-FR.ftl
Normal file
12
src/uu/sum/locales/fr-FR.ftl
Normal file
|
@ -0,0 +1,12 @@
|
|||
sum-about = Calculer la somme de contrôle et compter les blocs dans un fichier.
|
||||
|
||||
Sans FICHIER, ou quand FICHIER est -, lire l'entrée standard.
|
||||
sum-usage = sum [OPTION]... [FICHIER]...
|
||||
|
||||
# Messages d'aide
|
||||
sum-help-bsd-compatible = utiliser l'algorithme de somme BSD, utiliser des blocs de 1K (par défaut)
|
||||
sum-help-sysv-compatible = utiliser l'algorithme de somme System V, utiliser des blocs de 512 octets
|
||||
|
||||
# Messages d'erreur
|
||||
sum-error-is-directory = { $name } : Est un répertoire
|
||||
sum-error-no-such-file-or-directory = { $name } : Aucun fichier ou répertoire de ce type
|
|
@ -6,15 +6,15 @@
|
|||
// spell-checker:ignore (ToDO) sysv
|
||||
|
||||
use clap::{Arg, ArgAction, Command};
|
||||
use std::collections::HashMap;
|
||||
use std::fs::File;
|
||||
use std::io::{ErrorKind, Read, Write, stdin, stdout};
|
||||
use std::path::Path;
|
||||
use uucore::display::Quotable;
|
||||
use uucore::error::{FromIo, UResult, USimpleError};
|
||||
use uucore::locale::{get_message, get_message_with_args};
|
||||
use uucore::{format_usage, show};
|
||||
|
||||
use uucore::locale::get_message;
|
||||
|
||||
fn bsd_sum(mut reader: impl Read) -> std::io::Result<(usize, u16)> {
|
||||
let mut buf = [0; 4096];
|
||||
let mut bytes_read = 0;
|
||||
|
@ -74,14 +74,20 @@ fn open(name: &str) -> UResult<Box<dyn Read>> {
|
|||
if path.is_dir() {
|
||||
return Err(USimpleError::new(
|
||||
2,
|
||||
format!("{}: Is a directory", name.maybe_quote()),
|
||||
get_message_with_args(
|
||||
"sum-error-is-directory",
|
||||
HashMap::from([("name".to_string(), name.maybe_quote().to_string())]),
|
||||
),
|
||||
));
|
||||
};
|
||||
// Silent the warning as we want to the error message
|
||||
if path.metadata().is_err() {
|
||||
return Err(USimpleError::new(
|
||||
2,
|
||||
format!("{}: No such file or directory", name.maybe_quote()),
|
||||
get_message_with_args(
|
||||
"sum-error-no-such-file-or-directory",
|
||||
HashMap::from([("name".to_string(), name.maybe_quote().to_string())]),
|
||||
),
|
||||
));
|
||||
};
|
||||
let f = File::open(path).map_err_context(String::new)?;
|
||||
|
@ -149,14 +155,14 @@ pub fn uu_app() -> Command {
|
|||
.arg(
|
||||
Arg::new(options::BSD_COMPATIBLE)
|
||||
.short('r')
|
||||
.help("use the BSD sum algorithm, use 1K blocks (default)")
|
||||
.help(get_message("sum-help-bsd-compatible"))
|
||||
.action(ArgAction::SetTrue),
|
||||
)
|
||||
.arg(
|
||||
Arg::new(options::SYSTEM_V_COMPATIBLE)
|
||||
.short('s')
|
||||
.long(options::SYSTEM_V_COMPATIBLE)
|
||||
.help("use System V sum algorithm, use 512 bytes blocks")
|
||||
.help(get_message("sum-help-sysv-compatible"))
|
||||
.action(ArgAction::SetTrue),
|
||||
)
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue