1 | <?php |
||
2 | namespace graychen\yii2\basic\auth; |
||
3 | |||
4 | use yii\base\Module as BaseModule; |
||
5 | |||
6 | /** |
||
7 | * portal module definition class |
||
8 | */ |
||
9 | class Module extends BaseModule |
||
10 | { |
||
11 | /** |
||
12 | * @inheritdoc |
||
13 | */ |
||
14 | public $controllerNamespace = 'graychen/yii2/basic/auth/controllers'; |
||
15 | /** |
||
16 | * |
||
17 | * @var string source language for translation |
||
18 | */ |
||
19 | public $sourceLanguage = 'en-US'; |
||
20 | /** |
||
21 | * @inheritdoc |
||
22 | */ |
||
23 | public function init() |
||
24 | { |
||
25 | parent::init(); |
||
26 | $this->registerTranslations(); |
||
27 | } |
||
28 | /** |
||
29 | * Registers the translation files |
||
30 | */ |
||
31 | protected function registerTranslations() |
||
32 | { |
||
33 | Yii::$app->i18n->translations['graychen/yii2/basic/auth/*'] = [ |
||
34 | 'class' => 'yii\i18n\PhpMessageSource', |
||
35 | 'sourceLanguage' => $this->sourceLanguage, |
||
36 | 'basePath' => '@graychen/yii2/basic/auth/messages', |
||
37 | 'fileMap' => [ |
||
38 | 'graychen/yii2/basic/auth/app.php' => 'app.php', |
||
39 | ], |
||
40 | ]; |
||
41 | } |
||
42 | /** |
||
43 | * Translates a message. This is just a wrapper of Yii::t |
||
44 | * |
||
45 | * @see Yii::t |
||
46 | * |
||
47 | * @param $category |
||
48 | * @param $message |
||
49 | * @param array $params |
||
50 | * @param null $language |
||
0 ignored issues
–
show
Documentation
Bug
introduced
by
![]() |
|||
51 | * @return string |
||
52 | */ |
||
53 | public static function t($category, $message, $params = [], $language = null) |
||
54 | { |
||
55 | return Yii::t('graychen/yii2/basic/auth/' . $category, $message, $params, $language); |
||
56 | } |
||
57 | } |
||
58 |