Share Blog

Saturday, August 01, 2015

Google Langauge Translator English To Hindi in C#

<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Translator.aspx.cs" Inherits="Translator" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
 
    <script type="text/javascript" src="https://www.google.com/jsapi"></script>
    <title>Transliteration in English To Hindi</title>
    <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+g',
                transliterationEnabled: true
            };

            // Create an instance on TransliterationControl with the required
            // options.
            var control =
            new google.elements.transliteration.TransliterationControl(options);

            // Enable transliteration in the editable DIV with id
            // 'transliterateDiv'.
            control.makeTransliteratable(['transliterateDiv']);
        }
        google.setOnLoadCallback(onLoad);
    </script>

</head>
<body>
    <form id="form1" runat="server">
    <br />
    <br />
    <br />
    Translation in Hindi (Press Ctrl+g to toggle between English and Hindi)<br>
    <div id="transliterateDiv" contenteditable="true" style="width:500px;height:250px;border:1.5px solid;overflow-y:scroll" >
    </div>
   
    </form>
</body>
</html>



Result


No comments:

Post a Comment