dkfbasel / vuex-i18n

Localization plugin for vue.js 2.0 using vuex as store
MIT License
665 stars 56 forks source link

Disable no translation warning #92

Closed polyakov713 closed 5 years ago

polyakov713 commented 6 years ago

vuex-i18n logs the following as a warning whenever a translation is not found: i18n: i18n locale is not set when trying to access translations: forms.signIn.labels.login 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.

config.disableNoTranslationWarning = true;

zhangqiangoffice commented 6 years ago

good ideal !