Normalize TranslationBootstrap (#53)

This commit is contained in:
Anton 2022-10-12 09:24:59 +03:00 committed by GitHub
parent bd8ed65e7e
commit 9e944cd085
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1,25 +1,29 @@
<?php <?php
/** /**
* @package yii2-bootstrap5 * @link https://www.yiiframework.com/
* @author Simon Karlen <simi.albi@gmail.com> * @copyright Copyright (c) 2008 Yii Software LLC
* @license https://www.yiiframework.com/license/
*/ */
namespace yii\bootstrap5\i18n; namespace yii\bootstrap5\i18n;
use yii\base\Application; use yii\base\BootstrapInterface;
use yii\i18n\GettextMessageSource;
/** /**
* This bootstrap implementation is used to add translations automatically to app configuration * This bootstrap implementation is used to add translations automatically to application configuration.
*
* @author Simon Karlen <simi.albi@gmail.com>
*/ */
class TranslationBootstrap implements \yii\base\BootstrapInterface class TranslationBootstrap implements BootstrapInterface
{ {
/** /**
* {@inheritDoc} * @inheritDoc
*/ */
public function bootstrap($app) public function bootstrap($app)
{ {
$app->i18n->translations['yii/bootstrap5*'] = [ $app->getI18n()->translations['yii/bootstrap5'] = [
'class' => '\yii\i18n\GettextMessageSource', 'class' => GettextMessageSource::class,
'sourceLanguage' => 'en-US', 'sourceLanguage' => 'en-US',
'basePath' => '@yii/bootstrap5/messages' 'basePath' => '@yii/bootstrap5/messages'
]; ];