1

I added translate to another language widget in my website. Users can select the language from a dropdown menu.

Suppose, I know from which country my visitor is coming. Is there any way that I can always automatically trigger google website translator in that language?

Or I will make a beautiful landing page asking which language visitor wants to see and depending on that I will send them to translated webpage?

Sourav Ghosh
  • 1,964
  • 4
  • 33
  • 43
  • 2
    Somewhat off-topic, but automatically providing a machine-translated page is a *really bad idea*. Reading machine translation can be really jarring. It's great if you want to get the gist of a blog post or something, but it's not something you'd want to interact with by default. Even if you provide a landing page it's a good idea to make it clear that it's a Google translation, otherwise it'll just make it look like you hired some really lousy translators. – JJJ Apr 08 '15 at 21:48
  • 1
    it's a bad idea to use location because some countries have multiple official languages, eg Belgium, South Africa, Canada etc. Check here http://stackoverflow.com/questions/14823022/detect-users-preferred-language-and-google-translate-automatically – Mousey Aug 14 '15 at 16:10
  • @Sourav Ghosh - solution just posted using google translate - http://stackoverflow.com/a/32020855/4258817, which shows the language-picker drop-down box only for non-English users (it's designed for a page in English). Just change the `en` (in two places) for whatever language the page is in. Other solutions are to use a set of flags to represent languages, the user clicks the one they want and it translates. The google website translater will write the code for you. – Mousey Aug 15 '15 at 02:20

1 Answers1

2
http://<URL>#googtrans(1|2)

whrer 1 is the language code of the original webpage language and 2 is the language code to which google will translate.

example:

http://<your website url>#googtrans(en|es)

will translate to Spanish automatically.

Sourav Ghosh
  • 1,964
  • 4
  • 33
  • 43
  • From where came this function googtrans() ? Are you including any js file? – Derzu Jul 11 '20 at 17:59
  • 1
    [Google Website Translator](https://translate.google.com/intl/en/about/website/) is no longer providing new access. Yes. Developers used to add some javascripts for the Google translation to work. – Sourav Ghosh Jul 11 '20 at 20:36