registerTranslations(); } public function registerTranslations() { Yii::$app->i18n->translations['user*'] = [ 'class' => PhpMessageSource::class, 'sourceLanguage' => 'ru-RU', 'basePath' => '@backend/modules/user/messages', 'fileMap' => [ 'user' => 'user.php', ], ]; } public static function t($category, $message, $params = [], $language = null): string { return Yii::t('user' . $category, $message, $params, $language); } public function bootstrap($app) { if ($app instanceof Application) { $app->getUrlManager()->addRules([ ['class' => 'yii\web\UrlRule', 'pattern' => $this->id, 'route' => $this->id . '/default/index'], ['class' => 'yii\web\UrlRule', 'pattern' => $this->id . '', 'route' => $this->id . '/default/view'], ['class' => 'yii\web\UrlRule', 'pattern' => $this->id . '/', 'route' => $this->id . '//'], ], false); } } }