Click here to Skip to main content
15,881,092 members
Please Sign up or sign in to vote.
5.00/5 (3 votes)
See more:
How to Integrate Google Translator with ASP.NET using C# to convert English to Kannada
Posted
Updated 17-Jan-17 19:15pm
Comments
aniket_Patil 26-Mar-13 0:47am    
but where we display translated text.???

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.

JavaScript
<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[^]
 
Share this answer
 
Comments
Ocean007 26-Jun-13 11:14am    
gud code worked for me thnx ;)
C#
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
 
Share this answer
 
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. 
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900