How to handle HTML characters and codes, tags?
See original GitHub issueIs there are any way to use html characters into translations?
Similar to react-intl <FormattedHTMLMessage />
React makes it painless to create interactive UIs.<br />
Design simple views for each state in your application, and React will efficiently update and render just the right components when your data changes.
Thanks.
Issue Analytics
- State:
- Created 5 years ago
- Comments:6 (4 by maintainers)
Top Results From Across the Web
Guide to: Using HTML Tags/Characters in Labels
Since CML labels do not accept HTML Tags, you will need to use "escape characters". In this article we will explain escape characters...
Read more >HTML Character Codes »
HTML character references add reserved and special characters to an HTML document. Learn how to use character entity codes.
Read more >HTML codes and HTML special characters: The complete list
Character Entity name Entity number Hex Code Description
A A A A Capital A
a a a a Lowercase A
À À À À Capital A‑grave...
Read more >Special Characters in HTML - Tutorial - TeachUcomp, Inc.
To add special characters in HTML, type an ampersand (&), followed by the pound sign (#), followed by the number of the code,...
Read more >HTML Symbols - W3Schools
To add such symbols to an HTML page, you can use the entity name or the entity number (a decimal or a hexadecimal...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
For anyone stumbling upon this, you can put your html characters or codes into translations, but to make them work you have to insert the text as dangerouslySetInnerHTML, like:
This will work, but be cautious not to interpolate user input into such translations, as it would open a potential XSS vulnerability
It’s possible to use HTML entities in translations, but the problem is that they’re converted to characters.
This is already fixed in https://github.com/lingui/js-lingui/issues/268, which preserves HTML entities in messages.
Tags are supported out of the box. Just wrap your message in
<Trans>
macro.