Skip to content

leoshtika/yii-language-selector

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Yii languageSelector

A simple Yii language selector extension

Demo

http://leonard.shtika.info/sandbox/

How to install

  1. Copy languageSelector folder to the extensions folder (protected/extensions/)

  2. 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', 
    ),
),
  1. 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();
}
  1. Add this line to your view file where you want to render languageSelector widget
<?php $this->widget('ext.languageSelector.LsWidget'); ?>