Skip to content

Custom Warning Handler

Compare
Choose a tag to compare
@cwtuan cwtuan released this 13 May 13:28
· 196 commits to master since this release

Whenever a default message is missing or having error for formatting a message, react-intl-universal will log warning message like this react-intl-universal key "not-exist-key" not defined in en-US.

If you would like to log these messages using third party services or even turn off the message, here is a chance to add custom warning handler in init function.

const locales = {...};
const currentLocale = "en-US";
const warningHandler = (message, detail) => {...}; // Define your custom warning handler
intl.init({
    locales, 
    currentLocale,
    warningHandler
})

This release fixes #44 and #45.