Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I tell Google Translate to not translate a section of a website?

Google Translate has a developer tool that will enable google translate on a website. Is there a way to tell Google Translate to not translate a section of the website? Perhaps with a class name on an HTML element?

I've tried the HTML5 translate=no attribute. It has no effect.

This is a particular problem because Google is mistranslating the name of the website.

like image 967
kingjeffrey Avatar asked Mar 09 '12 03:03

kingjeffrey


People also ask

Can I edit Google Translate on my website?

To tweak a translation: Hover over a translated sentence to display the original text. Click on 'Contribute a better translation' And finally, click on a phrase to choose an automatic alternative translation —or just double-click to edit the translation directly.


1 Answers

According to Google instructions, setting class="notranslate" prevents Google translation. This appears to work, though using it inline (e.g., for a single word) may imply some confusion, so you need to check out what happens.

For example,

Welcome to the <span class="notranslate">Cool</span> company website! 

translates into Spanish as “Bienvenido a la Coolweb de la compañía!”, which isn’t that cool, though it demonstrates that “Cool” has been taken as a proper name; without the markup, the text would translate as “Bienvenido a la fresca web de la empresa!”.

Reformulating the text as

Welcome to the website of <span class="notranslate">Cool</span>! 

would result in “Bienvenido a la página web de Cool!”, which looks better except that “site” has been mistranslated.

For different target languages, different problems may and will arise. In general, the simpler the grammatical structure of a sentence is, the more often it will get translated reasonably well.

The bottom line is: you can try to prevent translation using class=notranslate, but the problems of Google Translator may cause confusion.

like image 113
Jukka K. Korpela Avatar answered Oct 18 '22 08:10

Jukka K. Korpela