laravelli/js-translate

Module for translating strings in vue.js


License
MIT

Documentation

Installation

  1. Install package
composer require laravelli/js-translate
  1. Install lodash
npm install lodash --save-dev
  1. Publish assets
php artisan vendor:publish --provider="Laravelli\JsTranslate\JsTranslateServiceProvider" --tag="assets"
  1. Add in bootstrap.js
// translations
import translate from '@shared/Helpers/translations'
window.translate = window.trans = window.__ = translate
  1. Add global mixin in app.js
App.mixin({
    methods: {
        __: window.__
    }
})
  1. Add translations into layout file
<script src="{{ route('js.translations') }}"></script>