-
-
Notifications
You must be signed in to change notification settings - Fork 6.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Unable to resolve the request translation #4065
Comments
Is it displayed to end user? |
Is it actually useful for end user? |
I think yes it is : ) Sometimes there will be a missing link on the website and we have to trigger an error if this link is missing. So in a translated site an english error is weird. If it is not so hard I think you should add this error in translation file ... |
Yes, it's probably OK to display something but does |
btw., do you have |
Ok what am I going to display to my user then : )) Yes my debug is false now and the error message is same .. This is my error function in controller.
|
I keep thinking exceptions shown to users should be translated. |
Now if my link is missing or misconfigured controller view etc.. The user should see this error message. "Unable to resolve the request". So it is really weird to see an english error on a translated site .. If another thing I can do to prevent this it is ok, but if not then it should be great to add this error message in translation file. |
Shouldn't user get just a regular 404 in this case w/o any cryptic messages that are intended for developers? |
Ok sounds good how can I do this ?? I send my controller error function above .. |
Via application config you can customize error handler settings: 'components' => [
'errorHandler' => [
'errorView' => '@app/views/errorHandler/error.php',
],
] Then copy framework's |
I did this I have my own error.php file. I am asking that I have sent the error to my view file and when exception occurs it is coming with this message. So I think I can do this like this. if(404==Yii::$app->errorHandler->error->code){
$message = 'Translated message';
} |
Something like if ($code === 404) {
$message = 'Translated message';
} |
In a view you already have all data so no need to call |
Ok thanx ... |
I did this because I want to do it with my controller but exception messages not affected with my controller. Is it normal ?? My error.htm loaded succesfully but without loading the error controller. 'errorHandler' => [
'errorAction' => 'site/error',
], in site controller /* I added this method as per documentation */
public function actions()
{
return [
'error' => [
'class' => 'yii\web\ErrorAction',
'view'=>'@app/views/site/error.htm',
],
];
}
public function actionError()
{
if(404==Yii::$app->errorHandler->error->code)
{
$message = 'Translated message';
}
else
{
$message = Yii::$app->errorHandler->error;
}
return $this->render('error.htm',[
'message' => $message,
]
);
} |
Remove |
Hi,
If possible can you include the message "Unable to resolve the request" into the yii.php so this error message can be translated.
The text was updated successfully, but these errors were encountered: