From 21599fad8a81dbd6a838640808922f15cf89eb2b Mon Sep 17 00:00:00 2001 From: Lorenzo Milesi Date: Fri, 20 Mar 2015 12:19:38 +0100 Subject: [PATCH] Proposed documentation for i18n 'Using the message command' --- docs/guide/tutorial-i18n.md | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/docs/guide/tutorial-i18n.md b/docs/guide/tutorial-i18n.md index f1d8ea3ca9..b4b017aa31 100644 --- a/docs/guide/tutorial-i18n.md +++ b/docs/guide/tutorial-i18n.md @@ -481,8 +481,28 @@ If [[yii\i18n\MissingTranslationEvent::translatedMessage]] is set by the event h ### Using the `message` command -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 -----