yiisoft / yii2

Yii 2: The Fast, Secure and Professional PHP Framework
http://www.yiiframework.com
BSD 3-Clause "New" or "Revised" License
14.24k stars 6.9k forks source link

Multilingual Model Validation Errors Issue #15841

Closed abasit83 closed 6 years ago

abasit83 commented 6 years ago

I am using Yii 2 Basic.

For displaying error in any form for field email, it should say "Email cannot be blank" and in arabic " البريد الإلكتروني لا يمكن تركه فارغًا."

How can I do that if I have 2 panels

MemberPanel can either be in English or Arabic. (on member selection) AdminPanel must be in English

Can anyone guide me in all steps that I would follow. Thanks

larryli commented 6 years ago

Try module for admin panel.

You can modify in \app\admin\Module.php:

class Module extends \yii\base\Module
{
    /**
     * @inheritdoc
     */
    public function init()
    {
        parent::init();
        Yii::$app->language = 'en-US';
    }
}

And Select language by user.

yii-bot commented 6 years ago

Thank you for your question. In order for this issue tracker to be effective, it should only contain bug reports and feature requests.

We advise you to use our community driven resources:

If you are confident that there is a bug in the framework, feel free to provide information on how to reproduce it. This issue will be closed for now.

This is an automated comment, triggered by adding the label question.