Answer the question
In order to leave comments, you need to log in
How to make automatic page translation depending on the browser language?
There is such a Google translate code that gives a list of languages into which to translate the page
<div class="lan">
<div id="google_translate_element"></div><script type="text/javascript">
function googleTranslateElementInit() {
new google.translate.TranslateElement({pageLanguage: 'es', includedLanguages: 'bn,da,de,en,es,fr,lb,nl,no,pt,sv', layout: google.translate.TranslateElement.InlineLayout.SIMPLE}, 'google_translate_element');
}
var userLang = navigator.language || navigator.userLanguage;
console.log(userLang);
</script><script type="text/javascript" src="//translate.google.com/translate_a/element.js?cb=googleTranslateElementInit"></script><div class="lan">
<div id="google_translate_element"></div><script type="text/javascript">
function googleTranslateElementInit() {
new google.translate.TranslateElement({pageLanguage: 'es', includedLanguages: 'bn,da,de,en,es,fr,lb,nl,no,pt,sv', layout: google.translate.TranslateElement.InlineLayout.SIMPLE}, 'google_translate_element');
}
var userLang = navigator.language || navigator.userLanguage;
console.log(userLang);
</script><script type="text/javascript" src="//translate.google.com/translate_a/element.js?cb=googleTranslateElementInit"></script>
var userLang = navigator.language || navigator.userLanguage;
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question