如何使用C#将Google Translator与ASP.NET集成 [英] How to Integrate Google Translator with ASP.NET using C#

查看:85
本文介绍了如何使用C#将Google Translator与ASP.NET集成的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何使用C#将Google Translator与ASP.NET集成以将英语转换为Kannada

解决方案

以下是在输入时将输入的文本转换为kannada的示例代码(音译):



假设你的aspx页面上有一个文本框txtDetails。



< script type =   text / javascript src =   https://www.google.com/jsapi > 
< / script>
< script type = text / javascript>

// 加载Google Transliterate API
google.load ( elements 1,{
packages: transliteration
});

function onLoad(){
var options = {
sourceLanguage:
google.elements.transliteration.LanguageCode.ENGLISH,
destinationLanguage:
google.elements.transliteration.LanguageCode.KANNADA,
shortcutKey:' ctrl + g'
transliterationEnabled: true
};

// 使用所需的
在TransliterationControl上创建实例 // options。
var control =
new google.elements.transliteration.TransliterationControl(options);

// 在文本框中启用音译,内容为
< span class =code-comment> //
'transliterateTextarea'。
control.makeTransliteratable([' txtDetails']);
}
google.setOnLoadCallback(onLoad);
< / script>





翻译请参阅:

http://weblogs.asp.net/jalpeshpvadgama/archive/2010/ 05/18 / google-translation-api-integration-in-net.aspx [ ^ ]


 

' 简单易用翻译,但首先你需要在谷歌上注册帐户和需要使用令牌或ID访问API使用此必须传递所需的值和测试语言和语言代码进行转换。

它'
是这样的: new google.translate.TranslateElement({pageLanguage:' en',layout:google.translate.TranslateElement.InlineLayout.SIMPLE},' google_translate_element'

请检查谷歌API,他们还指导 与蚀刻步骤相同。

谢谢,
AP


使用翻译很简单,但首先你必须在谷歌帐户上注册并需要使用令牌或ID来访问API,您必须通过所需的值和测试语言和语言代码进行转换。 


How to Integrate Google Translator with ASP.NET using C# to convert English to Kannada

解决方案

Here is the example code to convert the entered text to kannada while typing(transliteration):

Suppose you have a textbox "txtDetails" on your aspx page.

<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.KANNADA,
                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 textbox with id
            // 'transliterateTextarea'.
            control.makeTransliteratable(['txtDetails']);
        }
        google.setOnLoadCallback(onLoad);
    </script>



For translation see:
http://weblogs.asp.net/jalpeshpvadgama/archive/2010/05/18/google-translation-api-integration-in-net.aspx[^]


Hi,

It's simple to play with a translator, but first you have to register on google account and need to take token or ID to access the API using this you have to pass required value and test language and language code to be convert. 

It's like that: new google.translate.TranslateElement({ pageLanguage: 'en', layout: google.translate.TranslateElement.InlineLayout.SIMPLE }, 'google_translate_element')

Please check on google API they also guide for the same with etch steps.

Thanks,
AP


It's simple to play with a translator, but first you have to register on google account and need to take token or ID to access the API using this you have to pass required value and test language and language code to be convert. 


这篇关于如何使用C#将Google Translator与ASP.NET集成的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆