Type in another Language in Asp.Net TextBox (Google Transliteration )

Hello,

Some time as per client requirement we need TextBox which support different language.

We can do this by using  Google Transliteration.

use below code to achieve this.







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



<!DOCTYPE html>



<html xmlns="http://www.w3.org/1999/xhtml">

<head runat="server">

    <title></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 Language

                sourceLanguage: google.elements.transliteration.LanguageCode.ENGLISH,

                // Destination language to Transliterate

                destinationLanguage: [google.elements.transliteration.LanguageCode.HINDI],

                transliterationEnabled: true

            };



            var control = new google.elements.transliteration.TransliterationControl(options);

            control.makeTransliteratable(['txtInput']);



        }

        google.setOnLoadCallback(onLoad);

</script>

</head>

<body>

    <form id="form1" runat="server">

    <div>

    <asp:TextBox id="txtInput" runat="server" style="border: 2px solid Blue; height: 200px; margin-left: auto; width: 600px;" textmode="MultiLine"/>



    </div>

    </form>

</body>



</html>



Below is screen shot of my application..


This code support all the language which support by google..

Let me know in case of query.

Enjoy !!

Posted in |

0 comments:

Post a Comment