在本例中,startArea值用于将文本从一种语言转换为另一种语言,并将其自身置于其中。
为什么我要将转换后文本放到finalId元素中。
我在翻译API中搜索了一下,没有找到任何答案。是否有任何与API相关的支持。
下面是我使用的脚本
<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);发布于 2015-03-17 23:59:41
Google Transliterate API已被弃用,我认为您在加载呈现无用逻辑的页面时会得到一个Javascript错误。
在任何情况下,您都可以遵循this section来加载“音译”库,并在需要时使用那里的函数调用直接进行音译。结果将是回调函数的参数。
https://stackoverflow.com/questions/28959585
复制相似问题