Interpolate (v9)
Last updated
Last updated
Deprecated: We highly recommend having a look at the new as it provides a better experience.
This component will be remove in the next major version v9.0.0!!
The interpolate component enables you to interpolate react components into translation strings (eg. to use links).
the key:
sample:
props:
i18nKey: the key to lookup
parent: optional component to wrap translation into (default 'span')
useDangerouslySetInnerHTML: allows use of raw html tags in translation values
dangerouslySetInnerHTMLPartElement: optional component to wrap parts of translation values into (default 'span'), used with useDangerouslySetInnerHTML={true}
only
i18n: i18next instance to use if not provided via context (using hoc or render props)
t: t function to use if not provided via context (using hoc or render props)
...props: values to interpolate into found translation (eg. my value with {{replaceMe}} interpolation
)
Allows having html tags inside the translation with a restriction as those get wrapped in spans. You can't have a interpolation value inside a html tag.
the key:
sample:
a) Use standard interpolation of i18next and dangerously insert that:
You can use as in i18next.
options: to use for translation (exclude interpolation variables!)
b) use markdown, eg. and pass markdown formatted content from translations to the markdown component.