Friday, November 29, 2013

Convert English Language to Other Language Using Google API.

Just Copy and Paste the Code in .aspx Page :
Change HINDI language to other as per your requirement.
Note : Write the Language Name in Capital letter.  




<%@ Page Language="C#" AutoEventWireup="true" CodeFile="tans.aspx.cs" Inherits="tans" %>
<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
    <title>Language converter using goole api </title>
   <script src="https://www.google.com/jsapi" type="text/javascript">
    </script>
    <script language="javascript" type="text/javascript">
        google.load("elements", "1", { packages: "transliteration" });

        function onLoad() {
            var options = {
                //Source for  Language
                sourceLanguage: google.elements.transliteration.LanguageCode.ENGLISH,
                // Destination language to Transliterate
                destinationLanguage: [google.elements.transliteration.LanguageCode.HINDI],
                shortcutKey: 'ctrl+g',
                transliterationEnabled: true
            };

            var control = new google.elements.transliteration.TransliterationControl(options);
            control.makeTransliteratable(['TextBox1']); // for .aspx page
            //control.makeTransliteratable(['<%=TextBox1.ClientID%>']); for Master page use

        }
        google.setOnLoadCallback(onLoad);
</script>

</head>
<body>
    <form id="form1" runat="server">
   <div>

    <asp:textbox id="TextBox1" runat="server" style="border: 1px solid black; height: 110px; margin-left: auto; width: 500px;" textmode="MultiLine"/>
</div>
</form>
</body>
</html>





No comments:

Post a Comment