PHPackages                             scherersoftware/cake-language-switcher - 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. scherersoftware/cake-language-switcher

ActiveCakephp-plugin[Localization &amp; i18n](/categories/localization)

scherersoftware/cake-language-switcher
======================================

LanguageSwitcher plugin for CakePHP

v2.0.2(5y ago)214.7k↑2900%61MITPHPPHP &gt;=7.0.0

Since Nov 28Pushed 5y ago3 watchersCompare

[ Source](https://github.com/scherersoftware/cake-language-switcher)[ Packagist](https://packagist.org/packages/scherersoftware/cake-language-switcher)[ RSS](/packages/scherersoftware-cake-language-switcher/feed)WikiDiscussions master Synced 2mo ago

READMEChangelog (9)Dependencies (3)Versions (22)Used By (1)

[![CakePHP 3 Language Switcher Plugin](https://raw.githubusercontent.com/scherersoftware/cake-language-switcher/master/language-switcher.png)](https://raw.githubusercontent.com/scherersoftware/cake-language-switcher/master/language-switcher.png)

[![Build Status](https://camo.githubusercontent.com/3e313467ec8457d6c76e4dcbaae329080b722d789d9f37e6f6b2f3834727d4dc/68747470733a2f2f7472617669732d63692e6f72672f73636865726572736f6674776172652f63616b652d6c616e67756167652d73776974636865722e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/scherersoftware/cake-language-switcher)[![License](https://camo.githubusercontent.com/55c0218c8f8009f06ad4ddae837ddd05301481fcf0dff8e0ed9dadda8780713e/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d627269676874677265656e2e7376673f7374796c653d666c61742d737175617265)](LICENSE.txt)

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

[](#installation)

You can install this plugin into your CakePHP application using [composer](http://getcomposer.org).

The recommended way to install composer packages is:

```
composer require scherersoftware/cake-language-switcher

```

The next step is to load the plugin inside your bootstrap.php:

```
bin/cake plugin load LanguageSwitcher

```

Add the Middleware to your Application.php:

```
$middleware->push(new \LanguageSwitcher\Middleware\LanguageSwitcherMiddleware());

```

Optionally, you can pass an array of options to overwrite the default ones:

```
$middleware->push(new \LanguageSwitcher\Middleware\LanguageSwitcherMiddleware([
    'model' => 'Users',
    'field' => 'language',
    'Cookie' => [
        'name' => 'ChoosenLanguage',
        'expires' => '+1 year',
        'domain' => 'foo.bar',
        'canonicalizeLocale' => false
    ],
    'availableLanguages' => [
        'en_US' => 'en_US'
    ]
]));

```

Add the Helper to your AppView:

```
$this->loadHelper('LanguageSwitcher.LanguageSwitcher');

```

Optionally, you can pass an array of options:

```
$this->loadHelper('LanguageSwitcher.LanguageSwitcher', [
    'availableLanguages' => [
        'en_US' => 'en_US',
        'de_DE' => 'de_DE'
    ],
    'displayNames' => [
        'en_US' => 'English',
        'de_DE' => 'Deutsch'
    ],
    'imageMapping' => [
        'en_US' => 'United-States',
        'de_DE' => 'Germany'
    ],
    'renderToggleButtonDisplayName' => true,
    'element' => 'LanguageSwitcher.language_switcher'
]);

```

To use the element:

```

```

Next, you should migrate your database.

```
bin/cake migrations migrate -p LanguageSwitcher

```

Add the css file located under webroot/css to your layout file!

Configuration Usage
-------------------

[](#configuration-usage)

Inside your app.php add the following to change configs of the plugin:

```
'LanguageSwitcher' => [
    'model' => 'Users',
    'field' => 'language',
    'Cookie' => [
        'name' => 'ChoosenLanguage',
        'expires' => '+1 year',
        'canonicalizeLocale' => false
    ],
    'availableLanguages' => [
        'en_US'
    ],
    'displayNames' => [
        'en_US' => 'English'
    ],
    'imageMapping' => [
        'en_US' => 'United-States'
    ],
    'renderToggleButtonDisplayName' => true,
    'beforeSaveCallback' => function ($user, $request, $response) {
        $language = 'en_EN';
        $user->language = $language;
    }
]

```

- model: The model used in the migration
- field: The field in the model
- Cookie: Optionally you can change the cookie name, the expiration date of the cookie and define if the locale should be saved canonicalized.
- availableLanguages: Add language keys
- displayNames: Should contain the same keys as availableLanguages. Map language key with its Display Name
- imageMapping: Should contain the same keys as availableLanguages. Map language key with its flag image name. (For all possible flag names open webroot/img/flags)
- beforeSaveCallback: Optionally you can override the user entity to set e.g. the language field with a special value
- renderToggleButtonDisplayName: Optionally you can hide the language name in the dropdown toggle button
- element: Optionally you can override the element used for rendering the language switcher with your own.

###  Health Score

36

—

LowBetter than 82% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity27

Limited adoption so far

Community19

Small or concentrated contributor base

Maturity67

Established project with proven stability

 Bus Factor2

2 contributors hold 50%+ of commits

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~68 days

Recently: every ~77 days

Total

21

Last Release

2094d ago

Major Versions

v1.0.15 → v2.0.02019-10-16

v2.0.0 → v3.0.0-RC12019-11-29

v2.0.1 → 3.8.x-dev2020-03-31

PHP version history (2 changes)v1.0.0PHP &gt;=7.0.0

v3.0.0-RC1PHP &gt;=7.2.0

### Community

Maintainers

![](https://www.gravatar.com/avatar/7005ae518cf40495e5e8bbf91ae64379e5a853a62c2e35bcdc7ead11e6014ea2?d=identicon)[robertscherer](/maintainers/robertscherer)

![](https://www.gravatar.com/avatar/d0b3fb0817571a9d93cae13183799e0b255c5e028de7141e9979ab72b406d8ad?d=identicon)[felixkempf](/maintainers/felixkempf)

---

Top Contributors

[![felixkempf](https://avatars.githubusercontent.com/u/8512231?v=4)](https://github.com/felixkempf "felixkempf (16 commits)")[![benediktveith](https://avatars.githubusercontent.com/u/14072812?v=4)](https://github.com/benediktveith "benediktveith (13 commits)")[![cleptric](https://avatars.githubusercontent.com/u/6617432?v=4)](https://github.com/cleptric "cleptric (7 commits)")[![jonathan-neugber](https://avatars.githubusercontent.com/u/17924468?v=4)](https://github.com/jonathan-neugber "jonathan-neugber (3 commits)")

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/scherersoftware-cake-language-switcher/health.svg)

```
[![Health](https://phpackages.com/badges/scherersoftware-cake-language-switcher/health.svg)](https://phpackages.com/packages/scherersoftware-cake-language-switcher)
```

###  Alternatives

[symfony/translation

Provides tools to internationalize your application

6.6k836.5M2.1k](/packages/symfony-translation)[nesbot/carbon

An API extension for DateTime that supports 281 different languages.

169661.4M4.8k](/packages/nesbot-carbon)[joedixon/laravel-translation

A tool for managing all of your Laravel translations

717911.4k11](/packages/joedixon-laravel-translation)[illuminate/translation

The Illuminate Translation package.

6936.4M495](/packages/illuminate-translation)[larswiegers/laravel-translations-checker

Make sure your laravel translations are checked and are included in all languages.

256423.2k2](/packages/larswiegers-laravel-translations-checker)[jrbasso/cake_ptbr

Repositório com arquivos para deixar seu Cake falando português.

917.3k1](/packages/jrbasso-cake-ptbr)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
