vue-i18n
vue-i18n copied to clipboard
Allow custom warn implementation
Clear and concise description of the problem
Currently all warning messages are passed to console.warn, preventing escalation to e.g. Sentry
Suggested solution
Allow users to provider a custom warning handler matching the signature of warn.
Alternative
Currently console.warn can be overridden using the [intlify] prefix as an discriminator:
const originalWarn = window.console.warn;
window.console.warn = (...args: any) => {
if (
args[0] &&
typeof args[0] === 'string' &&
args[0].startsWith('[intlify]')
) {
customHandler(...args);
}
originalWarn(...args);
};
(Yikes!)
Additional context
No response
Validations
- [X] Read the Contributing Guidelines
- [X] Read the Documentation
- [X] Check that there isn't already an issue that request the same feature to avoid creating a duplicate.