Skip to content

Instantly share code, notes, and snippets.

@Daniel-Monroy
Created February 1, 2021 05:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Daniel-Monroy/93321cbc9342d58cf2ec066234306d91 to your computer and use it in GitHub Desktop.
Save Daniel-Monroy/93321cbc9342d58cf2ec066234306d91 to your computer and use it in GitHub Desktop.
composer require mariuzzo/laravel-js-localization
config/app.php - Providers:
Mariuzzo\LaravelJsLocalization\LaravelJsLocalizationServiceProvider::class,
php artisan lang:js resources/js/Lang/translations.js --no-lib --quiet
// RUN COMMAND IN THE COMPILED
npm i webpack-shell-plugin-next
// LANG
npm install @eli5/vue-lang-js
IN webpack.config.js :
module.exports = {
...,
plugins : [
new WebpackShellPluginNext({
onBuildStart : {
scripts : ['php artisan lang:js resources/js/Lang/translations.js --no-lib --quiet'],
}
})
],
}
// end webpack.config.js
Add File:
resources/js/Lang/index.js
require('lang.js');
import VueLang. from '@eli5/vue-lang-js'
import translations from './translations.js';
Vue.use(VueLang, {
messages: translations, // Provide locale file
locale: 'en', // Set locale
fallback: 'en' // Set fallback lacale
});
// app.js
require('Lang/')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment