Commit de87f43d by Qiang Xue

Fixes #4292: The error messages for console commands will not be translated

parent eec716d8
...@@ -160,7 +160,7 @@ class Application extends \yii\base\Application ...@@ -160,7 +160,7 @@ class Application extends \yii\base\Application
try { try {
return (int)parent::runAction($route, $params); return (int)parent::runAction($route, $params);
} catch (InvalidRouteException $e) { } catch (InvalidRouteException $e) {
throw new Exception(Yii::t('yii', 'Unknown command "{command}".', ['command' => $route]), 0, $e); throw new Exception("Unknown command \"$route\".", 0, $e);
} }
} }
......
...@@ -51,9 +51,8 @@ class HelpController extends Controller ...@@ -51,9 +51,8 @@ class HelpController extends Controller
if ($command !== null) { if ($command !== null) {
$result = Yii::$app->createController($command); $result = Yii::$app->createController($command);
if ($result === false) { if ($result === false) {
throw new Exception(Yii::t('yii', 'No help for unknown command "{command}".', [ $name = $this->ansiFormat($command, Console::FG_RED);
'command' => $this->ansiFormat($command, Console::FG_YELLOW), throw new Exception("No help for unknown command \"$name\".");
]));
} }
list($controller, $actionID) = $result; list($controller, $actionID) = $result;
...@@ -251,9 +250,8 @@ class HelpController extends Controller ...@@ -251,9 +250,8 @@ class HelpController extends Controller
{ {
$action = $controller->createAction($actionID); $action = $controller->createAction($actionID);
if ($action === null) { if ($action === null) {
throw new Exception(Yii::t('yii', 'No help for unknown sub-command "{command}".', [ $name = $this->ansiFormat(rtrim($controller->getUniqueId() . '/' . $actionID, '/'), Console::FG_RED);
'command' => rtrim($controller->getUniqueId() . '/' . $actionID, '/'), throw new Exception("No help for unknown sub-command \"$name\".");
]));
} }
$description = $controller->getActionHelp($action); $description = $controller->getActionHelp($action);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment