Limit google Translate API - Javascript

Asked

Viewed 65 times

0

I put the Google Translation Api on my website, I would like to know how to force it to translate specific elements, or to force it not to translate some element, because on the website it contains a menu, and Google Translation makes the incorrect translation of the items, so I made a manual translation, but google Translate always forces to replace that translation.

If it is not possible to limit where it should translate, there is how to make google Translate stop forcing the translation after I translate this menu manually?

remembering that after the event that makes the translation, I call my manual translation, and it ends up retracing.

OBS.: maybe it seems a bit confusing, if you need more details or the part of the code of google Translate that I refer, I can send!

1 answer

1


Just add the class notranslate in the element you want to be ignored by the google translator, for example:

<p>It's only a test using GoogleTranslate</p>
<p class="notranslate">It's only a test using GoogleTranslate</p>
<p>It's only a test using GoogleTranslate</p>

After running it will be like this:

resultado do google tradutor usando a classe notranslate

One detail, classes can add multiple classes in an element, for example:

<div class="foo bar baz notranslate boo">...</div>
  • 1

    That’s right, thanks friend, thank you very much!! + 1

Browser other questions tagged

You are not signed in. Login or sign up in order to post.