HTML5 support for multiple languages

Does anyone know that HTML5 supports multilingualism. I want to say if I create my site in English, and html5 converts it using some language or translation, or any other supporting tag converts this web page into the corresponding language.

Any guide or bit of code can help me a lot.

Thank you tons !!!

+4
source share
3 answers

HTML5 has no integrated translation. HTML supports the lang attribute, which indicates in which language the given content of the tag is written, but this is just an indicative attribute that in no way changes the content.

A more philosophical argument for why there is no automatic translation is that HTML is a structural language ... it defines the structure on which your web page is built. He not only does not change the content, but also does it, because the developer will lose control over the quality and accuracy of the translation. It can be very bad ...

As you should already know, Chrome translates foreign language pages for you into your preferred language. The difference here is that Chrome is controlled by a user who has the right to decide in which language to view the content, and whether they want to view the source content that is explicitly defined by you, the developer.


Translation is performed in the browser. To translate, you need a translation engine that really does the translation for you. As you know, you cannot just translate words one by one and ultimately have the correct translation in another language. Chrome uses the power of Google Translate to translate its pages, and that’s how it offers this feature. Your best bet for multilingual support is to offer your pages in any number of languages ​​that you definitely can, and then hope that users who don’t use Chrome will connect your URL to Google translate or a similar service to get an approximate content of your content in their native language.

+2
source

HTML5 doesn't translate anything. It is just a markup language that displays the content that you placed inside it without applying any logic to it.

However, such translations are usually performed by modern browsers such as Chrome, FireFox, etc. Advance browsers find that the website you are viewing is in some other language and offers you the choice to convert it to your preferred language.

The only thing HTML5 has in relation to this whole translation is that it has a new translate attribute. Using this attribute with a value of "no" , you can now mark elements that you do not want to be translated by browsers:

 <span translate="no">θ‘ζ’žζ’žζ²’θΌΈθ΄γ€ζ‡‰ζ˜―γ€Œθ‘θ‘ζ’žζ’žζ²’θΌΈθ΄</span> <!--Now no browser will dare to translate this.--> 
+4
source

Question: Do you want to automatically translate content or want to translate the user interface of your site.

HTML5 itself does not actually provide full support for any, only some hints, and even they are not implemented universally.

You can add the Google Translate button to your website as described at http://www.labnol.org/internet/google-translation-widgets/10135/ , for example. Google Chrome has a built-in interface and works for all websites. Another browser may receive this functionality in the future, but this is a feature of the browser application, not HTML.

You can use one of the many internationalization libraries to translate the interface of your site. Many CMS and web frameworks come with such an i18n library. You can also do this on the client side using a library such as jquery.i18n ( https://github.com/wikimedia/jquery.i18n/ ).

(Disclaimer: I am one of the developers of juery.i18n.)

Finally, just a hint about good practice: use the lang attribute in all relevant HTML elements. Even if it's just "en". This is useful for checking spelling, choosing the right fonts, translating, etc. Whenever you know the language, indicate it. This may seem redundant, but necessary.

+2
source

All Articles