-
Notifications
You must be signed in to change notification settings - Fork 0
/
Module.php
48 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
<?php
namespace andrylik\settings;
use Yii;
use yii\base\InvalidConfigException;
/**
* settings module definition class
*/
class Module extends \yii\base\Module
{
/**
* {@inheritdoc}
*/
public $controllerNamespace = 'andrylik\settings\controllers';
/**
* {@inheritdoc}
*/
public function init()
{
parent::init();
Yii::$app->i18n->translations['andrylik.settings'] = [
'class' => 'yii\i18n\PhpMessageSource',
'forceTranslation' => true,
'basePath' => '@andrylik/settings/messages',
];
if (self::isTranslatable() && Yii::$app->params['defaultLanguage'] === null) {
throw new InvalidConfigException("The 'defaultLanguage' property must be set - For Advanced Application file /common/config/params.php");
}
}
/**
* Check languages to translate
*
* @return bool
*/
public static function isTranslatable(){
if (isset(Yii::$app->params['languages']) && count(Yii::$app->params['languages']) > 1){
return true;
}
else{
return false;
}
}
}