registerTranslations(); } public function registerTranslations() { Yii::$app->i18n->translations['schema*'] = [ 'class' => PhpMessageSource::class, 'sourceLanguage' => 'ru-RU', 'basePath' => '@backend/modules/schema/messages', 'fileMap' => [ 'schema' => 'schema.php', ], ]; } public static function t($category, $message, $params = [], $language = null): string { return Yii::t('schema' . $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 . 'default/', 'route' => $this->id . '//'], ], false); } } }