In yii2, I want to override some translations of the main messages, for example: in @ yii / messages / vi / yii.php, has key => the translated message:
'Update' => 'Sửa'
but in my application I want to change this as:
'Update' => 'Cập nhật'
I created a file: @ app / messages / vi / yii.php, has only one message that needs to be redefined:
return [
'Update' => 'Cập nhật'
];
in my main.php configuration, I added this to the components:
'i18n' => [
'translations' => [
'yii' => [
'class' => 'yii\i18n\PhpMessageSource',
'basePath' => '@app/messages'
],
],
],
It works, but only for messages with overriding, others from the kernel do not work.
source
share