2020use Ahc \Cli \Output \Writer ;
2121use Throwable ;
2222
23+ use function Ahc \Cli \t ;
2324use function array_map ;
2425use function array_shift ;
2526use function asort ;
@@ -79,7 +80,7 @@ public function printTrace(Throwable $e): void
7980
8081 $ this ->writer ->colors (
8182 "{$ eClass } <red> {$ e ->getMessage ()}</end><eol/> " .
82- " ( { $ this -> translate ('thrown in ' )} <yellow> {$ e ->getFile ()}</end><white>: {$ e ->getLine ()})</end> "
83+ ' ( ' . t ('thrown in ' ) . " <yellow> {$ e ->getFile ()}</end><white>: {$ e ->getLine ()})</end> "
8384 );
8485
8586 // @codeCoverageIgnoreStart
@@ -89,7 +90,7 @@ public function printTrace(Throwable $e): void
8990 }
9091 // @codeCoverageIgnoreEnd
9192
92- $ traceStr = " <eol/><eol/><bold> { $ this -> translate ('Stack Trace ' )} :</end><eol/><eol/> " ;
93+ $ traceStr = ' <eol/><eol/><bold> ' . t ('Stack Trace ' ) . ' :</end><eol/><eol/> ' ;
9394
9495 foreach ($ e ->getTrace () as $ i => $ trace ) {
9596 $ trace += ['class ' => '' , 'type ' => '' , 'function ' => '' , 'file ' => '' , 'line ' => '' , 'args ' => []];
@@ -99,7 +100,7 @@ public function printTrace(Throwable $e): void
99100 $ traceStr .= " <comment> $ i)</end> <red> $ symbol</end><comment>( $ args)</end> " ;
100101 if ('' !== $ trace ['file ' ]) {
101102 $ file = realpath ($ trace ['file ' ]);
102- $ traceStr .= "<eol/> <yellow> { $ this -> translate ('at ' )} $ file</end><white>: {$ trace ['line ' ]}</end><eol/> " ;
103+ $ traceStr .= "<eol/> <yellow> " . t ('at ' ) . " $ file</end><white>: {$ trace ['line ' ]}</end><eol/> " ;
103104 }
104105 }
105106
@@ -187,7 +188,7 @@ protected function showHelp(string $for, array $items, string $header = '', stri
187188 $ this ->writer ->help_header ($ header , true );
188189 }
189190
190- $ this ->writer ->eol ()->help_category ($ this -> translate ($ for ) . ': ' , true );
191+ $ this ->writer ->eol ()->help_category (t ($ for ) . ': ' , true );
191192
192193 if (empty ($ items )) {
193194 $ this ->writer ->help_text (' (n/a) ' , true );
@@ -231,7 +232,7 @@ public function showUsage(string $usage): self
231232 $ usage = str_replace ('$0 ' , $ _SERVER ['argv ' ][0 ] ?? '[cmd] ' , $ usage );
232233
233234 if (!str_contains ($ usage , ' ## ' )) {
234- $ this ->writer ->eol ()->help_category ($ this -> translate ('Usage Examples ' ) . ': ' , true )->colors ($ usage )->eol ();
235+ $ this ->writer ->eol ()->help_category (t ('Usage Examples ' ) . ': ' , true )->colors ($ usage )->eol ();
235236
236237 return $ this ;
237238 }
@@ -248,7 +249,7 @@ public function showUsage(string $usage): self
248249 return str_pad ('# ' , $ maxlen - array_shift ($ lines ), ' ' , STR_PAD_LEFT );
249250 }, $ usage );
250251
251- $ this ->writer ->eol ()->help_category ($ this -> translate ('Usage Examples ' ) . ': ' , true )->colors ($ usage )->eol ();
252+ $ this ->writer ->eol ()->help_category (t ('Usage Examples ' ) . ': ' , true )->colors ($ usage )->eol ();
252253
253254 return $ this ;
254255 }
@@ -263,11 +264,11 @@ public function showCommandNotFound(string $attempted, array $available): self
263264 }
264265 }
265266
266- $ this ->writer ->error ($ this -> translate ('Command %s not found ' , [$ attempted ]), true );
267+ $ this ->writer ->error (t ('Command %s not found ' , [$ attempted ]), true );
267268 if ($ closest ) {
268269 asort ($ closest );
269270 $ closest = key ($ closest );
270- $ this ->writer ->bgRed ($ this -> translate ('Did you mean %s? ' , [$ closest ]), true );
271+ $ this ->writer ->bgRed (t ('Did you mean %s? ' , [$ closest ]), true );
271272 }
272273
273274 return $ this ;
0 commit comments