在 Google 中出现错误 在 javascript 中音译 API
Getting error in Google Transliterate API in javascript
我在我的项目中使用 Google 音译 API 将英语文本翻译成古吉拉特语。它工作正常,但是我现在在 google-jsapi 中遇到问题。
这是我的代码:
<script type="text/javascript" src="http://www.google.com/jsapi"></script>
<script>
google.load("elements", "1", {
packages: "transliteration"
});
function onLoad() {
var options = {
sourceLanguage: 'en',
destinationLanguage: ['gu'],
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 textfields with the given ids.
var ids = [ "cus_name", "address"];
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>
错误:
Loading elements other than inputtools with the jsapi loader is unsupported. Ec @ loader.js:90
Uncaught Error: Must call google.charts.load before google.charts.setOnLoadCallback
at Object.E.M [as setOnLoadCallback] (loader.js:87)
at test.html:32
我已经查看了 Google 的 API 开发人员指南..但是这也导致了同样的问题。
来源:https://developers.google.com/transliterate/v1/getting_started
请帮我解决这个问题。
它发生在整个网络上。所以我使用了旧版本的 jsapi,它在我的站点上工作 http://vaani.neechalkaran.com/ script is http://vaani.neechalkaran.com/Scripts/google_jsapi.js
我在我的项目中使用 Google 音译 API 将英语文本翻译成古吉拉特语。它工作正常,但是我现在在 google-jsapi 中遇到问题。
这是我的代码:
<script type="text/javascript" src="http://www.google.com/jsapi"></script>
<script>
google.load("elements", "1", {
packages: "transliteration"
});
function onLoad() {
var options = {
sourceLanguage: 'en',
destinationLanguage: ['gu'],
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 textfields with the given ids.
var ids = [ "cus_name", "address"];
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>
错误:
Loading elements other than inputtools with the jsapi loader is unsupported. Ec @ loader.js:90
Uncaught Error: Must call google.charts.load before google.charts.setOnLoadCallback at Object.E.M [as setOnLoadCallback] (loader.js:87) at test.html:32
我已经查看了 Google 的 API 开发人员指南..但是这也导致了同样的问题。
来源:https://developers.google.com/transliterate/v1/getting_started
请帮我解决这个问题。
它发生在整个网络上。所以我使用了旧版本的 jsapi,它在我的站点上工作 http://vaani.neechalkaran.com/ script is http://vaani.neechalkaran.com/Scripts/google_jsapi.js