很多时候,可能我们web项目中需要的只是机械式的翻译,并不需要什么利用xml或者js json等等实现逼真翻译,那样工作量太大。这时候可能你就需要这几款小工具来帮助你。当然,如果

对翻译或者你的项目外国用户非常多的话,还是介绍自己动 手做语言切换,毕竟工具翻译是机械翻译。

 

本文转自:谷歌/微软/必应web页面免费翻译插件

1、谷歌翻译

 1 <!DOCTYPE html>
 2 
 3 <html lang="en" xmlns="http://www.w3.org/1999/xhtml">
 4 <head>
 5     <meta charset="utf-8" />
 6     <title>TranslateTool</title>
 7 </head>
 8 <body>
 9     <div>Just do it.</div>
10     <!--谷歌翻译-->
11     <div id="google_translate_element"></div>
12     <script>
13         function googleTranslateElementInit() {
14             new google.translate.TranslateElement({
15                 layout: google.translate.TranslateElement.InlineLayout.HORIZONTAL
16             }, 'google_translate_element');
17         }
18     </script>
19     <script src="http://translate.google.com/translate_a/element.js?cb=googleTranslateElementInit"></script>
20 </body>
21 </html>

View Code

2、微软翻译

 1 <!DOCTYPE html>
 2 
 3 <html lang="en" xmlns="http://www.w3.org/1999/xhtml">
 4 <head>
 5     <meta charset="utf-8" />
 6     <title></title>
 7 </head>
 8 <body>
 9     <div>Just do it.</div>
10     <!--微软翻译-->
11     <div id="MicrosoftTranslatorWidget" style=" 100%; min-height: 57px; border-color: #170D07;
12         background-color: #362F2A;">
13         <noscript>
14             <a href="http://www.microsofttranslator.com/bv.aspx?a=http%3a%2f%2flocalhost%2f">
15                 Translate
16                 this page
17             </a>
18             <br />
19             Powered by <a href="http://www.microsofttranslator.com">Microsoft® Translator</a>
20         </noscript>
21     </div>
22     <script type="text/javascript">
23         /* <![CDATA[ */setTimeout(function () {
24             var s = document.createElement("script");
25             s.type = "text/javascript";
26             s.charset = "UTF-8";
27             s.src = "http://www.microsofttranslator.com/Ajax/V2/Widget.aspx"
28                 + "?mode=auto"
29                 + "&from=en"
30                 + "&layout=ts"
31                 + "&appId=<%= InteractiveSDK.Properties.Settings.Default.WidgetAppId %>";
32             var p = document.getElementsByTagName('head')[0] || document.documentElement; p.insertBefore(s, p.firstChild);
33         }, 0);
34         /* ]]> */
35     </script>
36 </body>
37 </html>

View Code

3、

 1 <!DOCTYPE html>
 2 
 3 <html lang="en" xmlns="http://www.w3.org/1999/xhtml">
 4 <head>
 5     <meta charset="utf-8" />
 6     <title></title>
 7 </head>
 8 <body>
 9     <div>Just do it.</div>
10     <div>Just do it.</div>
11     <div>Just do it.</div>
12     <div>Just do it.</div>
13     <div>Just do it.</div>
14     <!--必应翻译-->
15     <div id='MicrosoftTranslatorWidget' class='Dark' style='color:white;background-color:#555555'></div>
16     <script type='text/javascript'>setTimeout(function () { { var s = document.createElement('script'); s.type = 'text/javascript'; s.charset = 'UTF-8'; s.src = ((location && location.href && location.href.indexOf('https') == 0) ? 'https://ssl.microsofttranslator.com' : 'http://www.microsofttranslator.com') + '/ajax/v3/WidgetV3.ashx?siteData=ueOIGRSKkd965FeEGM5JtQ**&ctf=True&ui=true&settings=Manual&from='; var p = document.getElementsByTagName('head')[0] || document.documentElement; p.insertBefore(s, p.firstChild); } }, 0);</script>
17 </body>
18 </html>

View Code