For the life of me, I am unable to get Yii’s translation working and I’ve followed the instructions in the documentation and forums very closely. Hope someone can enlighten me…
I just want to setup a bilingual site in Yii that is English and Chinese, so I added the following to config/main.php
'language'=>'zh_cn',
'sourceLanguage'=>'zh_cn',
Next, I created a file called dict.php under protected/messages/zh_cn/
The contents of this file is as follows:
<?php
return array(
'home'=>'Home (in chinese)',
'about'=>'About Us (in chinese)',
);
Then in my view, I have this:
<?=Yii::t('dict', 'home')?>
Which consistently displays "home" instead of "Home (in chinese)".
I have tried searching all over the forums and have tried all kinds of ways of setting this, but nothing seems to be working. Yii just is unable to display the chinese text no matter what I do.
Am I missing something? Is there an additional step I have overlooked? Help! I am really not sure what else to do at this point, I’ve followed all the instructions in the documentation but cannot get this to work. This is driving me crazy! I cannot believe such a simple concept is so difficult to execute in Yii, well at least the documentation isn’t the best regarding this.
Help me Obi-wan, you’re my only hope… well you or CodeIgniter, which I am seriously considering falling back to if Yii continues to be so difficult to work with.
Thanks!