jones/language-selector

This package is abandoned and no longer maintained. No replacement package was suggested.
There is no license information available for the latest version (v1.0.0) of this package.

v1.0.0 2013-07-15 14:06 UTC

This package is not auto-updated.

Last update: 2023-11-06 10:53:12 UTC


README

#Laravel 4 LanguageSelector

A package for Laravel 4 which sets dynamic the Language for the user

Latest Stable Version Total Downloads

##Contributing If you have any suggestions or improvements feel free to create an issue or create a Pull Request.

##Installation

Add jones/language-selector as a requirement to composer.json:

{
    ...
    "require": {
        ...
        "jones/language-selector": "dev-master"
        ...
    },
}

Update composer:

$ php composer.phar update

Add the provider to your app/config/app.php:

'providers' => array(

    ...
    'Jones\LanguageSelector\LanguageSelectorServiceProvider',

),

(Optional) Publish package config:

$ php artisan config:publish jones/language-selector

##Configuration

  • lang_key: The key where the language of the user is set

##How is checked which language is used?

First it is checked whether you entered a language key and if so we try to get the language from the user (You need to use Laravel's Auth class or Sentry and the language have to be the short key, eg 'en'). If we found a valid language we use this. Second we check the "Accept-Language" Header and try to set the language with it. If both failed we use the locale set in the config.