Created
February 1, 2021 05:05
-
-
Save Daniel-Monroy/93321cbc9342d58cf2ec066234306d91 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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