question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

How to put HTML elements in translations?

See original GitHub issue

This will print out <br /> instead of a linebreak:

module.exports = {
  en: {
    index: {
       headline: 'Testing html <br /> with i18n'
    }
  }
}

Issue Analytics

  • State:closed
  • Created 8 years ago
  • Comments:15 (7 by maintainers)

github_iconTop GitHub Comments

8reactions
aaronjpittscommented, Jan 22, 2016

If you wrap the translation in 3 brackets like:

{{{ $t("message.hello") }}}

it does actually render the HTML correctly. But is it good practise to do that?

4reactions
aaronjpittscommented, Feb 1, 2016

What would also be great would be able to render functions like v-link and @click. For example say I have the below json:

{
    "message": "This is a message <a v-link="{name: 'linkName'}">with a link</a>"
}

It doesn’t render the v-link right now. Is this something you could implement?

As always, thanks

Read more comments on GitHub >

github_iconTop Results From Across the Web

Using HTML's translate attribute - W3C
HTML5 has a list of attributes that are to be translated by default, but these attributes should not be translated if they are...
Read more >
How to translate HTML with examples - Lokalise Blog
Sample HTML Page to Translate · First, it is important to make sure all tags and their attributes have translations. · Also, you'll...
Read more >
HTML tags in i18next translation - Stack Overflow
In order to make this work, you have to prefix the data-i18n attribute of the elements you want to translate with [html] :...
Read more >
translate - HTML: HyperText Markup Language | MDN
The translate global attribute is an enumerated attribute that is used to specify whether an element's translatable attribute values and its ...
Read more >
HTML translate Attribute - W3Schools
The translate attribute specifies whether the content of an element should be translated or not. Test: Use the Google translate box (at the...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found