PHPackages                             eolica/nova-locale-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. eolica/nova-locale-switcher

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

eolica/nova-locale-switcher
===========================

A simple locale switcher for Nova without any concrete localization implementation

1.0.0(5y ago)1328.4k↓30.4%11[1 issues](https://github.com/Eolica-Web/nova-locale-switcher/issues)MITVuePHP &gt;=7.2

Since Oct 29Pushed 2y ago3 watchersCompare

[ Source](https://github.com/Eolica-Web/nova-locale-switcher)[ Packagist](https://packagist.org/packages/eolica/nova-locale-switcher)[ RSS](/packages/eolica-nova-locale-switcher/feed)WikiDiscussions master Synced 3d ago

READMEChangelog (1)Dependencies (2)Versions (2)Used By (0)

Laravel Nova Locale Switcher Tool
=================================

[](#laravel-nova-locale-switcher-tool)

This tool provides a simple header dropdown to quickly switch between locales. This tool does not have any concrete implementation, so is up to you of what happens when a locale is selected from the dropdown.

[![Nova Locale Switcher](https://raw.githubusercontent.com/Eolica-Web/nova-locale-switcher/master/docs/screenshots/screenshot_1.png)](https://raw.githubusercontent.com/Eolica-Web/nova-locale-switcher/master/docs/screenshots/screenshot_1.png)

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

[](#installation)

```
composer require eolica/nova-locale-switcher
```

If you were using our `tramuntana-studio/nova-locale-switcher` package, please modify it accordingly.

Usage
-----

[](#usage)

We will demonstrate how tu use this tool with a simple example. First, you must register the tool in `NovaServiceProvider` under tools.

```
use Illuminate\Http\Request;

public function tools()
{
    return [
        \Eolica\NovaLocaleSwitcher\LocaleSwitcher::make()
            ->setLocales(config('nova.locales'))
            ->onSwitchLocale(function (Request $request) {
                $locale = $request->post('locale');

                if (array_key_exists($locale, config('nova.locales'))) {
                    $request->user()->update(['locale' => $locale]);
                }
            }),
    ];
}
```

The `setLocales` method expects an associative array, the key being the locale code and the value the name of the locale. In this example, we set the locales from de `nova.php` config file:

```
return [

    // Rest of Nova configuration

    ...

    /*
    |--------------------------------------------------------------------------
    | Nova Locales
    |--------------------------------------------------------------------------
    */

    'locales' => [
        'en' => 'English',
        'de' => 'Deutsch',
        'es' => 'Español',
    ],
];
```

For handling the locale switching we must pass a `callable` to the `onSwitchLocale` method, in this example we update the current user locale field (this is a custom field that we added to the model) with the locale that we receive from the Request object.

Now, for setting the application locale we can do it inside the `boot` method of the `NovaServiceProvider` by using the `Nova::serving()` method:

```
use Laravel\Nova\Events\ServingNova;

final class NovaServiceProvider extends NovaApplicationServiceProvider
{
    /**
     * Bootstrap any application services.
     *
     * @return void
     */
    public function boot()
    {
        parent::boot();

        Nova::serving(function (ServingNova $event) {
            $user = $event->request->user();

            if (array_key_exists($user->locale, config('nova.locales'))) {
                app()->setLocale($user->locale);
            }
        });
    }

    ...
}
```

The last step is to display the language selector. For that we must [publish](https://nova.laravel.com/docs/3.0/installation.html#updating-nova-s-assets) Nova's views executing the next command:

```
php artisan nova:publish
```

Now we go to the file `/resources/views/vendor/nova/layout.blade.php` and right after the dropdown that includes the user's partial we add the `locale-switcher` Vue component:

```

    ...

        @include('nova::partials.user')

```

And that should be it!

This is one of many solutions you can use, the important thing is that you can switch to another type of implementation without depending on an external package.

Changelog
---------

[](#changelog)

Please see [CHANGELOG](CHANGELOG.md) for more information what has changed recently.

Security
--------

[](#security)

If you discover a security vulnerability within this package, please send an email at  instead of using the issue tracker.

License
-------

[](#license)

The MIT License (MIT). Please see [License File](LICENSE.md) for more information.

###  Health Score

32

—

LowBetter than 69% of packages

Maintenance18

Infrequent updates — may be unmaintained

Popularity35

Limited adoption so far

Community14

Small or concentrated contributor base

Maturity49

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 75% of commits — single point of failure

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

Unknown

Total

1

Last Release

2074d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/49846756?v=4)[David Llobell Moya](/maintainers/dllobell)[@dllobell](https://github.com/dllobell)

---

Top Contributors

[![anditsung](https://avatars.githubusercontent.com/u/1090413?v=4)](https://github.com/anditsung "anditsung (3 commits)")[![MarcRO3](https://avatars.githubusercontent.com/u/24808704?v=4)](https://github.com/MarcRO3 "MarcRO3 (1 commits)")

---

Tags

laravellocaleswitchernovaeolica

### Embed Badge

![Health badge](/badges/eolica-nova-locale-switcher/health.svg)

```
[![Health](https://phpackages.com/badges/eolica-nova-locale-switcher/health.svg)](https://phpackages.com/packages/eolica-nova-locale-switcher)
```

###  Alternatives

[spatie/nova-translatable

Making Nova fields translatable

2261.7M1](/packages/spatie-nova-translatable)[outl1ne/nova-translatable

A laravel-translatable extension for Laravel Nova.

203469.9k10](/packages/outl1ne-nova-translatable)[outl1ne/nova-translations-loader

This Laravel Nova package helps developers load translations into their packages.

396.0M55](/packages/outl1ne-nova-translations-loader)[optimistdigital/nova-translations-loader

This Laravel Nova package helps developers load translations into their packages.

393.8M10](/packages/optimistdigital-nova-translations-loader)[markwalet/nova-modal-response

A Laravel Nova asset for Modal responses on an action.

17878.9k](/packages/markwalet-nova-modal-response)[badinansoft/nova-language-switch

A Laravel Nova package to switch language in your application

26611.2k1](/packages/badinansoft-nova-language-switch)

PHPackages © 2026

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