Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

translation warning still shows after adding a missing handler #831

Open
pancake-boy opened this issue Apr 8, 2020 · 3 comments
Open

translation warning still shows after adding a missing handler #831

pancake-boy opened this issue Apr 8, 2020 · 3 comments

Comments

@pancake-boy
Copy link

@pancake-boy pancake-boy commented Apr 8, 2020

vue & vue-i18n version

8.15.4

Steps to reproduce

add missing handler:

i18n.missing = (locale: Locale, key: Path) => {
if (i18n.te(key, i18n.fallbackLocale)) {
return i18n.t(key, i18n.fallbackLocale).toString();
}

return ''; // instead of showing the key + warning
};

What is Expected?

no warnings about missing key

What is actually happening?

console log shows:

vue-i18n.esm.js?a925:33 [vue-i18n] Value of key 'xxx' is not a string!

@exoego
Copy link
Collaborator

@exoego exoego commented Apr 18, 2020

I think it is reasobale to show warning even when missing handler is used, since the message warns developers (or translators) some message key are not translated yet.
And, the messages are shown only on development build, so the message have no effect on end-users.

Could you tell the motivation to hide the message when missing handler is used on development mode ?

@pancake-boy
Copy link
Author

@pancake-boy pancake-boy commented Apr 20, 2020

its ok, just that the doc is saying it will not warn.

missing
Type: MissingHandler

Default: null

A handler for localization missing. The handler gets called with the localization target locale, localization path key, the Vue instance and values.

If missing handler is assigned, and occurred localization missing, **it's not warned**.

#fallbackRoot
@exoego
Copy link
Collaborator

@exoego exoego commented Apr 20, 2020

Ah, I see it is documentation issue.
Thanks for reporting !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants
You can’t perform that action at this time.