rmariuzzo / Laravel-JS-Localization

🌐 Convert your Laravel messages and consume them in the front-end!

Home Page:https://github.com/rmariuzzo/laravel-js-localization

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

How to use in vue

joe94113 opened this issue · comments

development environment

// package.json
"laravel-mix": "^6.0.6",
"vue": "^2.6.14",
// composer.json
"laravel/framework": "^8.65",
"mariuzzo/laravel-js-localization": "^1.9",

In webpack.mix.js,remember npm i laravel-mix-serve

require("laravel-mix-serve");
mix.serve("php artisan lang:js");

In app.blade.php

<script src="{{ asset('messages.js') }}"></script>

In vue

<template>
<p>{{ Lang.get("admin.login") }}</p>
</template>

<script>
export default {
    data: () => ({
        Lang: Lang,
    }),
};