Does anyone know of any automatic translation widgets I could use on my site?

Ask a question+

I’m looking for a widget or an html code I could put on a weebly page, so it can translate the page based on the users computer language or ip address

Mr J 5
add comment

1 Answer


You could do something similar to this:

<!DOCTYPE html>
<html lang="en-US">
<div id="google_translate_element"></div>
<script type="text/javascript">
function googleTranslateElementInit() {
  new google.translate.TranslateElement({pageLanguage: 'en'}, 'google_translate_element');
<script type="text/javascript" src="//translate.google.com/translate_a/element.js?cb=googleTranslateElementInit"></script>

However this means they will have to choose their language.
In the<html lang = "en-US"> you could create a function that determines the language of the computer.
I think javascript would work best for that something like this:

var language = window.navigator.userLanguage || window.navigator.language;
DredF 10
add comment

Your Answer