Previously I was using react-intl
and was able to set placeholders for items which would be replaced with components, e.g. {br}
with <br />
.
I'm currently getting errors when using react-i18next
and i18next-icu
where I'm trying to do:
// Using Intl format (via i18next-icu)
{
"test": "Replace with a{br}line-break. {button}"
}
t("test", { br: <br />, button: <button>Click me!</button> });
// Outputted translated text
Replace with a[object Object]line-break. [object Object]
Is it actually possible to do this using i18next
/i18next-icu
? If not, what would be another method to insert components into the translated string?
` than it is for them to either use a `
` or `{br}`. – Matt Scheurich Mar 05 '19 at 12:22
` in translation strings; no need for `<0>0>`. – Aleksi Aug 16 '19 at 05:32