PHPackages                             visualweber/multilocale - 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. visualweber/multilocale

ActiveLibrary[Localization &amp; i18n](/categories/localization)

visualweber/multilocale
=======================

Automatic detection of locales for Zend Framework 2

01251[2 PRs](https://github.com/visualweber/multilocale/pulls)PHP

Since May 17Pushed 7y ago2 watchersCompare

[ Source](https://github.com/visualweber/multilocale)[ Packagist](https://packagist.org/packages/visualweber/multilocale)[ RSS](/packages/visualweber-multilocale/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependenciesVersions (1)Used By (0)

MultiLocale
===========

[](#multilocale)

[![Build Status](https://camo.githubusercontent.com/461ad69d2a35fdf4e244f3150272654849f7b037152d366388baf0fbd65286d5/68747470733a2f2f7472617669732d63692e6f72672f76697375616c77656265722f4d756c74694c6f63616c652e706e67)](https://travis-ci.org/visualweber/MultiLocale)[![Latest Stable Version](https://camo.githubusercontent.com/34851bdae4025d698c14e0dcd3111c5956327af811e3f40301f4a0d2cd5ff70b/68747470733a2f2f706f7365722e707567782e6f72672f76697375616c77656265722f6d756c74696c6f63616c652f762f737461626c652e706e67)](https://packagist.org/packages/visualweber/multilocale)

Created by Visual Weber

Introduction
------------

[](#introduction)

MultiLocale is a Zend Framework 2 module to automatically detect a locale for your application. It uses a variety of pluggable strategies to search for a valid locale. MultiLocale features a default locale, a set of supported locales and locale aliases.

MultiLocale supports out of the box several strategies to search for a locale. Through interfaces, other strategies could be created. The set of default stragies is:

1. The HTTP `Accept-Language` header
2. A cookie to store the locale between several sessions of one visitor
3. A query parameter to easily switch from locale
4. The first segment of the path of an uri
5. A part of the domain name (either the TLD or a subdomain)

Furthermore, it provides a set of additional localisation features:

1. A default locale, used as fallback
2. A set of aliases, so you can map `.com` as "en-US" in the host name strategy
3. Redirect to the right domain/path when a locale is found
4. View helpers to create a localised uri or a list of language switches

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

[](#installation)

Add "visualweber/multilocale" to your composer.json file and update your dependencies. Enable MultiLocale in your `application.config.php`.

If you do not have a composer.json file in the root of your project, copy the contents below and put that into a file called `composer.json` and save it in the root of your project:

```
{
    "require": {
        "visualweber/multilocale": ">=0.1.0,
