-
Notifications
You must be signed in to change notification settings - Fork 3
/
Messenger.php
49 lines (39 loc) · 949 Bytes
/
Messenger.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
<?php
namespace nanson\messenger;
use Yii;
use yii\base\Module;
/**
* Class Messenger
* @package nanson\messenger
* @author Chernyavsky Denis <panopticum87@gmail.com>
*/
class Messenger extends Module
{
const MODULE = 'messenger';
/**
* @var string User class
*/
public $userClass;
/**
* @inheritdoc
*/
public function init()
{
if (is_null($this->userClass)) {
$this->userClass = Yii::$app->user->identityClass;
}
$this->registerTranslations();
return parent::init();
}
public function registerTranslations()
{
Yii::$app->i18n->translations['messenger/*'] = [
'class' => 'yii\i18n\PhpMessageSource',
'sourceLanguage' => 'en-US',
'basePath' => '@vendor/nanson/yii2-messenger/messages',
'fileMap' => [
'messenger/app' => 'app.php',
],
];
}
}