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

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

arafay696/laravel-vue-translation
=================================

A package to have Laravel translation feature in VueJs

1.4(3y ago)020MITPHP

Since Mar 28Pushed 3y ago1 watchersCompare

[ Source](https://github.com/arafay696/laravel-vue-translation)[ Packagist](https://packagist.org/packages/arafay696/laravel-vue-translation)[ RSS](/packages/arafay696-laravel-vue-translation/feed)WikiDiscussions master Synced 3d ago

READMEChangelog (3)Dependencies (1)Versions (6)Used By (0)

[![GitHub license](https://camo.githubusercontent.com/19353339603be63647c43f8f825ffce300a09cd69ff92e70c04e11cf55b791c5/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6c6963656e73652f6172616661793639362f6c61726176656c2d7675652d7472616e736c6174696f6e2e737667)](https://github.com/arafay696/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

This package is compatible with Laravel `6.*`, `7.*`, `8.*`, `9.*` and `10.*`
=============================================================================

[](#this-package-is-compatible-with-laravel-6-7-8-9-and-10)

### Get started

[](#get-started)

install the package via composer

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

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

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

Publish the package assets by running the command

```
php artisan vendor:publish --provider="Devplus\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 import or in Vue3
import { translate } from "./VueTranslation/Translation";

// If you want to use it in your vue components
Vue.prototype.translate=require('./VueTranslation/Translation').default.translate;
// If you want to use it in Vue3, Define it globally
app.config.globalProperties.translate = 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

23

—

LowBetter than 26% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity6

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity49

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 ~0 days

Total

5

Last Release

1195d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/1f5ac88626861de109e275d3d525027e7297bd487d92d5952b55d98c218314ef?d=identicon)[arafay696](/maintainers/arafay696)

---

Top Contributors

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

### Embed Badge

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

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

###  Alternatives

[tohidplus/laravel-vue-translation

A package to have Laravel translation feature in VueJs

39128.1k](/packages/tohidplus-laravel-vue-translation)

PHPackages © 2026

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