PHPackages                             nascent-africa/laravel-locale - 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. nascent-africa/laravel-locale

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

nascent-africa/laravel-locale
=============================

v1.0(5y ago)81051MITPHPPHP ^7.1|^8.0

Since Nov 8Pushed 5y ago1 watchersCompare

[ Source](https://github.com/nascent-africa/laravel-locale)[ Packagist](https://packagist.org/packages/nascent-africa/laravel-locale)[ Docs](https://github.com/nascentafrica/laravel-locale)[ RSS](/packages/nascent-africa-laravel-locale/feed)WikiDiscussions main Synced 2d ago

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

Laravel Locale
==============

[](#laravel-locale)

Laravel locale is a starting point to build on the laravel translation system.

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

[](#installation)

### Installing Jetstream

[](#installing-jetstream)

You may use Composer to install Laravel Locale into your new Laravel project:

```
composer require nascent-africa/laravel-locale

```

### Configuration

[](#configuration)

After installation, add the `NascentAfrica\LaravelLocale\Http\Middleware\LocaleMiddleware` to `web` route group in the kernel.php file.

```
    ...

    /**
     * The application's route middleware groups.
     *
     * @var array
     */
    protected $middlewareGroups = [
        'web' => [
            ...
            NascentAfrica\LaravelLocale\Http\Middleware\LocaleMiddleware::class
        ],

        ...
    ];

```

By default, this package supports `en` and `fr` locales, but you can reset this by registering your preferred locale option in your service provider:

```
namespace App\Providers;

use Illuminate\Support\ServiceProvider;
use NascentAfrica\LaravelLocale\LaravelLocaleFacade;

class AppServiceProvider extends ServiceProvider
{

    /**
     * Bootstrap any application services.
     *
     * @return void
     */
    public function boot()
    {
        LaravelLocaleFacade::setLocales([
            'en', 'fr'
        ]);
    }
}
```

Usage
-----

[](#usage)

This package registers a `/locales/{local}` to enable you switch locales by simply making a get request passing the local you wish to switch to as a parameter.

```
{{ __('English') }}

or

{{ __('English') }}
```

Vue helper
----------

[](#vue-helper)

This package implements a technique by \[Daiyrbek Artelov\](Daiyrbek Artelov) in his [How to use Laravel translations in JS (vue) files?](https://dev.to/4unkur/how-to-use-laravel-translations-in-js-vue-files-ia) to enable the use of laravel translation in VueJs files using a nice little `__(...)` function.

You can set this up with following steps:

1. Import the module and use it with vue.

```
import Vue from 'vue'

Vue.use(require('../../vendor/nascent-africa/laravel-locale/resources/js/locale'))
```

2. Add local scripts to your layout blade view.

```

    ...

            window._locale = '{{ app()->getLocale() }}'
            window._translations = {!! cache('translations') !!}

```

Now you can use the `__(..)` function in your vue files like so:

```

        {{ __('Example Component') }}

            {{ __("I'm an example component.") }}

export default {
    mounted() {
        console.log(this.__('Component mounted.'))
    }
}

```

Testing
-------

[](#testing)

Run the tests with:

```
vendor/bin/phpunit
```

License
-------

[](#license)

Laravel Locale is open-sourced software licensed under the [MIT license](https://github.com/nascent-africa/laravel-locale/blob/main/LICENSE).

###  Health Score

28

—

LowBetter than 54% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity16

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity58

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% 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

2012d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/267c0ebc19a68dd31263dab46f2d5224ac2e1ff1af6fb62e4417c8817f419667?d=identicon)[tsommie](/maintainers/tsommie)

---

Top Contributors

[![tsommie](https://avatars.githubusercontent.com/u/10388658?v=4)](https://github.com/tsommie "tsommie (4 commits)")

---

Tags

laravellocaletranslationvuenascentafricalaravellocale

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/nascent-africa-laravel-locale/health.svg)

```
[![Health](https://phpackages.com/badges/nascent-africa-laravel-locale/health.svg)](https://phpackages.com/packages/nascent-africa-laravel-locale)
```

###  Alternatives

[barryvdh/laravel-translation-manager

Manage Laravel Translations

1.7k3.6M17](/packages/barryvdh-laravel-translation-manager)[vluzrmos/language-detector

Detect the language for your application using browser preferences, subdomains or route prefixes.

109554.8k3](/packages/vluzrmos-language-detector)[kerigard/laravel-lang-ru

Ru lang for Laravel

2116.8k](/packages/kerigard-laravel-lang-ru)[highsolutions/laravel-translation-manager

Manage Laravel Translations

1518.8k](/packages/highsolutions-laravel-translation-manager)[amendozaaguiar/laraveles-spanish-for-jetstream

Archivos de traducción al español latinoamericano para Laravel con Jetstream (auth, pagination, passwords, validation + todas las cadenas de Jetstream).

1412.1k](/packages/amendozaaguiar-laraveles-spanish-for-jetstream)

PHPackages © 2026

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