Multiple message source for I18n

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!

You need to specify 4-param for Yii::t() function (check the signature), and then configurate provider for you messages:


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 :)

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.