Yii languageSelector
A simple Yii language selector extension
Demo
http://leonard.shtika.info/sandbox/
How to install
-
Copy languageSelector folder to the extensions folder (protected/extensions/)
-
Populate the 'params' attribute in the config file (protected/config/main.php) with an array of code/language pairs
'params'=>array(
'availableLanguages' => array(
'el'=>'Ελληνικά',
'en'=>'English',
'it'=>'Italiano',
'sq'=>'Shqip',
),
),
- Overwrite the init() method in your main controller class (protected/components/Controller.php)
public function init()
{
Yii::import('ext.languageSelector.LsWidget');
LsWidget::loadLanguage();
parent::init();
}
- Add this line to your view file where you want to render languageSelector widget
<?php $this->widget('ext.languageSelector.LsWidget'); ?>