Skip to content

Commit 31a6f7d

Browse files
committed
validate i18n
1 parent c0c2135 commit 31a6f7d

File tree

5 files changed

+26
-70
lines changed

5 files changed

+26
-70
lines changed

.idea/yii2-api-template.iml

Lines changed: 1 addition & 68 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

README.md

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,4 +122,11 @@ The i18n configuration file is located at ```<ProjectRoot>/messages/config-messa
122122

123123
To extract your app messages you can do so using the [message command](https://www.yiiframework.com/doc/guide/2.0/en/tutorial-i18n#using-the-message-command).
124124

125-
```./yii message messages/config-messages.php```
125+
```./yii message messages/config-messages.php```
126+
127+
To scan the tree 'sourcePath' to generate files default for labels used in the code execute the follow command
128+
```./yii message/extract @app/config/i18n.php ```
129+
130+
To change target lenguage for example to spanish use
131+
```Yii::$app->language = 'es';```
132+

common/components/base/rest/ActiveController.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ public function actionStatus()
4242
{
4343
$version = `git log -1 --pretty=%h`;
4444
$version = str_replace(array("\r", "\n"), '', $version);
45-
return ['status' => 'online', 'version' => $version];
45+
return ['status' => Yii::t('api', 'online'), 'version' => $version];
4646
}
4747

4848

messages/en/api.php

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
<?php
2+
3+
/**
4+
* Translation api for es
5+
*/
6+
return [
7+
'online' => 'Online'
8+
];

messages/es/api.php

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
<?php
2+
3+
/**
4+
* Translation api for es
5+
*/
6+
return [
7+
'online' => 'En linea'
8+
];

0 commit comments

Comments
 (0)