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
try {
return (int)parent::runAction($route, $params);
} 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
if ($command !== null) {
$result = Yii::$app->createController($command);
if ($result === false) {
throw new Exception(Yii::t('yii', 'No help for unknown command "{command}".', [
'command' => $this->ansiFormat($command, Console::FG_YELLOW),
]));
$name = $this->ansiFormat($command, Console::FG_RED);
throw new Exception("No help for unknown command \"$name\".");
}
list($controller, $actionID) = $result;
......@@ -251,9 +250,8 @@ class HelpController extends Controller
{
$action = $controller->createAction($actionID);
if ($action === null) {
throw new Exception(Yii::t('yii', 'No help for unknown sub-command "{command}".', [
'command' => rtrim($controller->getUniqueId() . '/' . $actionID, '/'),
]));
$name = $this->ansiFormat(rtrim($controller->getUniqueId() . '/' . $actionID, '/'), Console::FG_RED);
throw new Exception("No help for unknown sub-command \"$name\".");
}
$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