Question

How can I create a multilanguage active record in the Yii framework? So in my CRUD -> create / update, I can enter e.g. the title in english and dutch

Was it helpful?

Solution

Take a look at internationalization:

http://www.yiiframework.com/doc/guide/1.1/en/topics.i18n

By setting the language parameter in the config file you specify what language to use. Echo your content with

Yii::t('langfile','message to translate');

For translations from the database look at:

http://www.yiiframework.com/doc/api/1.1/CDbMessageSource

Once you have everything in place. You can create CRUD operations for the translations just like you could for other any other database table.

Tutorials/More info:

http://www.pintarprogramming.com/23/Yii-internationalization

http://learnyii.blogspot.nl/2010/12/yii-setting-up-internationalization.html

OTHER TIPS

In the end I used this class: http://www.yiiframework.com/extension/multilingual-behavior/

And the CDbMessageSource solution

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top