Skip to content

Commit 5b4539e

Browse files
committed
Merge pull request #5 from su-xiaolin/master
Add chinses translation and make hard code i18n support could be repl…
2 parents cdf5827 + 72befa6 commit 5b4539e

File tree

2 files changed

+38
-8
lines changed

2 files changed

+38
-8
lines changed

Widget.php

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -107,14 +107,16 @@ public function init()
107107
*/
108108
public function registerTranslations()
109109
{
110-
Yii::$app->i18n->translations['mickgeek/actionbar/*'] = [
111-
'class' => PhpMessageSource::className(),
112-
'sourceLanguage' => 'en-US',
113-
'basePath' => '@mickgeek/actionbar/messages',
114-
'fileMap' => [
115-
'mickgeek/actionbar/widget' => 'widget.php',
116-
],
117-
];
110+
if (!isset(Yii::$app->i18n->translations['mickgeek/actionbar/*'])) {
111+
Yii::$app->i18n->translations['mickgeek/actionbar/*'] = [
112+
'class' => PhpMessageSource::className(),
113+
'sourceLanguage' => 'en-US',
114+
'basePath' => '@mickgeek/actionbar/messages',
115+
'fileMap' => [
116+
'mickgeek/actionbar/widget' => 'widget.php',
117+
],
118+
];
119+
}
118120
}
119121

120122
/**

messages/zh-CN/widget.php

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
<?php
2+
/**
3+
* Message translations.
4+
*
5+
* This file is automatically generated by 'yii message' command.
6+
* It contains the localizable messages extracted from source code.
7+
* You may modify this file by translating the extracted messages.
8+
*
9+
* Each array element represents the translation (value) of a message (key).
10+
* If the value is empty, the message is considered as not translated.
11+
* Messages that no longer need translation will have their translations
12+
* enclosed between a pair of '@@' marks.
13+
*
14+
* Message string can be used with plural forms format. Check i18n section
15+
* of the guide for details.
16+
*
17+
* NOTE: this file must be saved in UTF-8 encoding.
18+
*
19+
* @suxiaolin <[email protected]>
20+
*/
21+
return [
22+
'Bulk Actions' => '批量操作',
23+
'Please select one or more items from the list.' => '至少选择一项。',
24+
'General' => '常规',
25+
'Delete' => '删除',
26+
'Are you sure you want to delete these items?' => '确认删除?',
27+
'Create New' => '新增',
28+
];

0 commit comments

Comments
 (0)