I was wondering if its possible to have multiple message source for the translation. I want to have my menu translate using CDbMessageSource, and the rest using CGettextMessageSource.
From what I read, we can only specify one source in the configuration.
Thank you!
Page 1 of 1
Multiple message source for I18n
#2
Posted 02 March 2010 - 09:17 AM
You need to specify 4-param for Yii::t() function (check the signature), and then configurate provider for you messages:
in config:
Yii::t('menu',"My first Menu Item",array(),"menuMessages");
in config:
'menuMessages' => array( 'class' => 'CDbMessageSource', ... ),
-
-
Thanks, you make me stronger!
-Thanks, you make me stronger!
#3
Posted 02 March 2010 - 09:35 AM
vamp, on 02 March 2010 - 09:17 AM, said:
You need to specify 4-param for Yii::t() function (check the signature), and then configurate provider for you messages:
in config:
Yii::t('menu',"My first Menu Item",array(),"menuMessages");
in config:
'menuMessages' => array( 'class' => 'CDbMessageSource', ... ),
Thank you, it works perfectly. I think I tried it and I got a bug, so I thought it couldn't work like that. I should have investigate more
#4
Posted 02 March 2010 - 09:43 AM
Francois Allard, on 02 March 2010 - 09:35 AM, said:
Thank you, it works perfectly. I think I tried it and I got a bug, so I thought it couldn't work like that. I should have investigate more 
You didn't create following tables:
SourceMessage id category message Message id language translation
-
-
Thanks, you make me stronger!
-Thanks, you make me stronger!
#5
Posted 02 March 2010 - 10:00 AM
vamp, on 02 March 2010 - 09:43 AM, said:
You didn't create following tables:
SourceMessage id category message Message id language translation
No, that wasn't the problem. The translation from the database was working. I was getting an error when entering the source parameter in Yii::t(), but now it works
Edit: Oh, I remember what I did. When I put the source parameter in t(), I forgot to put the array parameter just before it.
Share this topic:
Page 1 of 1

Help













