You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
You can find an example in the test directory. Basically you just need to load the file via ajax and pass the translations to the plugin.
Please note, that the example is still using vue-resource. This library has been recently depreciated and it is recommended to switch to another ajax library. The authors recommend axios (which we are using now for all new projects).
// code using vue-routerthis.$http.get(url).then((response)=>{returnresponse.json();}).then((data)=>{this.$i18n.add(locale,data);this.$i18n.set(locale);}).catch((error)=>{alert('could not fetch locale translations');});// code using axios (do not forget to import axios)// import axios from 'axios';axios.get(url).then((response)=>{this.$i18n.add(locale,response.data);this.$i18n.set(locale);}).catch((error)=>{alert('could not fetch locale translations');});
Hello,
I have a small question.
You're writing
Can you please tell me how to 'load' such an external file ?
Thanks in advance for your reply & help,
Johnny
The text was updated successfully, but these errors were encountered: