-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathModule.php
55 lines (48 loc) · 1.09 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
51
52
53
54
55
<?php
/**
* @link https://github.com/borodulin/yii2-oauth2-server
* @copyright Copyright (c) 2015 Andrey Borodulin
* @license https://github.com/borodulin/yii2-oauth2-server/blob/master/LICENSE
*/
namespace yuncms\oauth2;
use Yii;
/**
* @author Andrey Borodulin
*/
class Module extends \yii\base\Module
{
public $behaviors;
/**
* @inheritdoc
*/
public function init()
{
parent::init();
$this->registerTranslations();
}
/**
* @inheritdoc
*/
public function behaviors()
{
if (!empty($this->behaviors)) {
return $this->behaviors;
} else {
return parent::behaviors();
}
}
/**
* 注册语言包
* @return void
*/
public function registerTranslations()
{
if (!isset(Yii::$app->i18n->translations['oauth2*'])) {
Yii::$app->i18n->translations['oauth2*'] = [
'class' => 'yii\i18n\PhpMessageSource',
'sourceLanguage' => 'en-US',
'basePath' => __DIR__ . '/messages',
];
}
}
}