55
66// spell-checker:ignore funcs
77
8- use std:: collections:: BTreeMap ;
8+ use std:: collections:: { BTreeMap , HashMap } ;
99use std:: io:: BufRead ;
1010use std:: io:: { self , Write , stdin, stdout} ;
1111
@@ -16,7 +16,7 @@ use uucore::display::Quotable;
1616use uucore:: error:: { FromIo , UResult , USimpleError , set_exit_code} ;
1717use uucore:: { format_usage, show_error, show_warning} ;
1818
19- use uucore:: locale:: get_message;
19+ use uucore:: locale:: { get_message, get_message_with_args } ;
2020
2121mod options {
2222 pub static EXPONENTS : & str = "exponents" ;
@@ -46,11 +46,12 @@ fn print_factors_str(
4646 if let Some ( _remaining) = remaining {
4747 return Err ( USimpleError :: new (
4848 1 ,
49- "Factorization incomplete. Remainders exists." ,
49+ get_message ( "factor-error-factorization- incomplete" ) ,
5050 ) ) ;
5151 }
5252
53- write_result ( w, & x, factorization, print_exponents) . map_err_context ( || "write error" . into ( ) ) ?;
53+ write_result ( w, & x, factorization, print_exponents)
54+ . map_err_context ( || get_message ( "factor-error-write-error" ) ) ?;
5455
5556 Ok ( ( ) )
5657}
@@ -104,7 +105,13 @@ pub fn uumain(args: impl uucore::Args) -> UResult<()> {
104105 }
105106 Err ( e) => {
106107 set_exit_code ( 1 ) ;
107- show_error ! ( "error reading input: {e}" ) ;
108+ show_error ! (
109+ "{}" ,
110+ get_message_with_args(
111+ "factor-error-reading-input" ,
112+ HashMap :: from( [ ( "error" . to_string( ) , e. to_string( ) ) ] )
113+ )
114+ ) ;
108115 return Ok ( ( ) ) ;
109116 }
110117 }
@@ -131,13 +138,13 @@ pub fn uu_app() -> Command {
131138 Arg :: new ( options:: EXPONENTS )
132139 . short ( 'h' )
133140 . long ( options:: EXPONENTS )
134- . help ( "Print factors in the form p^e" )
141+ . help ( get_message ( "factor-help-exponents" ) )
135142 . action ( ArgAction :: SetTrue ) ,
136143 )
137144 . arg (
138145 Arg :: new ( options:: HELP )
139146 . long ( options:: HELP )
140- . help ( "Print help information." )
147+ . help ( get_message ( "factor- help-help" ) )
141148 . action ( ArgAction :: Help ) ,
142149 )
143150}
0 commit comments