有两种格式,可以把代码添加到:
1、后台/全局/网站第三方统计代码
2、后台/全局/SEO设置/其他/其他头部信息
第一种格式,涵盖了64种语言,如图:
代码:
- <div id="google_translate_element"></div><script type="text/javascript">
- function googleTranslateElementInit() {
- new google.translate.TranslateElement({pageLanguage: 'zh-CN', layout: google.translate.TranslateElement.InlineLayout.SIMPLE, multilanguagePage: true}, 'google_translate_element');
- }
- </script><script type="text/javascript" src="//translate.google.com/translate_a/element.js?cb=googleTranslateElementInit"></script>
复制代码
第二种格式,如图:
代码:
- <div id="google_translate_element">
- </div>
- <script type="text/javascript">
- var showAllGTLanguages=false;
- var listOfGTLanguage="zh-CN,zh-TW,at,sq,ar,hy,az,eu,be,bn,bg,ca,hr,cs,da,nl,en,eo,et,tl,fi,fr,gl,ka,de,el,gu,ht,iw,hi,hu,is,id,ga,it,ja,kn,ko,la,lv,lt,mk,ms,mt,no,fa,pl,pt,ro,ru,sr,sk,sl,es,sw,sv,ta,te,th,tr,uk,ur,vi,cy,yi";
- function googleTranslateElementInit() {
- if(showAllGTLanguages){
- new google.translate.TranslateElement({}, 'google_translate_element');
- }else{
- new google.translate.TranslateElement({includedLanguages:listOfGTLanguage}, 'google_translate_element');
- }
- }
- </script>
- <script type="text/javascript" src="//translate.google.com/translate_a/element.js?cb=googleTranslateElementInit"></script>
复制代码
这个格式,语言可以按自己所需添加,就是把:
- var listOfGTLanguage="zh-CN,zh-TW,at,sq,ar,hy,az,eu,be,bn,bg,ca,hr,cs,da,nl,en,eo,et,tl,fi,fr,gl,ka,de,el,gu,ht,iw,hi,hu,is,id,ga,it,ja,kn,ko,la,lv,lt,mk,ms,mt,no,fa,pl,pt,ro,ru,sr,sk,sl,es,sw,sv,ta,te,th,tr,uk,ur,vi,cy,yi";
复制代码
里边的:
- "zh-CN,zh-TW,at,sq,ar,hy,az,eu,be,bn,bg,ca,hr,cs,da,nl,en,eo,et,tl,fi,fr,gl,ka,de,el,gu,ht,iw,hi,hu,is,id,ga,it,ja,kn,ko,la,lv,lt,mk,ms,mt,no,fa,pl,pt,ro,ru,sr,sk,sl,es,sw,sv,ta,te,th,tr,uk,ur,vi,cy,yi"
复制代码
不需要的删除。
下边是语言的代号:
- "af">Afrikaans>南非荷兰语
- "sq">Albanian>阿尔巴尼亚语
- "ar">Arabic>阿拉伯语
- "hy">Armenian>亚美尼亚语
- "az">Azerbaijani>阿塞拜疆语
- "eu">Basque>巴斯克语
- "be">Belarusian>白俄罗斯语
- "bn">Bengali>孟加拉语
- "bg">Bulgarian>保加利亚语
- "ca">Catalan>加泰罗尼亚语
- "zh-CN">Chinese (Simplified)>中文(简体)
- "zh-TW">Chinese (Traditional)>中文(繁体)
- "hr">Croatian>克罗地亚语
- "cs">Czech>捷克语
- "da">Danish>丹麦语
- "nl">Dutch>荷兰语
- "en">English>英语
- "eo">Esperanto>世界语
- "et">Estonian>爱沙尼亚语
- "tl">Filipino>菲律宾语
- "fi">Finnish>芬兰语
- "fr">French>法语
- "gl">Galician>加利西亚语
- "ka">Georgian>格鲁吉亚语
- "de">German>德语
- "el">Greek>希腊语
- "gu">Gujarati>古吉拉特语
- "ht">Haitian Creole>海地克里奥尔语
- "iw">Hebrew>希伯来语
- "hi">Hindi>印地语
- "hu">Hungarian>匈牙利语
- "is">Icelandic>冰岛语
- "id">Indonesian>印度尼西亚语
- "ga">Irish>爱尔兰语
- "it">Italian>意大利语
- "ja">Japanese>日语
- "kn">Kannada>卡纳达语
- "ko">Korean>韩语
- "la">Latin>拉丁语
- "lv">Latvian>拉脱维亚语
- "lt">Lithuanian>立陶宛语
- "mk">Macedonian>马其顿语
- "ms">Malay>马来语
- "mt">Maltese>马耳他语
- "no">Norwegian>挪威语
- "fa">Persian>波斯语
- "pl">Polish>波兰语
- "pt">Portuguese>葡萄牙语
- "ro">Romanian>罗马尼亚语
- "ru">Russian>俄语
- "sr">Serbian>塞尔维亚语
- "sk">Slovak>斯洛伐克语
- "es">Spanish>西班牙语
- "sw">Swahili>斯瓦希里语
- "sv">Swedish>瑞典语
- "ta">Tamil>泰米尔语
- "te">Telugu>泰卢固语
- "th">Thai>泰语
- "tr">Turkish>土耳其语
- "uk">Ukrainian>乌克兰语
- "ur">Urdu>乌尔都语
- "vi">Vietnamese>越南语
- "cy">Welsh>威尔士语
- "yi">Yiddish>意第绪语
复制代码
|