Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Html tag #11

Closed
milabron opened this issue Nov 20, 2020 · 4 comments
Closed

Html tag #11

milabron opened this issue Nov 20, 2020 · 4 comments

Comments

@milabron
Copy link

Hello,

I am migrating from "next-i18next" to Rosseta and I would not like to change all the translations.

I have translations like the one below:

"h1": "The most recognized <br/><i>Taxi</i><br/> company in Nerja",

You know the best way to be able to render that HTML

Thanks

@milabron
Copy link
Author

ok I have created an alternative function

html: (...args) => <div dangerouslySetInnerHTML={{ __html: i18n.t(...args) }} /> ,

@milabron
Copy link
Author

milabron commented Nov 20, 2020

Well, I just realized that it's not the best option since it wraps the element with an div and I don't want that.

@milabron milabron reopened this Nov 20, 2020
@milabron
Copy link
Author

It seems to go well with this library https://github.com/wrakky/react-html-parser#readme, although I do not know if it is the best option

@lukeed
Copy link
Owner

lukeed commented Nov 20, 2020

Hey, no idea, sorry

I made this because all other solutions are too complex imo. Rosetta is as simple as it gets and it only has the one approach.

I would have made the same function as you did, but with a span instead probably.

Sorry can't offer much more than that. Good luck!

@lukeed lukeed closed this as completed Nov 20, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants