can someone show me a working example of vue-router together with vue-i18n , I am working with laravel and vue, had all my translations ready for laravel, now I converted them to javascript translations using laravel-vue-i18n-generator plugin
however when I go use them on my component.vue files, I get this warning http://prntscr.com/bkg9qo
Any Help would be appreciated.
It's a pretty old question, but this problem is really common. So for further views this is the answer!
in your app.js
file import the 2 below :
import VueInternalization from 'vue-i18n';
import Locales from './vue-i18n-locales.generated.js';
(this will be generated through the artisan command vue-i18n:generate
and before the const
declaration as of shown below I imported this forEach
Object.keys(Locales).forEach(function (lang) {
Vue.locale(lang, Locales[lang])
});
const app = new Vue({
el: '#app'
});
And finally to set the locale I added the following lines to my app.blade.php
<script type="text/javascript">
Vue.config.lang = '{{ app()->getLocale() }}';
</script>
Hope this helps!
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With