|
|
@ -39,14 +39,17 @@ Later you can easily change it in runtime: |
|
|
|
Basic message translation |
|
|
|
Basic message translation |
|
|
|
------------------------- |
|
|
|
------------------------- |
|
|
|
|
|
|
|
|
|
|
|
### Strings translation |
|
|
|
Yii basic message translation in its basic variant works without additional PHP extension. What it does is finding a |
|
|
|
|
|
|
|
translation of the message from source language into targer language. Message itself is specified as the first |
|
|
|
Yii basic message translation that works without additional PHP extension. |
|
|
|
`\Yii::t` method parameter: |
|
|
|
|
|
|
|
|
|
|
|
```php |
|
|
|
```php |
|
|
|
echo \Yii::t('app', 'This is a string to translate!'); |
|
|
|
echo \Yii::t('app', 'This is a string to translate!'); |
|
|
|
``` |
|
|
|
``` |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Yii tries to load approprite translation from one of the message sources defined via `i18n` component configuration. |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
TBD: https://github.com/yiisoft/yii2/issues/930 |
|
|
|
|
|
|
|
|
|
|
|
### Named placeholders |
|
|
|
### Named placeholders |
|
|
|
|
|
|
|
|
|
|
|