Closed Erwin32 closed 5 years ago
Hi @Erwin32
This functionality is actually available. You need to pass a respective handler function as onTranslationNotFound
property when initializing the store. You can find an example in the readme.
// with promise as return value. this will write the new value into the store,
// after the promise is resolved
Vue.use(vuexI18n.plugin, store, {
moduleName: 'i18n',
onTranslationNotFound (locale, key) {
return new Promise((resolve, reject) => {
axios.get('/api/translations/async', {locale: locale, key:key})
.then((result) => {
resolve(result.data);
}).catch() {
reject();
}
})
}}
);
oh great must have missed that, thx
I was looking for some way to register some callback/interceptor on failed key lookup so that I could send a request to server API we have that would notify the server of the missing translation.
I didn't find any way to do this using the library functions. I could introduce custom vue filter and some wrapper method around $t method as last resort tho I wouldn't prefer that.