In my application I am using react-alert-template-basic to show alerts. In the API I write the texts directly, like:
this.props.alert.error('<some text>');
Now, I want to i18n the text. After a quick search, I found that react-intl
is one of the popular choices for that. In the docs I found that the internationalization if performed when rendering, like this:
<FormattedMessage
id="welcome"
defaultMessage={`Hello {name}, you have {unreadCount, number} {unreadCount, plural,
one {message}
other {messages}
}`}
values={{name: <b>{name}</b>, unreadCount}}
/>
I don't know how to use react-intl
with react-alert-basic-template
. The latter needs the string directly, not the component FormattedMessage
.
Does anyone know how to doi it? If not, any other alternative?