I have added below codes for multi languages and its working fine on my local system, but after pushed on live, if i click on submit button while creating new record then it will redirect to blank page. there is not display any error. but that record has been added into database. same issue on record update. May be inshort once record create/update redirect is not working properly. i can’t understand why this happening.
I have checked app log in the runtime directory, but there is not get any error. i think there is issue with
Yii::$app->session->setFlash()
and
Yii::t()
. because i have set custom message as per below on record create/update.
$model = new Purpose();
if ($model->load(Yii::$app->request->post()) && $model->save()) {
Yii::$app->session->setFlash('Msg', Yii::t('app','Purpose has been created'));
return $this->redirect(['index']);
} else {
return $this->render('create', [
'model' => $model,
]);
}
If i removed Yii::t(‘app’,’’) code from Yii::$app->session->setFlash then it will work properly. but i want to set this message in multi languages. so is there any way to fix this issue OR any alternate solution?
You don’t need to (and should not) add that line to the language file.
What editor are you using for editing language files? You should check the settings of your editor. It should display the correct characters of Arabic, Chinese and Korean language without that line.