PHPackages                             samehdoush/lingua - 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. samehdoush/lingua

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

samehdoush/lingua
=================

Add your Laravel language translations to your asset pipeline for use in Javascript packages like Vue or React.

1.1.2(1mo ago)0822↓50%MITJavaScriptPHP ^8.2CI passing

Since Mar 15Pushed 1mo ago1 watchersCompare

[ Source](https://github.com/samehdoush/lingua)[ Packagist](https://packagist.org/packages/samehdoush/lingua)[ RSS](/packages/samehdoush-lingua/feed)WikiDiscussions main Synced 1mo ago

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

[![Stand With Ukraine](https://raw.githubusercontent.com/vshymanskyy/StandWithUkraine/main/banner-direct.svg)](https://stand-with-ukraine.pp.ua)[![Stand With Ukraine](https://raw.githubusercontent.com/vshymanskyy/StandWithUkraine/main/badges/StandWithUkraine.svg)](https://stand-with-ukraine.pp.ua)[![Russian Warship Go Fuck Yourself](https://raw.githubusercontent.com/vshymanskyy/StandWithUkraine/main/badges/RussianWarship.svg)](https://stand-with-ukraine.pp.ua)[![Made in Ukraine](https://camo.githubusercontent.com/43115c9fb377039d5dac27be07e5f0e21ea561f4fa1e66ed1aa39e723784ede0/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6d6164655f696e2d756b7261696e652d6666643730302e7376673f6c6162656c436f6c6f723d303035376237)](https://stand-with-ukraine.pp.ua)

[![](./assets/logo.png)](./assets/logo.png)

##### Originally based on [Zora](https://github.com/jetstreamlabs/zora), but was hard modified.

[](#originally-based-on-zora-but-was-hard-modified)

Generate translations into JS file
==================================

[](#generate-translations-into-js-file)

This library allows you to generate your Laravel translations to your asset pipeline for use in JavaScript packages like Vue. (React coming soon)

Requirements
============

[](#requirements)

- **Laravel**: ^9.\* through ^13.\*
- **InertiaJS**: ^1.\*
- **VueJS**: ^3.\*
- **ViteJS**: ^3.\*

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

[](#installation)

First, install the package via composer:

```
composer require samehdoush/lingua
```

The package will automatically register itself.

Next add an alias to your `vite.config.js`

```
 resolve: {
    alias: {
        ...
        'lingua-js': resolve(__dirname, 'vendor/cyberwolfstudio/lingua/dist/index.js')
    },
},
```

To build your Laravel translation into JS file, use:

```
php artisan lingua:generate
```

You can automate that process as you wish. But we recommend you a vite plugin called [vite-plugin-run](https://github.com/innocenzi/vite-plugin-run)Install it using you package manager and just add this lines to your `vite.config.js` plugins section.

```
 run({
    name: "generate translations",
    run: ['php', 'artisan', 'lingua:generate'],
    pattern: ['resources/lang/**', 'lang/**'],
})
```

Example of usage: (running only at serve process)

```
{
            ...run([
                {
                    name: 'generate translations',
                    run: ['php', 'artisan', 'lingua:generate'],
                    pattern: ['resources/lang/**', 'lang/**'],
                },
                {
                    name: 'generate ziggy',
                    run: ['php', 'artisan', 'ziggy:generate'],
                    pattern: ['routes/**'],
                }
            ]),
            apply: 'serve'
        }

```

### VueJS

[](#vuejs)

In your `resources/js/app.js` and (if you use SSR) `resources/js/ssr.js` add imports

```
import { LinguaVue } from 'lingua-js'
import { Lingua } from './lingua'
```

and register LinguaVue plugin

```
...
.use(LinguaVue, {
    Lingua
})
```

Add `locale` key into your `HandleInertiaRequest::share` method

```
[
    ...
    locale' => fn() => app()->getLocale(),
    ...
]
```

That's how your application will know your initial locale.

### React

[](#react)

Coming soon

Usage
-----

[](#usage)

In your template tag use it in Laravel style, like

```
__(key: string, replacers: array)

//or

trans(key: string, replacers: array)
```

You can also use trans in your `setup` function by injecting it.

```
const trans = inject('trans')
```

Changelog
=========

[](#changelog)

All changes made here will be described in [Changelog.md](./CHANGELOG.md) file.

###  Health Score

45

—

FairBetter than 93% of packages

Maintenance90

Actively maintained with recent releases

Popularity19

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity52

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

Every ~189 days

Total

3

Last Release

51d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/2c15e375de9134defa30a075f635514e7b5d27af9bdb0c63a156273da5995e10?d=identicon)[samehdoush](/maintainers/samehdoush)

---

Top Contributors

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

### Embed Badge

![Health badge](/badges/samehdoush-lingua/health.svg)

```
[![Health](https://phpackages.com/badges/samehdoush-lingua/health.svg)](https://phpackages.com/packages/samehdoush-lingua)
```

###  Alternatives

[mcamara/laravel-localization

Easy localization for Laravel

3.5k9.1M112](/packages/mcamara-laravel-localization)[typicms/base

A modular multilingual CMS built with Laravel, enabling developers to manage structured content like pages, news, events, and more.

1.6k20.3k](/packages/typicms-base)[vemcogroup/laravel-translation

Translation package for Laravel to scan for localisations and up/download to poeditor

135304.0k2](/packages/vemcogroup-laravel-translation)

PHPackages © 2026

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