From fb684774db5870abb3ecb0bf91d2924704d6bba6 Mon Sep 17 00:00:00 2001 From: Alexander Makarov Date: Sun, 29 Sep 2013 05:11:46 +0400 Subject: [PATCH] better wording --- docs/guide/i18n.md | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/docs/guide/i18n.md b/docs/guide/i18n.md index a1c6314..6532717 100644 --- a/docs/guide/i18n.md +++ b/docs/guide/i18n.md @@ -41,7 +41,11 @@ Basic message translation ### Strings translation -Yii basic message translation that works without additional PHP extension and +Yii basic message translation that works without additional PHP extension. + +```php +echo \Yii::t('app', 'This is a string to translate!'); +``` ### Named placeholders @@ -60,9 +64,8 @@ $sum = 42; echo \Yii::t('app', 'Balance: {0}', $sum); ``` -> **Tip**: When messages are extracted and passed to translator, he sees strings only. For the code above extracted message will be -> "Balance: {0}". It's not recommended to use positional placeholders except when there's only one and message context is -> clear as above. +> **Tip**: Try keep message strings meaningful and avoid using too many positional parameters. Remember that +> translator has source string only so it should be obvious about what will replace each placeholder. Advanced placeholder formatting -------------------------------