如何在网站中使用Google输入工具 [英] How to Use Google Input Tools in Website

查看:114
本文介绍了如何在网站中使用Google输入工具的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如果可以使用jquery或纯javascript等客户端脚本在网站中使用Google输入工具,请告诉我们吗? Google输入工具是否有可用的API?

Can you please let me know if it is possible to use Google Input Tools in a website using client side scripting like jquery or pure javascript? Is there any API available for Google Input Tools?

我已经谷歌这个但找不到任何东西?

I already google this but couldn't find any thing?

谢谢

推荐答案

如果您想添加谷歌输入工具,可以使用下面的代码添加它

If you want to add google input tools you can use below code to add it

<script type="text/javascript" src="http://www.google.com/jsapi"></script>

<script type="text/javascript">
  // Load the Google Transliteration API
  google.load("elements", "1", {
    packages: "transliteration"
  });

  function onLoad() {
    var options = {
      sourceLanguage: 'en',
      destinationLanguage: ['ml', 'hi', 'kn', 'ta', 'te'],
      shortcutKey: 'ctrl+m',
      transliterationEnabled: true
    }

    // Create an instance on TransliterationControl with the required options.
    var control = new google.elements.transliteration.TransliterationControl(options);

    // Enable transliteration in the textfields with the given ids.
    var ids = ["language"];
    control.makeTransliteratable(ids);

    // Show the transliteration control which can be used to toggle between English and Hindi and also choose other destination language.
    control.showControl('translControl');
  }

  google.setOnLoadCallback(onLoad);
</script>

文字区域

<form><textarea name="ta"  rows="6"  id="language" cols="6" style="width:600px;height:218px" ></textarea></form>

这篇关于如何在网站中使用Google输入工具的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆