前端天空

致力于前端开发应用

Translate This Button 在线翻译按钮

08月 25th, 2010

翻译成52种语言的按钮:

只需复制并粘贴您网站上的任何地方TranslateThis按钮,它的自由和方便。有没有文件上传和它在几乎所有网站的作品。

该TranslateThis按钮是一个轻量级的Javascript翻译工具 。它翻译成任何页面快速使用Ajax和谷歌语言的API。

只不过Google在国内访问时断时续不是太稳定

<!-- Begin TranslateThis Button -->

<div id="translate-this"><a href="http://translateth.is/" class="translate-this-button">Translate</a></div>

<script type="text/javascript" src="http://www.google.com/jsapi"></script>
<script type="text/javascript" src="http://x.translateth.is/translate-this.js"></script>
<script type="text/javascript">
TranslateThis();
</script>

<!-- End TranslateThis Button -->

可定制的选项

该TranslateThis按钮允许您设置的选择:

  • 跟踪与谷歌分析
  • 更改按钮图像
  • 更改文本选项
  • 支持的语言更改
  • 回调函数
  • 和更多…

下面这里是测试代码:

提示:你可以先修改部分代码再运行。

详细参数见:http://translateth.is/docs

<script type="text/javascript">
TranslateThis({
    GA : true, // Google Analytics tracking
    scope : 'content', // ID to confine translation
    wrapper : 'translate-this', // ID of the TranslateThis wrapper

    onLoad : function() { alert('loaded') }, // Callback function
    onClick : function() { alert('translation started') },
    onComplete : function() { alert('translation finished') },

    cookie : 'tt-lang', // Name of the cookie - set to 0 to disable

    panelText : 'Translate Into:', // Panel header text
    moreText : '36 More Languages »', // More link text
    busyText : 'Translating page...',
    cancelText : 'cancel',
    doneText : 'Translated by the', // Completion message text
    undoText : 'Undo »', // Text for untranslate link

    fromLang : 'en', // Native language of your site

    ddLangs : [ // Languages in the dropdown
        'cs',
        'pt-PT',
        'it',
        'ru',
        'ar',
        'zh-CN',
        'ja',
        'ko'
    ],

    noBtn : false, //whether to disable the button styling
    btnImg : 'http://x.translateth.is/tt-btn1.png',
    btnWidth : 180,
    btnHeight : 18,

    noImg : false, // whether to disable flag imagery
    imgHeight : 12, // height of flag icons
    imgWidth : 8, // width of flag icons
    bgImg : 'http://x.translateth.is/tt-sprite.png',

    maxLength : 900, // maxLength of strings passed to Google
    reparse : true // whether to reparse the DOM for each translation

});
</script>

Your email address will not be published. Required fields are marked *

*

使用新浪微博登陆

前端天空

致力于前端开发应用