-
Notifications
You must be signed in to change notification settings - Fork 2
/
Module.php
50 lines (42 loc) · 1.13 KB
/
Module.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
<?php
namespace fgh151\modules\params;
use Yii;
use yii\base\Module as BaseModule;
/**
* Class Module
* @package fgh151\modules\params
*/
class Module extends BaseModule
{
public $defaultRoute = 'main';
public $controllerNamespace = 'fgh151\modules\params\controllers';
public $paramsFilePath = [];
public function init()
{
parent::init();
$this->registerTranslations();
}
protected function registerTranslations()
{
Yii::$app->i18n->translations['params/*'] = [
'class' => 'yii\i18n\PhpMessageSource',
'sourceLanguage' => 'en-US',
'basePath' => '@app/modules/params/messages',
'fileMap' => [
'params/system' => 'system.php',
'params/app' => 'app.php'
],
];
}
/**
* @param $category
* @param $message
* @param array $params
* @param null $language
* @return string
*/
public static function t($category, $message, $params = [], $language = null)
{
return Yii::t('params/' . $category, $message, $params, $language);
}
}