Yii Framework Forum: Internationalization - CDbMessageSource - Yii Framework Forum

Jump to content

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

Internationalization - CDbMessageSource How do I tell Yii to use CDbMessageSource ? Rate Topic: -----

#1 User is offline   DanielCarrera 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 83
  • Joined: 11-January 09
  • Location:Earth

Posted 14 April 2010 - 07:25 AM

Hello,

I want to have translations of my website but I can't figure out how to tell Yii to use the database as the message source.

I have read the documentation as best I can:

http://www.yiiframew...ide/topics.i18n
http://www.yiiframew...DbMessageSource

I have created the tables in the database. I have a sample string in the category 'UI' and a translation to language 'es'. I have edited config/main.php with:

<?php
	'sourceLanguage' => 'en',
	'language' => 'es',


I have a view with a sample string to translate: <?= Yii::t('UI', 'foo') ?>

But I can't figure out how to tell Yii to use the database (CDbMessageSource) instead of the default CPhpMessageSource.

Can anyone help me?

Any help would be really appreciated.
0

#2 User is offline   Y!! 

  • Advanced Member
  • Yii
  • Group: Yii Dev Team
  • Posts: 978
  • Joined: 18-June 09

Posted 14 April 2010 - 07:30 AM

'components' => array(
   'messages' => array(
      'class' => 'CDbMessageSource',
      // config for db message source here, see http://www.yiiframework.com/doc/api/CDbMessageSource
   ),
),

1

#3 User is offline   DanielCarrera 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 83
  • Joined: 11-January 09
  • Location:Earth

Posted 14 April 2010 - 07:53 AM

Thanks!
0

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users