problem with translations

In a view:


echo \Yii::t('app','Home');

In config\web.php:




'language' => 'ar',

'components' => [

        'i18n'=>array(

            'translations' => array(

                'app*'=>array(

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

                    'basePath' => "@app/messages",

                    'sourceLanguage' => 'en_US',

                    'fileMap' => array(

                        'app'=>'app.php',

                        

                    )

                ),

                'yii'=>array(

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

                    'basePath' => "@app/messages",

                    'sourceLanguage' => 'en_US',

                    'fileMap' => array(

                        'yii'=>'yii.php',

                    )

                )

           )

       )

],



In vendor\yiisoft\yii2\messages\ar\yii.php:


<?php

return [

    'Home' => 'الرئيسية',

];



Can anyone please help me why the string is not getting translated?

@app is base path of currently running application so not ‘vendor\yiisoft\yii2’. Place your translation files properly.