我正在使用谷歌输入工具来创建不同的语言,如西班牙语,希腊语,土耳其语等。 我的代码如下:
<script type="text/javascript">
var editorId='';
// Load the Google Transliterate API
google.load("elements", "1", {
packages: "transliteration"
});
function onLoad() {
var options = {
sourceLanguage: 'en',
destinationLanguage: ['el','kn','ml','ta','te'],
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 = [ "transl2" ];
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);
console.log(google);
</script>
<script>
问题是:翻译只翻译印度语。当我尝试将目标语言更改为目标语言时:作为['es'] 哪个显示的错误,谷歌语言数组不包含'es'但谷歌说es是用于西班牙语。我怎么能解决它?
答案 0 :(得分:0)
您无法将西班牙语添加为目标语言。以下是您可以添加为目标语言的语言列表。
Object reference not set to an instance of an object
上找到更多信息