Asking about I18n

Hi sirs…

I just started to create a multilingual website.

I’ve read the manual or Yii Cookbook, but I was still difficult to understand.

how do I start setting the language? configuration may have to be done in config / main.php or what? explanation please … because I do not know what the items listed in the configuration

[b]and where a place to store files that contain messages that are called to display the language selected in accordance with the user?


please make a simple example is to be understandable for new users who do not know like me: D

I hope anyone would help me here.


Read this: (language and sourceLanguage properties)

You can store messages in files or database.

Read this again:

If you prefer database:

After you’ll read everything, you can use Yii::t() function :)

Oh… thank you so much mr andy_s. I feel shame because too often asking :unsure:

but thank you very much :)

Hello everybody!

I’ve started to learn Yii, I have a question concerning internationalisation,

First I enabled i18n so it worked with CPhpMessageSource as source and it worked fine, now I would like to use use CDbMessageSource as source, what I did already:

1.I’ve created empty tables

CREATE TABLE SourceMessage



    category VARCHAR(32),

    message TEXT




    id INTEGER,

    language VARCHAR(16),

    translation TEXT,

    PRIMARY KEY (id, language),

    CONSTRAINT FK_Message_SourceMessage FOREIGN KEY (id)



these tables are empty

2.I created models of these tables using gii

  1. added changes to main.php



         'messages' => array(

          'class' => 'CDbMessageSource',

          // config for db message source here, see



         'coreMessages' => array(

          'class' => 'CDbMessageSource',

          // config for db message source here, see






my language options are:

    'sourceLanguage' => 'en_US',

    'language' => 'ru',

after it I’ve tried to open blog page where I have breadcrumbs and I get this:

Fatal error: Allowed memory size of 134217728 bytes exhausted (tried to allocate 76 bytes) in /mnt/md1/home/dima/public_html/yii/framework/YiiBase.php on line 461

I tried to increase memory_limit up to 512Mb but it did not help. Could somebody tell me where the prob is ?

when I switch back to CPhpMessageSource as source then it works ok.

any ideas ?