futuretek/yii2-language

Yii2 language support

2.0.0 2021-06-14 11:13 UTC

This package is auto-updated.

Last update: 2024-04-14 17:55:57 UTC


README

Usage

Data

Database will be populated via migration automatically.

Model

Use model futuretek\language\models\Language wherever you want

Language selector

Language selector can be used in any view. Language will be automatically switched in Yii application and saved into cookie.

There are two selectors available:

  • LanguageSelector::dropDown() - display drop-down with all enabled languages
  • LanguageSelector::flagList() - display list of all enabled language flags

Administration

Extension add very simple language list page with activate/deactivate option.

To include the page into your controller you have to add it to actions() method.

class LanguageController extends Controller
{
    public function actions()
    {
        return [
            'index' => 'futuretek\language\IndexAction',
        ];
    }
}

Development

Assets are managed by Compass

  • While developing run compass watch in extension root directory
  • To compile assets for final distribution run compass compile -e production --force in extension root directory