martinlindhe / laravel-vue-i18n-generator

Generates a vue-i18n compatible include file from your Laravel translations
MIT License
306 stars 207 forks source link

ReferenceError: Laravel is not defined #65

Closed VConsulting closed 5 years ago

VConsulting commented 6 years ago

Hello,

The explanation on UMD module is not very clear to me. I did not quite understand the utility?

I also have the following error: (View.config.lang = Laravel.language)

ReferenceError: Laravel is not defined

Thank you

martinlindhe commented 5 years ago

The --umd option wraps the output as a Universal Module Definition.

ReferenceError: Laravel is not defined

See the readme for usage examples.

zhengfen commented 5 years ago

I am too late to join the discussion, but maybe this answer can help someone. the example of --umd is outdated, here is the code works for me: with "vue-i18n": "^8.12.0",

import VueInternationalization from 'vue-i18n'; Vue.use(VueInternationalization); // import Locale from './vue-i18n-locales.generated.js'; const lang = document.documentElement.lang.substr(0, 2); const i18n = new VueInternationalization({ locale: lang, messages: window.vuei18nLocales, silentTranslationWarn: process.env.NODE_ENV === 'production' });