mirror of
https://github.com/yiisoft/yii2.git
synced 2025-08-19 01:34:44 +08:00
fixed docs
This commit is contained in:
@ -304,25 +304,14 @@ This translation should be marked with `*`. In order to do it add the following
|
|||||||
],
|
],
|
||||||
```
|
```
|
||||||
|
|
||||||
After that you can start using your categories without specifying them in i18n translations. This is more familiar as for Yii1. Now you can create
|
Now you can use categories without configuring each one that is similar to Yii 1.1 behavior.
|
||||||
files under default translation `basePath` and simply use them as usual, for example:
|
Messages for the category will be loaded from a file under default translation `basePath` that is `@app/messages`:
|
||||||
|
|
||||||
* Create your category file under messages `basePath`, according default translation. Since we are not overriding `basePath` property of
|
|
||||||
[`PhpMessageSource`](https://github.com/yiisoft/yii2/blob/master/framework/i18n/PhpMessageSource.php#L40) it would be `@app/messages`.
|
|
||||||
|
|
||||||
```php
|
```php
|
||||||
# not_specified_category.php file under @app/messages directory.
|
echo Yii::t('not_specified_category', 'message from unspecified category');
|
||||||
|
|
||||||
return [
|
|
||||||
'message from not specified category' => 'сообщение из неуказанной категории',
|
|
||||||
];
|
|
||||||
```
|
```
|
||||||
|
|
||||||
* Use your category as before.
|
Message will be loaded from `@app/messages/<LanguageCode>/not_specified_category.php`.
|
||||||
|
|
||||||
```php
|
|
||||||
echo Yii::t('not_specified_category','message from not specified category');
|
|
||||||
```
|
|
||||||
|
|
||||||
###Translating module messages
|
###Translating module messages
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user