Google翻译网站 [英] Google Translate Website
问题描述
因此,我为我的网站使用Google翻译工具 -
我通过以下方式设置: https://translate.google.com/manager/website
在显示模式下,我一直选择自动,但它看起来像横幅总是显示甚至尽管他们声明只会显示浏览器不是网站的语言(即EN)
发生了什么事?他们的工具是否损坏?有没有一种方法可以使用这个工具来显示语言是否不是en? 解决方案
将下面的代码粘贴到您的网站上。 includedLanguages中googleTranslateElementInit()中提到的语言将显示在您的网站上。
我建议您将其粘贴到网站标题或页脚部分,以便翻译功能可以在您网站的每个页面上生成。 p>
< div id =google_translate_element>< / div>
< script type =text / javascript>
function googleTranslateElementInit(){
new google.translate.TranslateElement({pageLanguage:'en',includedLanguages:'en,fr,es,it,de'},'google_translate_element');
}
< / script>
< script type =text / javascriptsrc =// translate.google.com/translate_a/element.js?cb=googleTranslateElementInit\"> ;</script>
另外,如果您正在寻找特定语言的自动翻译,请使用此代码。
< script>
(function(){
if(!window.location.hash){
window.location = window.location +'#googtrans(en | fr)';
window .location.reload();
}
})();
< / script>
So I am using the google translate tool for my website- I am setting it up via: https://translate.google.com/manager/website
Under display mode, I keep choosing automatic but it looks like the banner ALWAYS displays even though they state it will ONLY show if the browser is not the language of the site (which is EN)
What's going on? Is their tool broken? is there a way to use this tool to just show if the language is not en?
Paste the code below on your website. Languages mentioned in includedLanguages in googleTranslateElementInit() will display on your website.
I will suggest you to paste this in website header or footer section so that translation feature will yield on every page of your website.
<div id="google_translate_element"></div>
<script type="text/javascript">
function googleTranslateElementInit() {
new google.translate.TranslateElement({pageLanguage: 'en', includedLanguages: 'en,fr,es,it,de'}, 'google_translate_element');
}
</script>
<script type="text/javascript" src="//translate.google.com/translate_a/element.js?cb=googleTranslateElementInit"></script>
Also if you are looking for auto translate in specific language then use this code along with above.
<script>
(function() {
if(!window.location.hash) {
window.location = window.location + '#googtrans(en|fr)';
window.location.reload();
}
})();
</script>
这篇关于Google翻译网站的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!