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

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

haithemkdous/laravel-vue-translation
====================================

A package to have Laravel translation feature in VueJs

3.0(3y ago)03MITPHP

Since Dec 20Pushed 3y agoCompare

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

READMEChangelog (1)Dependencies (1)Versions (3)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')

// or apply the sentence based translation withint splitting on dots(.)

translate('Some full translation. Like this one.', {}, false)
```

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

22

—

LowBetter than 22% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity3

Limited adoption so far

Community12

Small or concentrated contributor base

Maturity47

Maturing project, gaining track record

 Bus Factor2

2 contributors hold 50%+ of commits

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

1239d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/57354581fc5183e6948b5ff544ffc0d0fe31dec6745bedaa2d2676ecfbdcb514?d=identicon)[haithemkdous](/maintainers/haithemkdous)

---

Top Contributors

[![tohidplus](https://avatars.githubusercontent.com/u/29686010?v=4)](https://github.com/tohidplus "tohidplus (12 commits)")[![haithemkdous](https://avatars.githubusercontent.com/u/18718411?v=4)](https://github.com/haithemkdous "haithemkdous (8 commits)")[![angryalf](https://avatars.githubusercontent.com/u/4278520?v=4)](https://github.com/angryalf "angryalf (3 commits)")[![mrimran](https://avatars.githubusercontent.com/u/6545893?v=4)](https://github.com/mrimran "mrimran (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/haithemkdous-laravel-vue-translation/health.svg)

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

###  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)
