PHPackages                             getsupercode/localizater - 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. getsupercode/localizater

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

getsupercode/localizater
========================

Laravel package for wrapping routes in multiple locale prefixes

2.0.0(5y ago)505313[1 PRs](https://github.com/Getsupercode/Localizater/pulls)MITPHPPHP ^7.3

Since Jul 26Pushed 2y ago2 watchersCompare

[ Source](https://github.com/Getsupercode/Localizater)[ Packagist](https://packagist.org/packages/getsupercode/localizater)[ Docs](https://github.com/getsupercode/localizater)[ RSS](/packages/getsupercode-localizater/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (8)Dependencies (6)Versions (10)Used By (0)

Localizater
===========

[](#localizater)

[![Latest Version on Packagist](https://camo.githubusercontent.com/ab857bf2dc4f1c3346c7ba3613c75a89b8b3d75e96311cc20813c8934d4dff9e/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6765747375706572636f64652f6c6f63616c697a617465722e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/getsupercode/localizater)[![Total Downloads](https://camo.githubusercontent.com/959d66728d0a6a8f854c6ef9de5806068ba1c1dd5cc34ea630cab8379cdd2286/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f6765747375706572636f64652f6c6f63616c697a617465722e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/getsupercode/localizater)[![Test](https://github.com/Getsupercode/Localizater/workflows/Test/badge.svg)](https://github.com/Getsupercode/Localizater/workflows/Test/badge.svg)[![StyleCI](https://camo.githubusercontent.com/96f70262190971f45bc506d39d6728fb08c8e56a18263d8bd697c668979c3d84/68747470733a2f2f6769746875622e7374796c6563692e696f2f7265706f732f3238323631333232342f736869656c643f6272616e63683d6d6173746572)](https://github.styleci.io/repos/282613224?branch=master)

Laravel package for wrapping routes in multiple locale prefixes.

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

[](#installation)

Via Composer

```
composer require getsupercode/localizater
```

To detect and change the locale of the application based on the request automatically, you can add this middleware to your `app/Http/Kernel`:

```
protected $middlewareGroups = [
    'web' => [
        \Getsupercode\Localizater\LocalizaterMiddleware::class,
        // ...
    ]
];
```

Configuration
-------------

[](#configuration)

By default, the application locales are only going to be `en` and the default locale is not prefixed. If you want to prefix the default locale, please run the following command to publish the configuration file:

```
php artisan vendor:publish --provider="Getsupercode\Localizater\LocalizaterServiceProvider" --tag="config"
```

After installing the package, Adding the middleware and publishing the configuration file. You need to edit the configuration file `config/localizater.php` in order to add more locales.

Note
----

[](#note)

The default locale is `app.locale` located at `config/app.php` file.

### Config: `localizater.locales`

[](#config-localizaterlocales)

Add supported locales. It's recommended to write the locale value with its native language.

```
'locales' => [
    'en' => 'English',
    'fr' => 'Français',
    'ar' => 'العربية',
]
```

### Config: `localizater.rtl_locales`

[](#config-localizaterrtl_locales)

Add RTL direction locales.

```
'rtl_locales' => ['ar']
```

### Config: `localizater.prefix_default`

[](#config-localizaterprefix_default)

If this option is set to true, Default locale URL will be prefixed.

```
true:
  www.example.com/en
  www.example.com/fr

false:
  www.example.com
  www.example.com/fr
```

### Config: `localizater.prefix_default_name`

[](#config-localizaterprefix_default_name)

If this option is set to true, Default locale route name will be prefixed.

**true:**

MethodURIURINameGETHEAD/pageen.pageGETHEAD/fr/pagefr.page**false:**

MethodURIURINameGETHEAD/pagepageGETHEAD/fr/pagefr.pageUsage
-----

[](#usage)

The package will not override the route features you already know. It's just a wrapper function that will create multiple locale routes for you.

```
// routes/web.php
