首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >Google音译值放在另一个div中

Google音译值放在另一个div中
EN

Stack Overflow用户
提问于 2015-03-10 16:59:40
回答 1查看 100关注 0票数 0

在本例中,startArea值用于将文本从一种语言转换为另一种语言,并将其自身置于其中。

为什么我要将转换后文本放到finalId元素中。

我在翻译API中搜索了一下,没有找到任何答案。是否有任何与API相关的支持。

下面是我使用的脚本

代码语言:javascript
复制
 <textarea id="startArea" style="width:600px;height:200px"></textarea>

 <textarea id="finalId" readonly="readonly" style="width:600px;height:200px"></textarea>



// 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.TELUGU],
          shortcutKey: 'alt+t',
          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
        // 'startArea'.

        control.makeTransliteratable(['startArea']);

    }
    google.setOnLoadCallback(onLoad);
EN

回答 1

Stack Overflow用户

发布于 2015-03-17 23:59:41

Google Transliterate API已被弃用,我认为您在加载呈现无用逻辑的页面时会得到一个Javascript错误。

在任何情况下,您都可以遵循this section来加载“音译”库,并在需要时使用那里的函数调用直接进行音译。结果将是回调函数的参数。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/28959585

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档