0

It seems Yii::t can't work with variables. I was wondering is there any solution or workaround to do something like this:

foreach ($dicts as $dict) {
    echo Yii::t($dict,$someRandomWord);
}
Foreever
  • 7,099
  • 8
  • 53
  • 55

1 Answers1

1

Tested it right now. It works fine! I promise, your locales or your $category is unknown/notset. Is your message file ok?

Check this: http://www.yiiframework.com/wiki/243/how-to-translate-and-do-the-translations-the-easy-way/#hh1

 //current language is turkey, system language is english
 $category = 'app';
 $message = 'english';

 echo Yii::t($category, $message);
 //İngilizce
lin
  • 17,956
  • 4
  • 59
  • 83