As you know in Yii2 the core messages are available in 26 languages. I want to change yii core message language to display validation message in my language.
I added this line to my config file:
'language' => 'fa_IR',
and also added this lines:
'i18n'=>[
...
'yii'=>[
'class' => 'yii\i18n\PhpMessageSource',
'basePath' => "@vendor/yiisoft/yii2/messages",
'sourceLanguage' => 'en_US',
'fileMap' => [
'yii'=>'yii.php',
]
]
]
],
but core message shown in English. I only want to use framework message available with Yii2. For example in this path vendor/yiisoft/yii2/messages/fa_IR/yii.php
What is the best solution for this work.
Yii is a high-performance, component-based PHP framework for developing large-scale Web applications rapidly. It enables maximum reusability in Web programming and can significantly accelerate your Web application development process. The name Yii (pronounced Yee or [ji:] ) is an acroynym for "Yes It Is!".
The Yii::t() method will call the i18n application component translate method to perform the actual translation work.
Ohhhh it's my mistake. Language code is fa-IR but I set it fa_IR. I think all language code seperate by _ like 'sourceLanguage' => 'en_US', but it's different. Sorry all.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With