Browse Source

better wording

tags/2.0.0-beta
Alexander Makarov 11 years ago
parent
commit
fb684774db
  1. 11
      docs/guide/i18n.md

11
docs/guide/i18n.md

@ -41,7 +41,11 @@ Basic message translation
### Strings 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 ### Named placeholders
@ -60,9 +64,8 @@ $sum = 42;
echo \Yii::t('app', 'Balance: {0}', $sum); 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 > **Tip**: Try keep message strings meaningful and avoid using too many positional parameters. Remember that
> "Balance: {0}". It's not recommended to use positional placeholders except when there's only one and message context is > translator has source string only so it should be obvious about what will replace each placeholder.
> clear as above.
Advanced placeholder formatting Advanced placeholder formatting
------------------------------- -------------------------------

Loading…
Cancel
Save