Reputation: 45941
Encoding using UTF-8. ( Multiple languages in one HTML page ).
What are the best practices to display multiple human languages on a single web page correctly across different browsers (including Safari on iPad)?
What to use for the META language tag?
Working in Rails.
Upvotes: 2
Views: 304
Reputation: 111369
If you are mixing right-to-left languages (arabic, hebrew) with left-to-right languages you need to declare the direction of text blocks. If most of the text is left-to-right you only need to declare the right-to-left paragraphs:
<html dir="ltr">
<p>English text</p>
<p dir="rtl">العربية text</p> <!-- should render as "text العربية" -->
</html>
Declaring the language is not as important, as tripleee and Jukka say.
Upvotes: 1
Reputation: 201866
You don’t need anything special. Indicating the language in markup is not needed for rendering. It is mostly a matter of principle only, but if you wish to use it, simply use <html lang="...">
to indicate the dominant language and the lang
attribute specifying another language for any block containing text in another languge.
Upvotes: 1
Reputation: 189910
Don't declare a language for the entire page if it doesn't make sense. Instead, use a HTML lang
attribute for each div
or span
or what have you.
It's rare for sites to use detailed language annotations (and rarer still for them to be consistent and accurate) but I believe this would constitute best current practice.
Upvotes: 4