|
5 | 5 |
|
6 | 6 | // spell-checker:ignore (misc) uioerror |
7 | 7 | use filetime::FileTime; |
| 8 | +use std::collections::HashMap; |
8 | 9 | use std::path::PathBuf; |
9 | 10 | use thiserror::Error; |
10 | 11 | use uucore::display::Quotable; |
11 | 12 | use uucore::error::{UError, UIoError}; |
| 13 | +use uucore::locale::get_message_with_args; |
12 | 14 |
|
13 | 15 | #[derive(Debug, Error)] |
14 | 16 | pub enum TouchError { |
15 | | - #[error("Unable to parse date: {0}")] |
| 17 | + #[error("{}", get_message_with_args("touch-error-unable-to-parse-date", HashMap::from([("date".to_string(), .0.clone())])))] |
16 | 18 | InvalidDateFormat(String), |
17 | 19 |
|
18 | 20 | /// The source time couldn't be converted to a [chrono::DateTime] |
19 | | - #[error("Source has invalid access or modification time: {0}")] |
| 21 | + #[error("{}", get_message_with_args("touch-error-invalid-filetime", HashMap::from([("time".to_string(), .0.to_string())])))] |
20 | 22 | InvalidFiletime(FileTime), |
21 | 23 |
|
22 | 24 | /// The reference file's attributes could not be found or read |
23 | | - #[error("failed to get attributes of {}: {}", .0.quote(), to_uioerror(.1))] |
| 25 | + #[error("{}", get_message_with_args("touch-error-reference-file-inaccessible", HashMap::from([("path".to_string(), .0.quote().to_string()), ("error".to_string(), to_uioerror(.1).to_string())])))] |
24 | 26 | ReferenceFileInaccessible(PathBuf, std::io::Error), |
25 | 27 |
|
26 | 28 | /// An error getting a path to stdout on Windows |
27 | | - #[error("GetFinalPathNameByHandleW failed with code {0}")] |
| 29 | + #[error("{}", get_message_with_args("touch-error-windows-stdout-path-failed", HashMap::from([("code".to_string(), .0.clone())])))] |
28 | 30 | WindowsStdoutPathError(String), |
29 | 31 |
|
30 | 32 | /// An error encountered on a specific file |
|
0 commit comments