3

I installed the yii-web-start extension, it uses a database for message translation, but I need use gettext instead.

Where and how can I configure YII-i18n?

k to the z
  • 3,217
  • 2
  • 27
  • 41
Mohammad Ali Akbari
  • 10,345
  • 11
  • 44
  • 62

1 Answers1

5

You can set up i18n in your config (protected/config/main.php) with CGettextMessageSource to use gettext.

'components' => array(
    'messages' => array(
        'class' => 'CGettextMessageSource'
     )
 ),

By default, you should store your .po-files under protected/messages.

Javache
  • 3,398
  • 3
  • 21
  • 25
  • 1
    What is the naming convention for the po files? Directory structure? – Nathan H Nov 13 '12 at 11:52
  • @NathanH see http://stackoverflow.com/a/26947408/2482457 Excerpt from [CGettextMessageSource](http://www.yiiframework.com/doc/api/1.1/CGettextMessageSource): All translations are saved under the basePath directory. Translations in one language are kept as MO or PO files under an individual subdirectory whose name is the language ID. The file name is specified via catalog property, which defaults to 'messages'. – Maug Lee Nov 15 '14 at 15:34