我在我的项目中使用 Google Transliterate 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
// …
Run Code Online (Sandbox Code Playgroud)