Browse Source

Proposed documentation for i18n 'Using the message command'

tags/2.0.4
Lorenzo Milesi 10 years ago
parent
commit
21599fad8a
  1. 22
      docs/guide/tutorial-i18n.md

22
docs/guide/tutorial-i18n.md

@ -481,8 +481,28 @@ If [[yii\i18n\MissingTranslationEvent::translatedMessage]] is set by the event h
### Using the `message` command <a name="message-command"></a>
TDB
Translations can be stored in [[yii\i18n\PhpMessageSource|php files]], [[yii\i18n\GettextMessageSource|.po files] or to [[yii\i18n\DbMessageSource|database]]. See specific classes for additional options.
First of all you need to create a config file. Decide where you want to store it and then issue the command
```bash
./yii message/config path/to/config.php
```
Open the created file and adjust the parameters to fit your needs. Pay special attention to:
* `languages`: an array representing what languages your app should be translated to;
* `messagePath`: path where to store message files, which should match the `i18n`'s `basePath` parameter stated in config.
> Note that aliases are not supported here, they must be real path relative to the config file location
Once you're done with the config file you can finally extract your messages with the command
```bash
./yii message path/to/config.php
```
You will then find your files (if you've choosen file based translations) in your `messagePath` directory.
Views
-----

Loading…
Cancel
Save