2017 © Pedro Peláez
 

yii2-extension yii2-i18n-url

Internationalize your urls

image

pheme/yii2-i18n-url

Internationalize your urls

  • Thursday, December 10, 2015
  • by pheme
  • Repository
  • 5 Watchers
  • 13 Stars
  • 4,080 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 8 Forks
  • 0 Open issues
  • 1 Versions
  • 0 % Grown

The README.md

Yii2 i18n URL Manager

Internationalize your urls, (*1)

Installation

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)

Usage

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(); ?>

The Versions

10/12 2015

dev-master

9999999-dev

Internationalize your urls

  Sources   Download

MIT

The Requires

 

by Aris Karageorgos

yii2 url i18n manager