dev-master
9999999-devInternationalize your urls
MIT
The Requires
by Aris Karageorgos
yii2 url i18n manager
Internationalize your urls
Internationalize your urls, (*1)
The preferred way to install this extension is through composer., (*2)
Either run, (*3)
php composer.phar require --prefer-dist pheme/yii2-i18n-url "dev-master"
or add, (*4)
"pheme/yii2-i18n-url": "dev-master"
to the require section of your composer.json
file., (*5)
In your configuration file, add or replace your UrlManager component:, (*6)
'components' => [ 'urlManager' => [ 'class' => 'pheme\i18n\I18nUrlManager', //'displaySourceLanguage' => true, //'rewriteBaseUrl' => true, //'languageParam' => 'lang', 'languages' => ['en', 'gr'], 'aliases' => [], // 'aliases' => ['en' => 'en-US', 'sr' => 'sr-Latn'], // The keys will become labels on the language switcher widget // 'languages' => ['English' => 'en', 'Ελληνικά' => 'gr'] 'enablePrettyUrl' => true, 'showScriptName' => false, 'rules' => [], ], ... ]
Example of changing the language, (*7)
<?= Html::a('Ελληνικά', ['site/index', 'lang' => 'gr']); ?>
Example of using the language switcher, (*8)
<?= pheme\i18n\widgets\LanguageSwitcher::widget(); ?>
Internationalize your urls
MIT
yii2 url i18n manager