我有一个用英语创建的网页。根据大陆的不同,我想把我的整个网页动态地翻译成另一种语言。
这个网页相当复杂,所以我不能一串接一串地做。
我可以使用Google translate API来翻译我的网页吗?
发布于 2011-12-07 08:57:56
下面是一个将Google translator添加到网页以翻译特定元素的示例:
<html>
<head>
<title>My Page</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head>
<body>
<div class="translate">Тестирование</p>
<div class="translate_control" lang="en"></div>
<script>
function googleSectionalElementInit() {
new google.translate.SectionalElement({
sectionalNodeClassName: 'translate',
controlNodeClassName: 'translate_control',
background: '#f4fa58'
}, 'google_sectional_element');
}
</script>
<script src="//translate.google.com/translate_a/element.js?cb=googleSectionalElementInit&ug=section&hl=en"></script>
</body>
</html>
http://jsfiddle.net/maxim75/H3Wkr/ -工作示例
发布于 2011-02-10 01:07:39
您可以在您的页面上添加一个Google Translate小部件,用户可以根据需要翻译成他们选择的语言。http://www.google.com/webelements/#!/translate
发布于 2012-04-16 11:17:58
通过访问google translate tool,它会生成一个代码,您可以将其添加到您的网站中。
也可以直接使用url。
http://www.google.com/translate?sl=XX&tl=YY&u=http://www.trial.com
其中xx是原始语言,yy是要翻译的语言...
也许我的教程会对你有所帮助:google translate。
https://stackoverflow.com/questions/4943035
复制相似问题