Vince
(Vadimg88)
January 10, 2009, 12:21pm
1
i have changed the messages structure from
messages/
-he_il
to
messages/
-admin
– en_us
– he_il
-site
– en_us
– he_il
now for some reason the Yii:t method does not translate the language. But the Yii::app()->translate does work and translates. I am sure i missed some setting so the Yii:t could work.
I did set the
Yii::app()->lang->basePath = Yii::app()->getBasePath() . '/messages/admin';
and it does work just not with the Yii:t method.
Any ideas?
qiang
(Qiang Xue)
January 10, 2009, 12:27pm
2
What is Yii::app()->lang? And how did you call Yii::t()?
Vince
(Vadimg88)
January 10, 2009, 12:41pm
3
In the config file i added:
'lang' => array(
'class' => 'CPhpMessageSource',
),
and i call Yii::t( 'category' , 'message');
qiang
(Qiang Xue)
January 10, 2009, 12:58pm
4
Check YiiBase::t() signature. You need the 4th parameter to specify the message source ID since it is different from 'messages'.
Vince
(Vadimg88)
January 10, 2009, 1:11pm
5
I did try that with not luck, maybe i missing something i did the following:
Yii::t( $category, $message, $params, Yii::app()->getBasePath() . '/messages/admin');
qiang
(Qiang Xue)
January 10, 2009, 1:11pm
6
naah, the fourth parameter should be message source ID, i.e., 'lang' in your case.
Vince
(Vadimg88)
January 10, 2009, 1:13pm
7
Not sure i follow the fourth parameter should be either for example 'en_us' or 'he_il' ?
Vince
(Vadimg88)
January 10, 2009, 1:18pm
8
just typing 'lang' in the forth did the trick…but why?
qiang
(Qiang Xue)
January 10, 2009, 5:32pm
9
That's why API says: it should be the ID of the message source app component.
Vince
(Vadimg88)
January 10, 2009, 6:20pm
10
I am sure i am missing something. I never read anything about ID of a message source being 'lang' could you please explain a little more? I will appreciate that. I just don't want to move on without actually knowing why this worked like that.
qiang
(Qiang Xue)
January 10, 2009, 6:35pm
11
See this: http://www.yiiframew…c/api/YiiBase#t
You said in your config, you defined a 'lang' message source. That's the application component ID I was talking about.