title: Yii2 translation does not work
body: <p>I have Yii2 advanced template, I want to set translation for my frontend views, here is what I did:</p>
  
  <p><code>frontend/config/main.php:</code></p>
  
  <pre><code>'sourceLanguage'=&gt;'en-US',
  'language'=&gt;'en-US',
  'components' =&gt; [
  'i18n' =&gt; [
       'translations' =&gt; [
             'app*' =&gt; [
                  'class' =&gt; 'yii\i18n\PhpMessageSource',
                  'basePath' =&gt; '@common/messages',
                  'sourceLanguage' =&gt; 'en-US',
                  'fileMap' =&gt; [
                       'app' =&gt; 'app.php',
                       'app/error' =&gt; 'error.php',
                   ],
              ],
          ],
       ],
  ]
  </code></pre>
  
  <p>then I added <code>i18n.php</code> in <code>common/config:</code></p>
  
  <pre><code>&lt;?php
  return [
      'sourcePath' =&gt; __DIR__. '..' . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR,
      'languages' =&gt; ['fr-FR','en-US'], //Add languages to the array for the language files to be generated.
      'translator' =&gt; 'Yii::t',
      'sort' =&gt; false,
      'removeUnused' =&gt; false,
      'only' =&gt; ['*.php'],
      'except' =&gt; [
          '.svn',
          '.git',
          '.gitignore',
          '.gitkeep',
          '.hgignore',
          '.hgkeep',
          '/messages',
          '/vendor',
      ],
      'format' =&gt; 'php',
      'messagePath' =&gt; __DIR__ . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . 'messages',
      'overwrite' =&gt; true,
  ];
  </code></pre>
  
  <p>and the <code>common/messages/en-US/app.php:</code></p>
  
  <pre><code>&lt;?php
  
  return[
  
      // Menu texts
  
      'menu.login'=&gt;'login',
  
  ];
  </code></pre>
  
  <p>and I used it in the views as : <code>Yii::t('app', 'menu.login');</code></p>
  
  <p>but the translation didn't work, it displayed as <code>menu.login</code></p>