Yii Multilangual App, Not I18N Thing...


I googled for "Yii multilangual" topics, but I realized that my case may not be i18n thing… or correct me. What I need in my application to be translated are:

  • models attribute labels (values stored in [Model].php files)

  • values in dropdown lists (values strored in database) - not shown here

  • some other strings stored in php files (breadcrumbs labels, actions labels, some plain text)

  • buttons’ labels (“create”, “save” in English, I need button labels in other languages).

How would you recommend me making my app 2 languages? EN/PL

When using CPhpMessageSource you can split your message files into different files:

For example:

protected/messages/pl/ labels.php and app.php

In the labels.php you add all the stuff for translating models (labels…), for example:

 public function attributeLabels() {

    return array(




If you want, you can create an extra messagefile for each model (contact.php,user.php,product.php …) instead of one labels.php

All other stuff you can add to the app.php and call



If you find a translation in the yii or zii core (see framework/messages/pl zii.php or yii.php) you can use this:


It depends on you how many different messagesfiles you want to handle.