vue-i18n logs the following as a warning whenever a translation is not found:
[vue-i18n] Cannot translate the value of keypath "Mobile". Use the value of keypath as default
This can be convenient for debugging, but I have certain cases that it is legitimate to not find a translation and I would not like a warning to be logged. In my product we have created components that use the translation internally, and expect a message code to normally be passed in. A good example of this is the Select component we have created. It uses the $t function to translate all of the options. In some uses of the Select component, the options are not message codes because they have been created by the user. It is not desirable to spam the console with a bunch of warnings.
I believe a reasonable approach would be to have a configuration option to disable the warning, or to not log the warning if a missingHandler is registered in the config.
Vue.config.disableNoTranslationWarning = true;
Thank you for your feedback.
I'll try to improve this issue. 馃槈
@kazupon Thanks!
In case of someone need it:
new VueI18n({
locale,
messages,
silentTranslationWarn: true
})
I am first time user of i18n on Vue cli/ui and looked for that as well.
I was actually looking for a hook function which receives the data and can then return true or false for logging.
The reason is that I wanted to use such a function to log all keys which are still not translated.
the Vue-Ui-plugin report lists only programmatic uses of $t and not data driven translations.
Most of my logic is data driven, so nearly all my buttons, labels, hints, errors, tooltips are generated from data and they are not handled with the report.
Such a function hook could check if if we are development mode and list the missing keys then as well to a personal report object which I could use to understand missing translations or.
I could even use it to write another plugin tool which autotranslates all keys on the fly...
+1 for some sort of hook where i can check wether i want to display the warning or not.
I have an usecase where there's a check for a translation which 60% wont exist. I would like to silence that specific warning however I would still like to receive warnings on different use cases.
Most helpful comment
In case of someone need it: