Wednesday, 22 June 2016

change the language of textbox dynamically usign google API

How to change the language dynamically in textbox using  Google API


To change the language use the "CTRL+G" Key inside textbox


Example:-







 <script src="https://www.google.com/jsapi" type="text/javascript">
</script>
<script type="text/javascript" language="javascript">
    google.load("elements", "1", {
        packages: "transliteration"
    });

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

        var control = new google.elements.transliteration.TransliterationControl(options);
        control.makeTransliteratable(['<%=txt1.ClientID%>']);
   
        //txt11 is the id of the control which you will use for the transliteration.
    }
    google.setOnLoadCallback(onLoad);
</script>


 

<div>
 <div class="Google-transliterate-Way2blogging">
     <%--      <input id="Text1" type="text" style="width:600px;height:200px" />--%>

 <asp:TextBox ID="txt1" runat="server" Width="400" TextMode="MultiLine"></asp:TextBox>


</div>
    </div>

No comments:

Post a Comment