I need to create a button that will be able to toggle the language of a page\'s content between French and English.
How can I use the Google Translate API for this?<
Does this help :
<div id="google_translate_element"></div>
<script>
function googleTranslateElementInit() {
new google.translate.TranslateElement({
// here is where you change the language
pageLanguage: 'en'
}, 'google_translate_element');
}
</script>
<script src="//translate.google.com/translate_a/element.js?cb=googleTranslateElementInit"></script>
Source