/
Bootstrap.php
33 lines (26 loc) · 977 Bytes
/
Bootstrap.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
<?php
namespace jarrus90\Core;
use Yii;
use yii\i18n\PhpMessageSource;
use yii\base\BootstrapInterface;
use yii\console\Application as ConsoleApplication;
/**
* Bootstrap class registers module and user application component. It also creates some url rules which will be applied
* when UrlManager.enablePrettyUrl is enabled.
*/
class Bootstrap implements BootstrapInterface {
/** @inheritdoc */
public function bootstrap($app) {
/** @var Module $module */
/** @var \yii\db\ActiveRecord $modelName */
if ($app->hasModule('core') && ($module = $app->getModule('core')) instanceof Module) {
if (!isset($app->get('i18n')->translations['core*'])) {
$app->get('i18n')->translations['core*'] = [
'class' => PhpMessageSource::className(),
'basePath' => __DIR__ . '/messages',
'sourceLanguage' => 'en-US'
];
}
}
}
}