Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to trigger the google chrome website translation popup?

Morning yall, I´m currently trying to get the google chrome in build browser translation system to work.

I added the lang=de attribute to my html tag and included some text in another language. However I still need to do right click and then click on translate in order for chrome to translate the page.

Image of my local page not showing the popup

However on pages like paris.fr there is a google translate popup that activates automaticly.

Image of paris.fr google translation popup

like image 969
Doppelbemme Avatar asked Sep 16 '25 11:09

Doppelbemme


1 Answers

Perhaps because of the lang="de" meta, it's not bothering to look for other languages (and it looks like your settings are to offer to translate non-German languages to German), but I think that is unlikely since according to Google documentation, they don't use the lang attribute, and using a single language is the best way to help detect page language.

You could use the Google Translate API and add extra buttons or something to offer the translation, if you're willing to either do some extra work figuring how to detect user's language preferences (maybe using something like Navigator.language) or always showing Google Translate button/drop-down near that section regardless of user preferences.

like image 182
Driftr95 Avatar answered Sep 19 '25 01:09

Driftr95