@@ -83,9 +83,9 @@ public function __construct(
8383 */
8484 protected function defaults (): self
8585 {
86- $ this ->option ('-h, --help ' , ' Show help ' )->on ([$ this , 'showHelp ' ]);
87- $ this ->option ('-V, --version ' , ' Show version ' )->on ([$ this , 'showVersion ' ]);
88- $ this ->option ('-v, --verbosity ' , ' Verbosity level ' , null , 0 )->on (
86+ $ this ->option ('-h, --help ' , $ this -> translate ( ' showHelp ' ) )->on ([$ this , 'showHelp ' ]);
87+ $ this ->option ('-V, --version ' , $ this -> translate ( ' showVersion ' ) )->on ([$ this , 'showVersion ' ]);
88+ $ this ->option ('-v, --verbosity ' , $ this -> translate ( ' verbosityLevel ' ) , null , 0 )->on (
8989 fn () => $ this ->set ('verbosity ' , ($ this ->verbosity ?? 0 ) + 1 ) && false
9090 );
9191
@@ -196,7 +196,7 @@ public function argument(string $raw, string $desc = '', $default = null): self
196196 $ argument = new Argument ($ raw , $ desc , $ default );
197197
198198 if ($ this ->_argVariadic ) {
199- throw new InvalidParameterException (' Only last argument can be variadic ' );
199+ throw new InvalidParameterException ($ this -> translate ( ' argumentVariadic ' ) );
200200 }
201201
202202 if ($ argument ->variadic ()) {
@@ -303,9 +303,7 @@ protected function handleUnknown(string $arg, ?string $value = null): mixed
303303
304304 // Has some value, error!
305305 if ($ values ) {
306- throw new RuntimeException (
307- sprintf ('Option "%s" not registered ' , $ arg )
308- );
306+ throw new RuntimeException ($ this ->translate ('optionNotRegistered ' , [$ arg ]));
309307 }
310308
311309 // Has no value, show help!
@@ -358,13 +356,13 @@ public function showDefaultHelp(): mixed
358356 $ io ->logo ($ logo , true );
359357 }
360358
361- $ io ->help_header ("Command {$ this ->_name }, version {$ this ->_version }" , true )->eol ();
359+ $ io ->help_header ("{ $ this -> translate ( ' command ' )} {$ this ->_name }, { $ this -> translate ( ' version ' )} {$ this ->_version }" , true )->eol ();
362360 $ io ->help_summary ($ this ->_desc , true )->eol ();
363- $ io ->help_text (' Usage: ' )->help_example ("{$ this ->_name } [OPTIONS...] [ARGUMENTS...] " , true );
361+ $ io ->help_text ("{ $ this -> translate ( ' usage ' )} : " )->help_example ("{$ this ->_name } { $ this -> translate ( ' helpExample ' )} " , true );
364362
365363 $ helper
366364 ->showArgumentsHelp ($ this ->allArguments ())
367- ->showOptionsHelp ($ this ->allOptions (), '' , ' Legend: <required> [optional] variadic... ' );
365+ ->showOptionsHelp ($ this ->allOptions (), '' , $ this -> translate ( ' optionHelp ' ) );
368366
369367 if ($ this ->_usage ) {
370368 $ helper ->showUsage ($ this ->_usage );
0 commit comments