PHPackages                             parfumix/laravel-localization - 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. parfumix/laravel-localization

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

parfumix/laravel-localization
=============================

Localization for Laravel

v1.0(10y ago)030MITPHPPHP &gt;=5.4.0

Since Aug 25Pushed 10y ago1 watchersCompare

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

READMEChangelogDependencies (1)Versions (2)Used By (0)

\##Introduction

Laravel localization is an component which easy will help you to detect your locale throught various detectors **(see below)**. And first detector which will return an detector will be used as found locale.

### Instalation

[](#instalation)

You can use the `composer` package manager to install. From console run:

```
  $ php composer.phar require parfumix/laravel-localization "v1.0"

```

or add to your composer.json file

```
"parfumix/laravel-meta": "v1.0"

```

You have to publish package files using

```
  $ php artisan vendor:publish

```

### Configuration

[](#configuration)

To register package you have to follow standart procedure registering serviceProvider class .Open your configuration file located in **config/app.php** and search for array of providers:

```
  'providers' => [
        // Add that line at the end of array ..
        'Localization\LocaleServiceProvider'
      ]
```

\##Basic usage To edit your localization component you have to publish first your configuration file using below command

```
  $ php artisan vendor:publish

```

If you want to add ore remove some of locale you can easy open your configuration file and edit that section

```
locales:
   en:
    title: Enlgish
    country: US
    active: true
   ro:
    title: Romanian
    country: RO
    active: false
   ru:
    title: Russian
    active: false
```

How does component try to detect locale. It goes throught all detectors declared in configuration file and if someone of class will return an valid locale it will be used as founded locale and set up to the application

```
detectors:
   - Localization\Detectors\Request
   - Localization\Detectors\Browser
   - Localization\Detectors\System
```

As you can see here list of the classes so you can easy change the order of them or add new detectors. See below how to add new detector classes.

\###Extending You can place you detector anywhere you want, but the must important rule is to implement *Localization\\Detectable* interface which will force you to implement an function *detect()*

Example of detector:

```
