[Vuejs]-Npm run prod –watch single file?

0👍

I found a trick – added the translations json file in /public, and get its content from a axios call in app.js, so it’s always refreshed without any action

axios.get('/i18n').then(
    response => {
        let Locale=response.data;
        i18n = new VueInternationalization({
           locale: lang || 'en',
           messages: Locale
        });
     }
);

Route::get('i18n', 'UtilsController@i18n');

public function i18n(){
    return file_get_contents ("translations.json");
}

Leave a comment