PHPackages                             aridez/simple-translate - 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. aridez/simple-translate

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

aridez/simple-translate
=======================

Front-end efficient Laravel translations

1.0.0(5y ago)013MITPHP

Since Dec 26Pushed 5y ago1 watchersCompare

[ Source](https://github.com/Aridez/simple-translate)[ Packagist](https://packagist.org/packages/aridez/simple-translate)[ Docs](https://github.com/Aridez/simple-translate)[ RSS](/packages/aridez-simple-translate/feed)WikiDiscussions master Synced 5d ago

READMEChangelog (1)DependenciesVersions (2)Used By (0)

- [About simple-translate](#about-simple-translate)
- [Installation](#installation)
- [Basic usage](#basic-usage)
    - [Auto merging](#auto-merging)
- [Customizing the bundles](#customizing-the-bundles)
    - [Child components](#child-components)
    - [Adding additional translations](#adding-additional-translations)
- [Contributing](#contributing)

About simple-translate
======================

[](#about-simple-translate)

Simple translate is a package that allows to use the Laravel translations on your vue components easily and efficiently. This package creates a bundle of translations in json format with just the ones used for each of the components, only the required information is passed to the view. It's as easy as calling the translations from your vue componens using `{{$attrs.__('')}}` running the `php artisan translate:bundle` command that will automatically find and create the translation files and then adding the `@bundle()` directive on your vue component.

Installation
============

[](#installation)

```
composer require aridez/simple-translate
```

Basic usage
===========

[](#basic-usage)

The first step is to go to the Vue components where you want to add translations and call the `$attrs.__('')` everywhere where you want the translations to show up:

```
//ExampleComponent.vue
```

```

                    {{$attrs.__('welcome.title')}}

                        {{$attrs.__('welcome.message')}}

    export default {
        mounted() {
            console.log(this.$attrs.__("I'm being translated!"))
        }
    }

```

Once the translations are configured its time to update the bundles:

```
php artisan translate:bundle

```

And finally, call the `@bundle()` directive, note that the `` parameter is the name of the Vue component file without the extension:

```

```

**That's it!** The bundles will be stored on a new `resources\simple-translate\bundles` folder in case you want to check them out, and remember to run the `php artisan translate:bundle` when you update them.

Auto merging
------------

[](#auto-merging)

Sometimes a project may have more than one Vue component sharing the same file name. In those cases the translations for both files are merged and bundled together. It is better to avoid this whenever it is possible in order to keep the data sent to the client at a minimum.

Customizing the bundles
=======================

[](#customizing-the-bundles)

There's a few instances where its useful to be able to customize what translations a bundle contains or to create a custom translation bundle from scratch. These bundles can be configures at the `resources\simple-translate\custom-bundles.json` file. It contains an array that can be filled with the following structure:

```
[
    {
        "name": "CustomBundle",
        "bundles": ["Component1", "Component2"],
        "keys": ["Key1", "Key2"]
    },
    ...
]
```

- *name:* Defines the name of the bundle, make sure it's unique
- *bundles:* Defines an array of existing bundle names, all of their translations will be merged
- *keys:* Defines an array of translations keys, these will be merged inside the custom bundle too

Child components
----------------

[](#child-components)

To make translations available for a parent and all of its child components, the first thing to do is to create a new custom bundle on the `resources\simple-translate\custom-bundles.json` file. Create a new element in the array and setting a unique *name* and define the *bundles* of the parent and child components:

```
[
    {
        "name": "CustomComponent",
        "bundles": ["ParentComponent", "ChildComponent"],
        "keys": []
    },
    ...
]
```

Once defined, create the bundles with `php artisan translate:bundle` and use them on the parent component with the @bundle directive specified above:

```

```

To make all of these available for the chlid component you need to pass down the the attributes by binding them:

```

```

That's it! Now the function and the translations will be available from the child component too!

Adding additional translations
------------------------------

[](#adding-additional-translations)

In case you are dynamically generating the translations to be used, you can add additional translations from your files in a custom bundle as follows:

```
[
    {
        "name": "CustomComponent",
        "bundles": ["ExampleComponent"],
        "keys": ["auth.throttle"]
    },
    ...
]
```

That way the `auth.throttle` tranlsation together with all the ones found inside `ExampleComponent.vue` will be merged together under the new `CustomComponent`.

Contributing
============

[](#contributing)

If you are looking to extend or improve the functionality of simple-translate your contribution is welcome!

To set up this package for development clone this folder into a `packages\aridez` in the root of your Laravel application where you plan to test the new functionality. To import this package locally define a custom repository in your `composer.json` file:

```
    "repositories": [
        {
          "type": "path",
          "url": "./packages/aridez/simple-translate"
        }
      ]
```

You can now require your local package in the Laravel application using your chosen namespace of the package:

```
composer require aridez/simple-translate

```

You can find more information about setting up this package for development on [larapackage.com](https://laravelpackage.com/).

Once your code is merged, it is available for free to everybody under the MIT License. Publishing your Pull Request on the simple-translate GitHub repository means that you agree with this license for your contribution.

📧

Did you like this package? [Help me continue developing open source projects](https://github.com/sponsors/Aridez)

###  Health Score

23

—

LowBetter than 27% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity5

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity53

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

Unknown

Total

1

Last Release

1967d ago

### Community

Maintainers

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

---

Top Contributors

[![Aridez](https://avatars.githubusercontent.com/u/22683419?v=4)](https://github.com/Aridez "Aridez (3 commits)")

---

Tags

laraveltranslatevue

### Embed Badge

![Health badge](/badges/aridez-simple-translate/health.svg)

```
[![Health](https://phpackages.com/badges/aridez-simple-translate/health.svg)](https://phpackages.com/packages/aridez-simple-translate)
```

###  Alternatives

[outl1ne/nova-translatable

A laravel-translatable extension for Laravel Nova.

203416.9k8](/packages/outl1ne-nova-translatable)[itsmattburgess/laravel-translate

Populate laravel translation files using services such as Google Translate

222.5k](/packages/itsmattburgess-laravel-translate)

PHPackages © 2026

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