PHPackages                             manu1895/laravel-vue-translation-v2 - 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. manu1895/laravel-vue-translation-v2

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

manu1895/laravel-vue-translation-v2
===================================

A package to have Laravel translation feature in VueJs

v3.0(3y ago)02.9k↓33.3%MITPHP

Since Oct 5Pushed 3y agoCompare

[ Source](https://github.com/marcoslopez95/laravel-vue-translation)[ Packagist](https://packagist.org/packages/manu1895/laravel-vue-translation-v2)[ RSS](/packages/manu1895-laravel-vue-translation-v2/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependencies (1)Versions (2)Used By (0)

[![GitHub issues](https://camo.githubusercontent.com/85acaee17666b3f98b6417c5c3cb17cc534bd590843efcfdb135a2dc8e379b4b/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6973737565732f746f686964706c75732f6c61726176656c2d7675652d7472616e736c6174696f6e2e737667)](https://github.com/tohidplus/laravel-vue-translation/issues)[![GitHub stars](https://camo.githubusercontent.com/c9f66cad00a6aa3c92f33aaeb2ea0afea7b6a31f2a3021449d9af3f9ae1a5a92/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f73746172732f746f686964706c75732f6c61726176656c2d7675652d7472616e736c6174696f6e2e737667)](https://github.com/tohidplus/laravel-vue-translation/stargazers)[![Total Downloads](https://camo.githubusercontent.com/96ac001dd0462cae7ae8fd9317bd1f7a181e432e628895153346b3e8c7f18401/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f746f686964706c75732f6c61726176656c2d7675652d7472616e736c6174696f6e2e737667)](https://packagist.org/packages/tohidplus/laravel-vue-translation)[![GitHub license](https://camo.githubusercontent.com/02a9d719ee245d5fb01846b5a7efd6544a7be831292263c5bd581a8d5b921c0b/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6c6963656e73652f746f686964706c75732f6c61726176656c2d7675652d7472616e736c6174696f6e2e737667)](https://github.com/tohidplus/mellat/blob/master/LICENSE.txt)

Laravel translation in VueJS
============================

[](#laravel-translation-in-vuejs)

This package helps you to have Laravel translation functionality in your client side applications specially in Vue js

### Get started

[](#get-started)

install the package via composer

```
composer require tohidplus/laravel-vue-translation
```

In the **config/app.php** file add the service provider

```
'providers' => [
   //
   Tohidplus\Translation\TranslationServiceProvider::class,
   //
 ];
```

Publish the package assets by running the command

```
php artisan vendor:publish --provider="Tohidplus\Translation\TranslationServiceProvider"
```

> This will publish the **Translation.js** file in **resources/js/VueTranslation** directory

Run the artisan command

```
php artisan VueTranslation:generate --watch=1
```

> This will compile down all the translation files in the **resources/lang** directory in the file **resources/js/VueTranslation/translations.json**

Open the file **resources/js/app.js** and add the Translation helper

```
window.Vue = require('vue');
// If you want to add to window object
window.translate=require('./VueTranslation/Translation').default.translate;

// If you want to use it in your vue components
Vue.prototype.translate=require('./VueTranslation/Translation').default.translate;
```

Compile the assets by running the command

```
npm run development
// or watch or production
```

### How to switch the languages?

[](#how-to-switch-the-languages)

This will get the current language form the document **lang** attribute

```
>

        Document

```

### How to use?

[](#how-to-use)

Imagine this is the directory structure of **resources/lang**

```
|--en
   |--auth.php
   |--pagination.php
   |--passwords.php
   |--validation.php
   |--messages.php
|--fr
   |--auth.php
   |--pagination.php
   |--passwords.php
   |--validation.php
   |--messages.php
```

And the **messages.php** file is something like

```
return [
    'foo'=>[
        'bar'=>'Some message'
    ]
];
```

You can get the value by calling the **translate** method

```
translate('messages.foo.bar')
```

Example in Vue component

```

                    Example Component

                        {{translate('messages.foo.bar')}}

    export default {

    }

```

### Uses Fallback Locale

[](#uses-fallback-locale)

> To interact same like **Laravel** trans() insert in your layout

```

```

### Replace attributes

[](#replace-attributes)

> It's not recommended to use this package for showing validation errors but if you want you can replace :attribute, :size etc by passing the second argument as an object.

```
translate('validation.required',{
    attribute:translate('validation.attributes.title')
});
```

> **Notice:** if it could not find the value for the key you passed it will return the exact key

###  Health Score

26

—

LowBetter than 43% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity20

Limited adoption so far

Community11

Small or concentrated contributor base

Maturity46

Maturing project, gaining track record

 Bus Factor1

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

1315d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/4ab2c650e70c7b97529f24f547fa23917ce9ecb35db74638e9d52db5c231741a?d=identicon)[marcoslopez1895](/maintainers/marcoslopez1895)

---

Top Contributors

[![tohidplus](https://avatars.githubusercontent.com/u/29686010?v=4)](https://github.com/tohidplus "tohidplus (11 commits)")[![marcoslopez95](https://avatars.githubusercontent.com/u/50760667?v=4)](https://github.com/marcoslopez95 "marcoslopez95 (4 commits)")[![angryalf](https://avatars.githubusercontent.com/u/4278520?v=4)](https://github.com/angryalf "angryalf (3 commits)")[![belguinan](https://avatars.githubusercontent.com/u/19215568?v=4)](https://github.com/belguinan "belguinan (2 commits)")[![webcraft](https://avatars.githubusercontent.com/u/56675?v=4)](https://github.com/webcraft "webcraft (1 commits)")

### Embed Badge

![Health badge](/badges/manu1895-laravel-vue-translation-v2/health.svg)

```
[![Health](https://phpackages.com/badges/manu1895-laravel-vue-translation-v2/health.svg)](https://phpackages.com/packages/manu1895-laravel-vue-translation-v2)
```

###  Alternatives

[symfony/translation

Provides tools to internationalize your application

6.6k836.5M2.1k](/packages/symfony-translation)[nesbot/carbon

An API extension for DateTime that supports 281 different languages.

169661.4M4.8k](/packages/nesbot-carbon)[joedixon/laravel-translation

A tool for managing all of your Laravel translations

717911.4k11](/packages/joedixon-laravel-translation)[illuminate/translation

The Illuminate Translation package.

6936.4M495](/packages/illuminate-translation)[lajax/yii2-translate-manager

Translation management extension for Yii 2

227578.8k13](/packages/lajax-yii2-translate-manager)[larswiegers/laravel-translations-checker

Make sure your laravel translations are checked and are included in all languages.

256423.2k2](/packages/larswiegers-laravel-translations-checker)

PHPackages © 2026

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