自动翻译网页 [英] Automatically translate web page
本文介绍了自动翻译网页的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
当我输入网页时,如何自动翻译我的网页。
How can I automatically translate my web page when I entered it.
这是我的翻译器已连接到我的下拉列表。
This is my translator there is connected to my dropdown.
<script type="text/javascript">
function googleTranslateElementInit() {
new google.translate.TranslateElement({pageLanguage: 'da', includedLanguages: 'da,de,el,en,es,fi,fr,it,ja,ko,nl,no,pl,ru,sv,uk,zh-CN,zh-TW', layout: google.translate.TranslateElement.FloatPosition.TOP_LEFT, gaTrack: true, gaId: 'UA-32978177-1'}, 'google_translate_element');
}
</script>
<script type="text/javascript" src="//translate.google.com/translate_a/element.js?cb=googleTranslateElementInit">
</script>
我希望它能自动从丹麦语(da)翻译成英语(en)。我已经读过这个函数:
I want it to translate automatically from Danish (da) to English (en). I have read about this function:
http://www.blabla.com/#googtrans(da | en)
我应该在哪里实施它?
推荐答案
您需要创建一个名为google_translate_element的div,这在第一个脚本中提到如下:
You need to create a div called google_translate_element which is mentioned in the first script like this:
<div id="google_translate_element">
Here is the Area where Google fetches the part to be translated
</div>
<script type="text/javascript">
function googleTranslateElementInit() {
new google.translate.TranslateElement({pageLanguage: 'en', layout: google.translate.TranslateElement.FloatPosition.BOTTOM_RIGHT, multilanguagePage: true}, 'google_translate_element');
}
</script>
第二个脚本生成一个很好的小语言选择:
This second script generates a nice tiny language selection :
<script type="text/javascript" src="//translate.google.com/translate_a/element.js?cb=googleTranslateElementInit">
</script>
如果您希望隐藏生成的Google翻译栏(第一个脚本):
And if you wish to hide the resulting Google translation bar (first script) :
<style>
.goog-te-banner-frame.skiptranslate {
display: none !important;
} body { top: 0px !important; }
.goog-tooltip {
display: none !important;
}
.goog-tooltip:hover {
display: none !important;
}
.goog-text-highlight {
background-color: transparent !important;
border: none !important;
box-shadow: none !important;
}
</style>
这篇关于自动翻译网页的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文