HTML tags in i18next translation

前端 未结 8 1428
小鲜肉
小鲜肉 2020-12-08 18:30

I\'m using i18next to power i18n for my weblog. It works great on text-only content, but when I try to translate content that includes HTML markup, it is displaying the raw

8条回答
  •  难免孤独
    2020-12-08 19:13

    I'm using both React and React Native. For the React app The solution works. Not for React Native.

    React
    i18n.js

    interpolation: {
          escapeValue: false   
        }
    

    somefile.jsx

    React Native
    This solution does not work because < div> is not allowed within a Text tag. I tried to add the dangerouslySetInnerHTML to the Text tag, but then nothing is visible.

    Does someone have a solution for React Native?

提交回复
热议问题