PHPackages                             sjaakp/yii2-polyglot - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Localization &amp; i18n](/categories/localization)
4. /
5. sjaakp/yii2-polyglot

ActiveYii2-extension[Localization &amp; i18n](/categories/localization)

sjaakp/yii2-polyglot
====================

Ultralight language chooser for the Yii 2.0 framework

1.0.2(1y ago)4246MITPHPPHP &gt;=7.0.0

Since Apr 21Pushed 1y ago2 watchersCompare

[ Source](https://github.com/sjaakp/yii2-polyglot)[ Packagist](https://packagist.org/packages/sjaakp/yii2-polyglot)[ RSS](/packages/sjaakp-yii2-polyglot/feed)WikiDiscussions master Synced 1w ago

READMEChangelog (2)Dependencies (1)Versions (4)Used By (0)

yii2-polyglot
=============

[](#yii2-polyglot)

#### Ultralight language chooser for Yii2

[](#ultralight-language-chooser-for-yii2)

[![Latest Stable Version](https://camo.githubusercontent.com/6a06c72199b2d694b80a874bad445854b4fe423c1d58c052b43bef47d76b82c6/68747470733a2f2f706f7365722e707567782e6f72672f736a61616b702f796969322d706f6c79676c6f742f762f737461626c65)](https://packagist.org/packages/sjaakp/yii2-polyglot)[![Total Downloads](https://camo.githubusercontent.com/57b0737c91d72199c6a41e5b73d737488f5c1d0e863256eab8c801ff2ec95274/68747470733a2f2f706f7365722e707567782e6f72672f736a61616b702f796969322d706f6c79676c6f742f646f776e6c6f616473)](https://packagist.org/packages/sjaakp/yii2-polyglot)[![License](https://camo.githubusercontent.com/790ac6feda21ea8982e6403398f3552ef51fd55756a989f0e64a62e21f3c15cf/68747470733a2f2f706f7365722e707567782e6f72672f736a61616b702f796969322d706f6c79676c6f742f6c6963656e7365)](https://packagist.org/packages/sjaakp/yii2-polyglot)

**yii2-polyglot** is an application component plus two widgets with flag buttons to choose the application language. It can be used in the [Yii 2.0](https://www.yiiframework.com/ "Yii") PHP Framework.

**yii2-polyglot** was developed as an alternative to other language choosers, which in my opinion are often overly complex.

**yii2-polyglot** lets the user choose her favourite language by clicking on a flag button. The chosen language becomes the site's main language and is stored in a cookie.

A demonstration of **Yii2-polyglot** is [here](http://demo.sjaakpriester.nl/polyglot).

Installation
------------

[](#installation)

Install **yii2-polyglot** in the usual way with [Composer](https://getcomposer.org/). Add the following to the require section of your `composer.json` file:

`"sjaakp/yii2-polyglot": "*"`

or run:

`composer require sjaakp/yii2-polyglot`

You can manually install **yii2-polyglot** by [downloading the source in ZIP-format](https://github.com/sjaakp/yii2-polyglot/archive/master.zip).

Using yii2-polyglot
-------------------

[](#using-yii2-polyglot)

First of all, Polyglot should be installed as an [application component](https://www.yiiframework.com/doc/guide/2.0/en/structure-application-components "Yii"). This is done in the main configuration file, usually called `web.php` or `main.php` in the `config`directory. Add the following to the configuration array:

```
