Open gabimoncha opened 5 years ago
You need to use either FormattedMessage
or defineMessages
like so:
const messages = defineMessages({
homeTitle: {
defaultMessage: 'xxxx',
id: 'xxxx'
}
})
const Home = ({ intl }) => {
return (
<div>{intl.formatMessage(messages.homeTitle)}</div>
);
};
@flocbit and how will this work for the translation? Do I have to define a message for every language?
en.json:
{'home.title': 'xxxx {br} xxxx',}
component:
Expected behavior:
Current behavior:
xxxx [object Object] xxxx
[React Intl] Error formatting message: "home.title" for locale: "en" Error: The intl string context variable 'br' was not provided to the string 'xxxx {br} xxxx'