Yuriy Kravets
Yuriy Kravets

Reputation: 1263

How to trigger Google translation of a web page on clicking a element?

So i've been doing some research but i've failed to solve the problem i am facing right now. Is it possible to somehow send a request for translation of the web-page to google translator by clicking on an element from 'ul' list ?

Don't tell me to use google translate widget, that's not what i am looking for. I tried to style it, but the 'option' tag couldn't be styled, i tried to set style by using some JQuery plugins, but then the translation doesn't work.

Also tried JQuery translators, but they have a really poor quality when it comes to translating from polish to any language and to polish from any language, the page is written is polish, so no way i can change it

Upvotes: 0

Views: 2843

Answers (1)

Rob Evans
Rob Evans

Reputation: 6968

Just a suggestion but perhaps you'd find it useful to provide the translations yourself and then have a client-side language translator? I wrote this plugin for exactly that purpose because the quality of automatic translations is not up to the level I wanted.

https://github.com/coolbloke1324/jquery-lang-js

That plugin has language persistence across pages, allows both phrase and regex-based matching, can handle any number of language options and allows you to trigger the change from a click event as you described.

You can see it being used live on https://www.orbzu.com (look top-left of the page for the flag icon and then select a new language to see the text on the page change automatically).

Upvotes: 0

Related Questions