public function bootstrap($app)
    {
        Yii::setAlias('@wavecms', '@vendor/mrstroz/yii2-wavecms');

        if ($app->id === 'app-backend' || $app->id === 'app-frontend') {

            /** Set extra aliases required in Wavecms with shared hostings*/
            Yii::setAlias('@frontWeb',
                str_replace('/admin', '', Yii::getAlias('@web'))
            );
            Yii::setAlias('@frontWebroot',
                str_replace('/public/admin', '/public', Yii::getAlias('@webroot'))
            );

        }

        /** Set backend language based on user lang (Must be done before define translations */
        if ($app->id === 'app-backend') {
            if (!Yii::$app->user->isGuest) {
                Yii::$app->language = Yii::$app->user->identity->lang;
            }
        }

        $this->initTranslations();

        /** @var Module $module */
        if ($app->hasModule('wavecms') && ($module = $app->getModule('wavecms')) instanceof Module) {

            if ($app instanceof ConsoleApplication) {
                $module->controllerNamespace = 'mrstroz\wavecms\commands';
            } else {
                $module->controllerNamespace = 'mrstroz\wavecms\controllers';

                if ($app->id === 'app-backend') {

                    /** @var string errorAction Set error action */
                    Yii::$app->errorHandler->errorAction = $module->errorAction;

                    /** Set required components */
                    $app->set('wavecms', [
                        'class' => 'mrstroz\wavecms\WavecmsComponent',
                        'languages' => $module->languages
                    ]);

                    $app->set('cacheFrontend', [
                        'class' => 'yii\caching\FileCache',
                        'cachePath' => Yii::getAlias('@frontend') . '/runtime/cache'
                    ]);

                    $app->set('settings', [
                        'class' => 'yii2mod\settings\components\Settings',
                    ]);

                    Yii::$app->assetManager->appendTimestamp = true;

                    Yii::$app->i18n->translations['yii2mod.settings'] = [
                        'class' => 'yii\i18n\PhpMessageSource',
                        'basePath' => '@yii2mod/settings/messages'
                    ];

                    $this->initContainer($module);
                    $this->initLanguages();
                    $this->initParams();
                    $this->initRoutes($app, $module);
                    $this->initNavigation();
                }
            }
        }
    }