PHPackages                             windstep/laravel-vue-i18n-generator - 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. windstep/laravel-vue-i18n-generator

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

windstep/laravel-vue-i18n-generator
===================================

Generates a vue-i18n compatible include file from your Laravel translations.

0.2.0(3y ago)05MITPHPPHP &gt;=5.5.0

Since Nov 9Pushed 3y agoCompare

[ Source](https://github.com/windstep/laravel-vue-i18n-generator)[ Packagist](https://packagist.org/packages/windstep/laravel-vue-i18n-generator)[ Docs](http://github.com/librenms/laravel-vue-i18n-generator)[ RSS](/packages/windstep-laravel-vue-i18n-generator/feed)WikiDiscussions master Synced 1mo ago

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

About
-----

[](#about)

[![Build Status](https://camo.githubusercontent.com/1895309df9cf267c33cb9c736ef435075991851bf1facc340d17d793e74727f5/68747470733a2f2f7472617669732d63692e6f72672f6c696272656e6d732f6c61726176656c2d7675652d6931386e2d67656e657261746f722e706e673f6272616e63683d6d6173746572)](https://travis-ci.org/librenms/laravel-vue-i18n-generator)

Laravel 5 package that allows you to share your [Laravel localizations](https://laravel.com/docs/5.8/localization)with your [vue](http://vuejs.org/) front-end, using [vue-i18n](https://github.com/kazupon/vue-i18n) or [vuex-i18n](https://github.com/dkfbasel/vuex-i18n).

Fork of

Laravel 5.7 notice!
-------------------

[](#laravel-57-notice)

Configuration paths have changed in Laravel 5.7, in order for this package to function properly you need to configure correct paths for jsPath and jsFile in your `config\vue-i18n-generator.php`.

Install the package
-------------------

[](#install-the-package)

In your project: `composer require librenms/laravel-vue-i18n-generator --dev`

### For Laravel 5.4 and below:

[](#for-laravel-54-and-below)

For older versions of the framework:

Register the service provider in `config/app.php`

```
MartinLindhe\VueInternationalizationGenerator\GeneratorProvider::class,
```

Next, publish the package default config:

```
php artisan vendor:publish --provider="MartinLindhe\VueInternationalizationGenerator\GeneratorProvider"

```

Using vue-i18n
--------------

[](#using-vue-i18n)

Next, you need to install one out of two supported VueJs i18n libraries. We support [vue-i18n](https://github.com/kazupon/vue-i18n) as default library. Beside that we also support [vuex-i18n](https://github.com/dkfbasel/vuex-i18n).

When you go with the default option, you only need to install the library through your favorite package manager.

### vue-i18n

[](#vue-i18n)

```
npm i --save vue-i18n

```

```
yarn add vue-i18n

```

Then generate the include file with

```
php artisan vue-i18n:generate

```

Assuming you are using a recent version of vue-i18n (&gt;=6.x), adjust your vue app with something like:

```
import Vue from 'vue';
import VueInternationalization from 'vue-i18n';
import Locale from './vue-i18n-locales.generated';

Vue.use(VueInternationalization);

const lang = document.documentElement.lang.substr(0, 2);
// or however you determine your current app locale

const i18n = new VueInternationalization({
    locale: lang,
    messages: Locale
});

const app = new Vue({
    el: '#app',
    i18n,
    components: {
       ...
    }
}
```

For older vue-i18n (5.x), the initialization looks something like:

```
import Vue from 'vue';
import VueInternationalization from 'vue-i18n';
import Locales from './vue-i18n-locales.generated.js';

Vue.use(VueInternationalization);

Vue.config.lang = 'en';

Object.keys(Locales).forEach(function (lang) {
  Vue.locale(lang, Locales[lang])
});

...
```

Using vuex-i18n
---------------

[](#using-vuex-i18n)

### vuex-i18n

[](#vuex-i18n)

```
npm i --save vuex-i18n

```

```
yarn add vuex-i18n vuex

```

Next, open `config/vue-i18n-generator.php` and do the following changes:

```
- 'i18nLib' => 'vue-i18n',
+ 'i18nLib' => 'vuex-i18n',
```

Then generate the include file with

```
php artisan vue-i18n:generate

```

Assuming you are using a recent version of vuex-i18n, adjust your vue app with something like:

```
import Vuex from 'vuex';
import vuexI18n from 'vuex-i18n';
import Locales from './vue-i18n-locales.generated.js';

const store = new Vuex.Store();

Vue.use(vuexI18n.plugin, store);

Vue.i18n.add('en', Locales.en);
Vue.i18n.add('de', Locales.de);

// set the start locale to use
Vue.i18n.set(Spark.locale);

require('./components/bootstrap');

var app = new Vue({
    store,
    mixins: [require('spark')]
});
```

Output Formats
--------------

[](#output-formats)

You can specify the output formats from `es6`, `umd`, or `json` with the `--format` option. (defaults to `es6`)

```
php artisan vue-i18n:generate --format {es6,umd,json}

```

### Use case example for UMD module

[](#use-case-example-for-umd-module)

```
php artisan vue-i18n:generate --format umd

```

An UMD module can be imported into the browser, build system, node and etc.

Now you can include the generated script in the browser as a normal script and reference it with window.vuei18nLocales.

```

// in your js
Vue.use(VueI18n)
Vue.config.lang = Laravel.language
Object.keys(window.vuei18nLocales).forEach(function (lang) {
  Vue.locale(lang, window.vuei18nLocales[lang])
})
```

You can still require/import it in your build system as stated above.

One advantage of doing things like this is you are not obligated to do a build of your javascript each time a the translation files get changed/saved. A good example is if you have a backend that can read and write to your translation files (like Backpack). You can listen to a save event there and call vue-i18n-generator.

Generating Multiple Files
-------------------------

[](#generating-multiple-files)

Sometimes you may want to generate multiple files as you want to make use of lazy loading. As such, you can specify that the generator produces multiple files within the destination directory.

There are two options:

1. One file per laravel module language file using switch `--multi`
2. One file per locale using switch `--multi-locales`

```
php artisan vue-i18n:generate --multi{-locales}

```

Parameters
----------

[](#parameters)

The generator adjusts the strings in order to work with vue-i18n's named formatting, so you can reuse your Laravel translations with parameters.

resource/lang/message.php:

```
return [
    'hello' => 'Hello :name',
];
```

in vue-i18n-locales.generated.js:

```
...
    "hello": "Hello {name}",
...
```

Blade template:

```

    {{ trans('message.hello', ['name' => 'visitor']) }}

```

Vue template:

```

    {{ $t('message.hello', {name: 'visitor'}) }}

```

Notices
-------

[](#notices)

- The generated file is an ES6 module.

The more sophisticated pluralization localization as described [here](https://laravel.com/docs/5.5/localization#pluralization) is not supported since neither vue-i18n or vuex-i18n support this.

License
=======

[](#license)

Under [MIT](LICENSE)

###  Health Score

27

—

LowBetter than 49% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity4

Limited adoption so far

Community19

Small or concentrated contributor base

Maturity61

Established project with proven stability

 Bus Factor1

Top contributor holds 52.5% 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 ~49 days

Recently: every ~206 days

Total

49

Last Release

1457d ago

PHP version history (2 changes)0.1.0PHP &gt;=5.4.0

0.1.1PHP &gt;=5.5.0

### Community

Maintainers

![](https://www.gravatar.com/avatar/f486db31d03cd59d7665e26aee508d728fa821840c38eb659482cf01dd01b791?d=identicon)[Windstep](/maintainers/Windstep)

---

Top Contributors

[![martinlindhe](https://avatars.githubusercontent.com/u/181531?v=4)](https://github.com/martinlindhe "martinlindhe (52 commits)")[![murrant](https://avatars.githubusercontent.com/u/39462?v=4)](https://github.com/murrant "murrant (12 commits)")[![voydz](https://avatars.githubusercontent.com/u/373533?v=4)](https://github.com/voydz "voydz (4 commits)")[![netpok](https://avatars.githubusercontent.com/u/6945600?v=4)](https://github.com/netpok "netpok (2 commits)")[![marcoocram](https://avatars.githubusercontent.com/u/6926933?v=4)](https://github.com/marcoocram "marcoocram (2 commits)")[![madeITBelgium](https://avatars.githubusercontent.com/u/20304892?v=4)](https://github.com/madeITBelgium "madeITBelgium (2 commits)")[![Jellyfrog](https://avatars.githubusercontent.com/u/759887?v=4)](https://github.com/Jellyfrog "Jellyfrog (2 commits)")[![jcharcosset](https://avatars.githubusercontent.com/u/36884315?v=4)](https://github.com/jcharcosset "jcharcosset (1 commits)")[![kenfdev](https://avatars.githubusercontent.com/u/3941889?v=4)](https://github.com/kenfdev "kenfdev (1 commits)")[![Konafets](https://avatars.githubusercontent.com/u/363363?v=4)](https://github.com/Konafets "Konafets (1 commits)")[![krns](https://avatars.githubusercontent.com/u/7387295?v=4)](https://github.com/krns "krns (1 commits)")[![Naoray](https://avatars.githubusercontent.com/u/10154100?v=4)](https://github.com/Naoray "Naoray (1 commits)")[![ottoszika](https://avatars.githubusercontent.com/u/7945963?v=4)](https://github.com/ottoszika "ottoszika (1 commits)")[![periloso](https://avatars.githubusercontent.com/u/5249810?v=4)](https://github.com/periloso "periloso (1 commits)")[![rabrowne85](https://avatars.githubusercontent.com/u/8293543?v=4)](https://github.com/rabrowne85 "rabrowne85 (1 commits)")[![Raymonf](https://avatars.githubusercontent.com/u/8991740?v=4)](https://github.com/Raymonf "Raymonf (1 commits)")[![RSchwan](https://avatars.githubusercontent.com/u/9384498?v=4)](https://github.com/RSchwan "RSchwan (1 commits)")[![sandofvega](https://avatars.githubusercontent.com/u/34006175?v=4)](https://github.com/sandofvega "sandofvega (1 commits)")[![shareef1989](https://avatars.githubusercontent.com/u/4285706?v=4)](https://github.com/shareef1989 "shareef1989 (1 commits)")[![sporchia](https://avatars.githubusercontent.com/u/349353?v=4)](https://github.com/sporchia "sporchia (1 commits)")

---

Tags

laravelvue-i18n

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/windstep-laravel-vue-i18n-generator/health.svg)

```
[![Health](https://phpackages.com/badges/windstep-laravel-vue-i18n-generator/health.svg)](https://phpackages.com/packages/windstep-laravel-vue-i18n-generator)
```

###  Alternatives

[erag/laravel-lang-sync-inertia

A powerful Laravel package for syncing and managing language translations across backend and Inertia.js (Vue/React) frontends, offering effortless localization, auto-sync features, and smooth multi-language support for modern Laravel applications.

3812.2k](/packages/erag-laravel-lang-sync-inertia)[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/laravel-lat-es

Archivos de traducción al español latinoamericano para Laravel (auth, pagination, passwords, validation).

198.5k](/packages/amendozaaguiar-laravel-lat-es)[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)
