2017 © Pedro Peláez

yii2-extension yii2-translation

Yii2 module which provides functionality to deal with translation in a sane way.



Yii2 module which provides functionality to deal with translation in a sane way.

  • Monday, October 24, 2016
  • by jeffrey.geyssens
  • Repository
  • 1 Watchers
  • 0 Stars
  • 87 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 1 Versions
  • 0 % Grown


Yii2-Translation - README

Yii2, (*1)

Provides various interfaces to deal with routine tasks dealing with site translation management., (*2)


Yii2 Site Translation Module, (*3)

Provides interfaces to deal with: * Enable/disable application languages using database storage (GUI,CLI) * Set default application language using database storage (GUI,CLI), (*4)

Provides various flexible language selection widgets: * Inline List * Bootstrap Dropdown Button * Bootstrap Dropdown List, (*5)


This package relies on following dependecies: * Codemix Yii2 Locale Urls version 1.3.0. * Humanized PHP Locale helpers dev:master, (*6)


Install Using Composer

The preferred way to install this extension is through composer., (*7)

Either run, (*8)

$ php composer.phar require humanized/yii2-translation "*"

or add, (*9)

"humanized/yii2-translation": "*"

to the require section of your composer.json file., (*10)

Run Migrations

$ php yii migrate/up --migrationPath=@vendor/humanized/yii2-translation/migrations

Edit Configuration File

Add following lines to the configuration file:, (*11)

'modules' => [
    'translation' => [
        'class' => 'humanized\translation\Module',

Adding these lines allows access to the various interfaces provided by the module. Here, the chosen module-name is translation, as such the various routes will be available at translation/controller-id/action-id, though any module-name can be chosen., (*12)

This package contains an urlManager component which extends the urlManager component provided by the Codemix Yii2-LocaleUrls package. Here setup of the default application language and population of the enabled website languages are handled automatically. Other configuration options are inherited between components., (*13)

'components' => [
        // Languages enabled populated through database storage
        // Further configuration options available at https://github.com/codemix/yii2-localeurls 
        'urlManager' => [
            'class' => 'humanized\translation\components\UrlManager',
            'enablePrettyUrl' => true, 
            'showScriptName' => false,

Getting Started

Once configured, one or multiple languages should be enabled using the various interfaces provided by the module. To get up-and-running quickly, an example is given to enable some languages using the CLI provided by the package:, (*14)

$ php yii translation/language/enable en
$ php yii translation/language/enable fr
$ php yii translation/language/enable nl
$ php yii translation/language/set-default en 

Above mentioned lines enables the English, French and Dutch language ands sets English as the default language, (*15)

For full instructions on how to use the fully-configured module, check the USAGE-file., (*16)

The Versions

24/10 2016



Yii2 module which provides functionality to deal with translation in a sane way.

  Sources   Download


The Requires


by Jeffrey Geyssens
by François-Xavier de Saint Pern

yii2 module translation i18n internationalization gui internationalisation