Commit fb684774 by Alexander Makarov

better wording

parent b45b16d8
...@@ -41,7 +41,11 @@ Basic message translation ...@@ -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; ...@@ -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
------------------------------- -------------------------------
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment