Skip to content

Commit c385d4f

Browse files
committed
ptx: use translate! macro for regex error messages
1 parent 9bea8a3 commit c385d4f

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,3 +28,4 @@ ptx-error-dumb-format = There is no dumb format with GNU extensions disabled
2828
ptx-error-not-implemented = { $feature } not implemented yet
2929
ptx-error-write-failed = write failed
3030
ptx-error-extra-operand = extra operand { $operand }
31+
ptx-invalid-regular-expression = invalid regular expression: { $error }

src/uu/ptx/src/ptx.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -307,9 +307,9 @@ fn create_word_set(
307307
file_map: &FileMap,
308308
) -> UResult<BTreeSet<WordRef>> {
309309
let reg = Regex::new(&filter.word_regex)
310-
.map_err(|e| USimpleError::new(1, format!("invalid regular expression: {}", e)))?;
310+
.map_err(|e| USimpleError::new(1, translate!("ptx-invalid-regular-expression", "error" => e)))?;
311311
let ref_reg = Regex::new(&config.context_regex)
312-
.map_err(|e| USimpleError::new(1, format!("invalid regular expression: {}", e)))?;
312+
.map_err(|e| USimpleError::new(1, translate!("ptx-invalid-regular-expression", "error" => e)))?;
313313
let mut word_set: BTreeSet<WordRef> = BTreeSet::new();
314314
for (file, lines) in file_map {
315315
let mut count: usize = 0;

0 commit comments

Comments
 (0)