Skip to content

Commit 2b5d992

Browse files
author
Gunter Schmidt
committed
Fix Error Messages and translations
1 parent 8f843d7 commit 2b5d992

10 files changed

Lines changed: 39 additions & 20 deletions

File tree

src/uu/cmp/locales/en-US.ftl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
# TODO French translation
12
cmp-about = Compare two binary files for differences.
23
34
With no FILE, or when FILE is -, read standard input.

src/uu/diff/locales/en-US.ftl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
# TODO French translation
12
diff-about = Compare two text files for differences.
23
34
With no FILE, or when FILE is -, read standard input.

src/uu/diff/src/params_diff.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -912,6 +912,7 @@ pub fn uu_app() -> Command {
912912
)
913913
.arg(
914914
Arg::new(options::CONTEXT_LINES)
915+
.long("context")
915916
.short('c')
916917
.value_name("NUM")
917918
.num_args(0..=1)
@@ -922,7 +923,6 @@ pub fn uu_app() -> Command {
922923
)
923924
.arg(
924925
Arg::new(options::CONTEXT_LINES_UPPER)
925-
.long("context")
926926
.short('C')
927927
.value_name("NUM")
928928
.action(ArgAction::Set)
@@ -1228,6 +1228,7 @@ pub fn uu_app() -> Command {
12281228
)
12291229
.arg(
12301230
Arg::new(options::UNIFIED_LINES)
1231+
.long("unified")
12311232
.short('u')
12321233
.value_name("NUM")
12331234
.num_args(0..=1)
@@ -1238,7 +1239,6 @@ pub fn uu_app() -> Command {
12381239
)
12391240
.arg(
12401241
Arg::new(options::UNIFIED_LINES_UPPER)
1241-
.long("unified")
12421242
.short('U')
12431243
.value_name("NUM")
12441244
.action(ArgAction::Set)

src/uudiff/locales/en-US.ftl

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
# Error messages specific to DiffUtils
22
parse-error-conflicting-output-options = Conflicting output style options '--{ $opt1 }' and '--{ $opt2 }'.
3-
parse-error-extra-operand = extra operand { $operand }
4-
parse-error-incompatible-options = options --{ $opt1 } and --{ $opt2 } are incompatible
5-
parse-error-invalid-value = invalid value '{ $value }' for option --{ $option }
3+
parse-error-extra-operand = extra operand '{ $operand }'
4+
parse-error-incompatible-options = options '--{ $opt1 }' and '--{ $opt2 }' are incompatible
5+
parse-error-invalid-value = invalid value '{ $value }' for option '--{ $option }'
66
parse-error-invalid-context-length = invalid context length '{ $value }'
77
parse-error-invalid-unified-length = invalid unified length '{ $value }'
8-
parse-error-invalid-value-overflow = invalid value '{ $value }' (too large) for option --{ $option }
9-
parse-error-invalid-value-unit = invalid unit in '{ $value }' for option --{ $option }
8+
parse-error-invalid-value-overflow = invalid value '{ $value }' (too large) for option '--{ $option }'
9+
parse-error-invalid-value-unit = invalid unit in '{ $value }' for option '--{ $option }'
1010
parse-error-missing-operand = missing operand after '{ $after }'
1111
parse-error-not-yet-implemented = the option '--{ $option}' is not yet implemented
1212

src/uudiff/locales/fr-FR.ftl

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,14 @@
11
# Error messages specific to DiffUtils
2+
parse-error-conflicting-output-options = Options de formatage de sortie incompatibles '--{ $opt1 }' et '--{ $opt2 }'.
3+
parse-error-extra-operand = opérande supplémentaire { $operand }
4+
parse-error-incompatible-options = les options --{ $opt1 } and --{ $opt2 } sont incompatibles
5+
parse-error-invalid-value = valeur invalide '{ $value }' pour '{ $option }'
6+
parse-error-invalid-context-length = longueur de contexte non valide '{ $value }'
7+
parse-error-invalid-unified-length = longueur unifiée non valide '{ $value }'
8+
parse-error-invalid-value-overflow = valeur invalide '{ $value }' (trop grand) pour '{ $option }'
9+
parse-error-invalid-value-unit = unité non valide dans '{ $value }' pour l'option '--{ $option }'
10+
parse-error-missing-operand = opérande manquant après '{ $after }'
11+
parse-error-not-yet-implemented = L'option '--{ $option}' n'est pas encore implémentée
212
313
# *** This is a copy from coreutils ***
414
# Chaînes communes partagées entre toutes les commandes uutils

src/uudiff/src/lib/features/benchmark.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
// For the full copyright and license information, please view the LICENSE
44
// file that was distributed with this source code.
55

6-
//! Common benchmark utilities for uutils coreutils
6+
//! Common benchmark utilities for uutils diffutils.
77
//!
88
//! This module provides shared functionality for benchmarking utilities,
99
//! including test data generation and binary execution helpers.

src/uudiff/src/lib/macros.rs

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,12 @@
1+
// This file is part of the uutils diffutils package.
2+
//
3+
// For the full copyright and license information, please view the LICENSE
4+
// file that was distributed with this source code.
5+
6+
// spell-checker:ignore replacen
7+
18
// asserts equality of the actual diff and expected diff
2-
// considering datetime varitations
9+
// considering datetime variations
310
//
411
// It replaces the modification time in the actual diff
512
// with placeholder "TIMESTAMP" and then asserts the equality

src/uudiff/src/lib/mods/common_errors.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77
88
use std::ffi::OsString;
99

10-
use os_display::Quotable;
1110
use uucore::parser::parse_size::ParseSizeError;
1211

1312
use crate::{error::UError, translate};
@@ -179,7 +178,7 @@ impl std::fmt::Display for UParseError {
179178
translate!("parse-error-conflicting-output-options", "opt1" => opt_1, "opt2" => opt_2)
180179
}
181180
Self::ExtraOperand(extra_operand) => {
182-
translate!("parse-error-extra-operand", "operand" => extra_operand.quote())
181+
translate!("parse-error-extra-operand", "operand" => extra_operand.to_string_lossy())
183182
}
184183
Self::InvalidContextLength(value) => {
185184
translate!("parse-error-invalid-context-length", "value" => value)

tests/by-util/test_cmp.rs

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -640,15 +640,15 @@ mod parser {
640640
.arg("--bytes")
641641
.arg("1ZB")
642642
.fails_with_code(2)
643-
.stderr_contains("cmp: invalid unit in '1ZB' for option --bytes");
643+
.stderr_contains("cmp: invalid unit in '1ZB' for option '--bytes'");
644644

645645
new_ucmd!()
646646
.arg("lorem_ipsum.txt")
647647
.arg("lorem_ipsum_diff.txt")
648648
.arg("--bytes")
649649
.arg("99999999999999999999999999999999999999999999999999999999999")
650650
.fails_with_code(2)
651-
.stderr_contains("cmp: invalid value '99999999999999999999999999999999999999999999999999999999999' (too large) for option --bytes");
651+
.stderr_contains("cmp: invalid value '99999999999999999999999999999999999999999999999999999999999' (too large) for option '--bytes'");
652652
}
653653

654654
#[test]
@@ -659,7 +659,7 @@ mod parser {
659659
.arg("lorem_ipsum_diff.txt")
660660
.arg("--bytes=-1")
661661
.fails_with_code(2)
662-
.stderr_contains("cmp: invalid value '-1' for option --bytes");
662+
.stderr_contains("cmp: invalid value '-1' for option '--bytes'");
663663
}
664664

665665
#[test]
@@ -671,15 +671,15 @@ mod parser {
671671
.arg("1")
672672
.arg("2Y")
673673
.fails_with_code(2)
674-
.stderr_contains("cmp: invalid unit in '2Y' for option --ignore-initial");
674+
.stderr_contains("cmp: invalid unit in '2Y' for option '--ignore-initial'");
675675

676676
new_ucmd!()
677677
.arg("lorem_ipsum.txt")
678678
.arg("lorem_ipsum_diff.txt")
679679
.arg("--ignore-initial")
680680
.arg("99999999999999999999999999999999999999999999999999999999999")
681681
.fails_with_code(2)
682-
.stderr_contains("cmp: invalid value '99999999999999999999999999999999999999999999999999999999999' (too large) for option --ignore-initial");
682+
.stderr_contains("cmp: invalid value '99999999999999999999999999999999999999999999999999999999999' (too large) for option '--ignore-initial'");
683683
}
684684

685685
#[test]
@@ -691,7 +691,7 @@ mod parser {
691691
.arg("--ignore-initial")
692692
.arg("1:2:3")
693693
.fails_with_code(2)
694-
.stderr_contains("cmp: invalid unit in '2:3' for option --ignore-initial");
694+
.stderr_contains("cmp: invalid unit in '2:3' for option '--ignore-initial'");
695695
}
696696

697697
#[test]
@@ -714,7 +714,7 @@ mod parser {
714714
.arg("lorem_ipsum.txt")
715715
.arg("lorem_ipsum_diff.txt")
716716
.fails_with_code(2)
717-
.stderr_contains("cmp: options --verbose and --silent are incompatible");
717+
.stderr_contains("cmp: options '--verbose' and '--silent' are incompatible");
718718
}
719719

720720
#[test]
@@ -725,7 +725,7 @@ mod parser {
725725
.arg("lorem_ipsum.txt")
726726
.arg("lorem_ipsum_diff.txt")
727727
.fails_with_code(2)
728-
.stderr_contains("cmp: options --verbose and --silent are incompatible");
728+
.stderr_contains("cmp: options '--verbose' and '--silent' are incompatible");
729729
}
730730

731731
#[test]
@@ -737,7 +737,7 @@ mod parser {
737737
.arg("lorem_ipsum.txt")
738738
.arg("lorem_ipsum_diff.txt")
739739
.fails_with_code(2)
740-
.stderr_contains("cmp: options --print-bytes and --silent are incompatible");
740+
.stderr_contains("cmp: options '--print-bytes' and '--silent' are incompatible");
741741
}
742742

743743
#[test]

tests/by-util/test_diff.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -388,6 +388,7 @@ mod parser {
388388
"--context 42",
389389
"-42C",
390390
] {
391+
// dbg!(&arg);
391392
assert!(parse(&format!("diff {arg} foo bar")).is_err());
392393
}
393394
}

0 commit comments

Comments
 (0)