Reputation: 1164
What is the best practice about HTML tags in internationalized strings.
Is that OK to use <p>, <br>, <ul><li>
inside strings that are used for translation of HTML UI?
What are the best practices here?
Upvotes: 3
Views: 874
Reputation: 34024
One think to look out for is that using html in translations requires disabling output escaping when displaying these strings. So you have to make sure that parameters in the translations are properly escaped before substituting them.
Upvotes: 1
Reputation: 201618
This is something to be discussed with the translation agency or translators. I would expect professional translators to be able and willing to deal with data as HTML fragments, but this should be agreed on and documented. You should also check out whether XHTML format (with e.g. <br />
and not <br>
) is needed, since some software tools used by translators might require it.
It is often crucial to use HTML fragments rather than plain texts, especially when there is inline (text-level) markup. If sentences are split to pieces, which are translated separately, then put together again, then result will often be awful, maybe incomprehensible.
The size of the chunks depends on the context and overall organization of translation work. Usually the best results are achieved if a translator can work with an entire page and even see the site context, but that’s not always possible. You often need to divide the text to pieces, like headings, paragraphs, and items of a list. They are units that can often be translated reasonably, without wider context, whereas anything smaller tends to cause serious problems. (I have often had to explain why strings like “From” and “To”, though perhaps perfectly reasonable in a user interface, just cannot be translated without context into a language that lacks prepositions.)
Upvotes: 5
Reputation: 12535
HTML is markup code - it is perfectly acceptable in any web page regardless of language.
Upvotes: 0