Activating translations for Yii core messages

The excellent Yii framework makes it easy to jumpstart development and quickly create a working prototype. It also includes flexible translation features. But the official documentation for internationalization isn't all that clear on how to activate the translations for the Yii core messages. A lot of translations are included in the default download.

Turns out that you have to define both the source language and the target language. The default source language is english, but it only seems to work if you define it explicitly.

To activate translations for your entire app, change "protected/config/main.php" accordingly:


return array(
  …
  'language' => 'de',
  …
  'components'=>array(
    …
    'coreMessages' => 'en',
    …
  ),
  …
);