我需要两个不同的Google Translate Widgets用于网站。
问题是只有一个实例正在初始化。
<header>
<div id="google_translate_element"></div>
<script type="text/javascript">
function googleTranslateElementInit1() {
new google.translate.TranslateElement({
pageLanguage: 'en',
layout: google.translate.TranslateElement.InlineLayout.SIMPLE
}, 'google_translate_element');
}
</script>
<script type="text/javascript" src="//translate.google.com/translate_a/element.js?cb=googleTranslateElementInit1">
</script>
</header>
<footer>
<div id="google_translate_element_bottom"></div>
<script type="text/javascript">
function googleTranslateElementInit2() {
new google.translate.TranslateElement({
pageLanguage: 'en',
includedLanguages: 'fr, de',
layout: google.translate.TranslateElement.InlineLayout.SIMPLE
}, 'google_translate_element_bottom');
}
</script>
<script type="text/javascript" src="//translate.google.com/translate_a/element.js?cb=googleTranslateElementInit2">
</script>
</footer>
https://jsfiddle.net/vmyb1qxn/
我也找不到API文档。