Localization not work

Hi,

I am in trouble with localization.

There is a ‘SignupForm’ in the frontend:


<?php

namespace frontend\models;


use common\models\User;

use yii\base\Model;

use Yii;


/**

 * Signup form

 */

class SignupForm extends Model

{

    public $username;

    public $email;

    public $password;


    /**

     * @inheritdoc

     */

    public function rules()

    {

        return [

            ['username', 'filter', 'filter' => 'trim'],

            ['username', 'required'],

            ['username', 'unique', 'targetClass' => '\common\models\User', 'message' => 'This username has already been taken.'],

            ['username', 'string', 'min' => 2, 'max' => 255],


            ['email', 'filter', 'filter' => 'trim'],

            ['email', 'required'],

            ['email', 'email'],

            ['email', 'string', 'max' => 255],

            ['email', 'unique', 'targetClass' => '\common\models\User', 'message' => 'This email address has already been taken.'],


            ['password', 'required'],

            ['password', 'string', 'min' => 6],

        ];

    }

    

    /**

     * @inheritdoc

     */

    public function attributeLabels() {

        return [

            'username' => Yii::t('app/user', 'Username'),

            'email' => Yii::t('app/user', 'Email'),

            'password' => Yii::t('app/user', 'Password'),

        ];

    }


}

And I defined this configuration in the frontend, main.php:


'i18n' => [

            'translations' => [

                'app*' => [

                    'class' => 'yii\i18n\PhpMessageSource',

                    'basePath' => '@common/messages',

                    'sourceLanguage' => 'en-US',

                    'fileMap' => [

                        'app' => 'app.php',

                        'app/user' => 'user.php',

                        'app/error' => 'error.php',

                    ],

                ],

            ],

        ],

        'language' => 'hu-HU',

What I did is I set the default language to hu-HU and I set the translations when yii search for ‘app/user’ category then it has to search in the @common/messages path. But it seems this is not work.

The translation in the common/messages/hu-HU/app/user.php:


return [

    'Auth Key' => 'Authentication key',

    'Created At' => 'Létrehozva',

    'Email' => 'Email',

    'ID' => 'ID',

    'Ip Address' => 'IP cím',

    'Login At' => 'Bejelentkezve',

    'Password' => 'Jelszó',

    'Password Repeat' => 'Jelszó mégegyszer',

    'Password Hash' => 'Password Hash',

    'Password Reset Token' => 'Password Reset Token',

    'Status' => 'Státusz',

    'Updated At' => 'Módosítva',

    'Username' => 'Felhasználónév',

];

And also there is a translation config in the @common/config/main.php:


'i18n' => [

            'translations' => [

                'app*' => [

                    'class' => 'yii\18n\PhpMessageSource',

                    'fileMap' => [

                        'app' => 'app.php',

                        'app/user' => 'user.php',

                        'app/error' => 'error.php',

                    ]

                ],

                'yii' => [

                    'class' => 'yii\i18n\PhpMessageSource',

                    'sourceLanguage' => 'en-US',

                    'basePath' => '@app/messages'

                ],

            ]

        ],

and of course there is an i18n.php in the @common/config/

But when I at the signup form page, the username, email, passoword still English, or the default language on the frontend is not the Hungarian (hu-HU) language.

Does somebody know where is my mistake?