duanqin7791 2012-01-28 06:28
浏览 19
已采纳

允许输入其他语言

How can I enable user to type in Bengali in textarea in my website's textarea using Google's feature which can automatically translate typed English word to proper Bengali word ?

  • 写回答

3条回答 默认 最新

  • doujiu8826 2012-01-28 06:50
    关注
    *BEfore that signup for the API key http://code.google.com/apis/loader/signup.html*
    <pre>
    <html>
      <head>
        <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
        <script type="text/javascript" src="https://www.google.com/jsapi?key=INSERT-YOUR-KEY">
        </script>
        <script type="text/javascript">
    
          // Load the Google Transliterate API
          google.load("elements", "1", {
                packages: "transliteration"
              });
    
          function onLoad() {
            var options = {
                sourceLanguage:
                    google.elements.transliteration.LanguageCode.ENGLISH,
                destinationLanguage:
                    [google.elements.transliteration.LanguageCode.BENGALI],
                shortcutKey: 'ctrl+g',
                transliterationEnabled: true
            };
    
            // Create an instance on TransliterationControl with the required
            // options.
            var control =
                new google.elements.transliteration.TransliterationControl(options);
    
            // Enable transliteration in the textbox with id
            // 'transliterateTextarea'.
            control.makeTransliteratable(['transliterateTextarea']);
          }
          google.setOnLoadCallback(onLoad);
        </script>
      </head>
      <body>
        Type in BENGALI (Press Ctrl+g to toggle between English and BENGALI)<br>
        <textarea id="transliterateTextarea" style="width:600px;height:200px"></textarea>
      </body>
    </html> 
    </pre>
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(2条)

报告相同问题?

悬赏问题

  • ¥15 求解O-S方程的特征值问题给出边界层布拉休斯平行流的中性曲线
  • ¥15 谁有desed数据集呀
  • ¥20 手写数字识别运行c仿真时,程序报错错误代码sim211-100
  • ¥15 关于#hadoop#的问题
  • ¥15 (标签-Python|关键词-socket)
  • ¥15 keil里为什么main.c定义的函数在it.c调用不了
  • ¥50 切换TabTip键盘的输入法
  • ¥15 可否在不同线程中调用封装数据库操作的类
  • ¥15 微带串馈天线阵列每个阵元宽度计算
  • ¥15 keil的map文件中Image component sizes各项意思