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

Event listener for "Cannot translate the value of keypath" #54

Closed
tobeorla opened this issue Sep 15, 2016 · 2 comments
Closed

Event listener for "Cannot translate the value of keypath" #54

tobeorla opened this issue Sep 15, 2016 · 2 comments

Comments

@tobeorla
Copy link
Contributor

I had to build this to track the missing translations, which is quite hacky. I would prefer a simple event listener.

var _warn = console.warn;

console.warn = function()
{
    // track the missing translation
    if (arguments[0].indexOf("i18n") !== -1)
    {
        var missingPhrase = arguments[0].replace('[vue-i18n] Cannot translate the value of keypath "', "");
        missingPhrase = missingPhrase.replace('". Use the value of keypath as default', "");

        WebService._call('translation/add-phrase', {phrase: missingPhrase});
        return;
    }
    return _warn.apply(console, arguments);
};
@kazupon
Copy link
Owner

kazupon commented Sep 15, 2016

We should probably support the error handling I/F like Vue.config.errorHandler.
http://rc.vuejs.org/api/#errorHandler

@tobeorla
Copy link
Contributor Author

¡That sounds cool!

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

No branches or pull requests

2 participants