我使用以下代码将English
翻译为German
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<script type="text/javascript" src="https://www.google.com/jsapi">
</script>
<script type="text/javascript">
// 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.HINDI],
shortcutKey: 'ctrl+e',
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
// 'transliterateTextarea'.
control.makeTransliteratable(['transliterateTextarea']);
}
google.setOnLoadCallback(onLoad);
</script>
</head>
<body>
<span>English to German</span><br>
<form runat="server">
<div>
<asp:TextBox ID="transliterateTextarea" runat="server" TextMode="MultiLine" Rows="5"
Columns="50" />
</div>
</form>
</body>
</html>
English
到Hindi
其工作正常。但它不适用于English
到German
。我希望将English
转换为German
帮助非常感谢。提前致谢
答案 0 :(得分:1)
您用于转换的代码是英语到德语,但遗憾的是,Transliterate API不支持google.elements.transliteration.LanguageCode./(German)
。
全部包含Transliterate API支持的所有语言。
var google.elements.transliteration.SupportedDestinationLanguages = {
// As support for more languages becomes available, this enum will be
// automatically updated to include the new languages transparently.
ALL: [
google.elements.transliteration.LanguageCode.AMHARIC,
google.elements.transliteration.LanguageCode.ARABIC,
google.elements.transliteration.LanguageCode.BENGALI,
google.elements.transliteration.LanguageCode.CHINESE,
google.elements.transliteration.LanguageCode.GREEK,
google.elements.transliteration.LanguageCode.GUJARATI,
google.elements.transliteration.LanguageCode.HINDI,
google.elements.transliteration.LanguageCode.KANNADA,
google.elements.transliteration.LanguageCode.MALAYALAM,
google.elements.transliteration.LanguageCode.MARATHI,
google.elements.transliteration.LanguageCode.NEPALI,
google.elements.transliteration.LanguageCode.ORIYA,
google.elements.transliteration.LanguageCode.PERSIAN,
google.elements.transliteration.LanguageCode.PUNJABI,
google.elements.transliteration.LanguageCode.RUSSIAN,
google.elements.transliteration.LanguageCode.SANSKRIT,
google.elements.transliteration.LanguageCode.SERBIAN,
google.elements.transliteration.LanguageCode.SINHALESE,
google.elements.transliteration.LanguageCode.TAMIL,
google.elements.transliteration.LanguageCode.TELUGU,
google.elements.transliteration.LanguageCode.TIGRINYA,
google.elements.transliteration.LanguageCode.URDU],
// INDIC includes all Indic languages supported in the Transliterate API.
// As support for more Indic languages becomes available, this enum will be
// automatically updated to include the new languages transparently.
INDIC: [
google.elements.transliteration.LanguageCode.BENGALI,
google.elements.transliteration.LanguageCode.GUJARATI,
google.elements.transliteration.LanguageCode.HINDI,
google.elements.transliteration.LanguageCode.KANNADA,
google.elements.transliteration.LanguageCode.MALAYALAM,
google.elements.transliteration.LanguageCode.MARATHI,
google.elements.transliteration.LanguageCode.NEPALI,
google.elements.transliteration.LanguageCode.ORIYA,
google.elements.transliteration.LanguageCode.PUNJABI,
google.elements.transliteration.LanguageCode.SANSKRIT,
google.elements.transliteration.LanguageCode.SINHALESE,
google.elements.transliteration.LanguageCode.TAMIL,
google.elements.transliteration.LanguageCode.TELUGU,
google.elements.transliteration.LanguageCode.URDU]
};