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?

[/b]

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.

Thanks…

Read this:

http://www.yiiframework.com/doc/cookbook/26/

http://www.yiiframework.com/doc/cookbook/59/ (language and sourceLanguage properties)

You can store messages in files or database.

Read this again: http://www.yiiframework.com/doc/guide/ru/topics.i18n

If you prefer database: http://www.yiiframework.com/doc/api/CDbMessageSource

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

(

    id INTEGER PRIMARY KEY,

    category VARCHAR(32),

    message TEXT

);

CREATE TABLE Message

(

    id INTEGER,

    language VARCHAR(16),

    translation TEXT,

    PRIMARY KEY (id, language),

    CONSTRAINT FK_Message_SourceMessage FOREIGN KEY (id)

         REFERENCES SourceMessage (id) ON DELETE CASCADE ON UPDATE RESTRICT

);

these tables are empty

2.I created models of these tables using gii

  1. added changes to main.php



'components'=>array(

 ...   

         'messages' => array(

          'class' => 'CDbMessageSource',

          // config for db message source here, see http://www.yiiframework.com/doc/api/CDbMessageSource

          ),

          

         'coreMessages' => array(

          'class' => 'CDbMessageSource',

          // config for db message source here, see http://www.yiiframework.com/doc/api/CDbMessageSource

          ),

...

)

          

 

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 ?