mirror of
https://github.com/yiisoft/yii2.git
synced 2025-11-08 17:07:33 +08:00
Merge pull request #7799 from maxxer/explain_message_extract
Proposed documentation for i18n 'Using the message command'
This commit is contained in:
@ -481,8 +481,28 @@ If [[yii\i18n\MissingTranslationEvent::translatedMessage]] is set by the event h
|
|||||||
|
|
||||||
### Using the `message` command <a name="message-command"></a>
|
### 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
|
Views
|
||||||
-----
|
-----
|
||||||
|
|||||||
Reference in New Issue
Block a user