React-i18next: Link on text content

Created on 16 Oct 2018  路  6Comments  路  Source: i18next/react-i18next

Hi guys,

First of all: Thanks for your amazing work!

I'd like to introduce a link inside my translated text. HTML example:

[...]
  "text_two": "Go to <a href='//google.com.br'>Google Portuguese</a>"
[...]

How could I do something similar in RN?
Do you have a direction to point me? I'm very newbie in i18n.

Thanks in advance

Most helpful comment

Not cutting it...use the Trans component: https://react.i18next.com/components/trans-component#sample

In that sample replace the Link with whatever is right for your RN link component.

All 6 comments

Are you using react-navigation with reactnative? if so find a sample here: https://github.com/i18next/react-i18next/blob/master/example/reactnative-expo/js/pages/Home.js#L32

Just do not use a Button but a Text component with style underline (there is nothing like a a tag in RN)

Hi Jan,

Thanks for your answer.

My example was bad, but my situation is that I have a huge text with links inside it.

Here's my layout:
image

The best approach is to cut this text into many parts?

Not cutting it...use the Trans component: https://react.i18next.com/components/trans-component#sample

In that sample replace the Link with whatever is right for your RN link component.

That is exactly what I was looking for. Thank you!

Both of the links in this answer are broken. Could you post the solution here inline?

Was this page helpful?
0 / 5 - 0 ratings