Posted By

kashif21 on 05/10/11


Tagged


Versions (?)

Simple code to write diffrent languges in you text box by using google transliteration


 / Published in: ASP
 

  1. <html xmlns="http://www.w3.org/1999/xhtml">
  2. <head runat="server">
  3. <title></title>
  4. *Note for the time beign the transliteration will be from English to URDU
  5. //just copy and paste and use this generic foriegn language text box,you just need to replace URDU with any language like(AMHARIC,ARABIC,BENGALI,GREEK and many more...!)
  6.  
  7. <script src="https://www.google.com/jsapi" type="text/javascript">
  8. </script>
  9. <script type="text/javascript" language="javascript">
  10. google.load("elements", "1", {
  11. packages: "transliteration"
  12. });
  13.  
  14. function onLoad() {
  15. var options = {
  16. sourceLanguage: google.elements.transliteration.LanguageCode.ENGLISH,
  17. destinationLanguage: [google.elements.transliteration.LanguageCode.URDU],
  18. shortcutKey: 'ctrl+g',
  19. transliterationEnabled: true
  20. };
  21.  
  22. var control = new google.elements.transliteration.TransliterationControl(options);
  23. control.makeTransliteratable(['Text1']);
  24. //TEXT1 is the id of the control which you will use for the transliteration.
  25. }
  26. google.setOnLoadCallback(onLoad);
  27. </script>
  28. </head>
  29. <body >
  30. <form id="form1" runat="server">
  31. <div>
  32. <div class="Google-transliterate-Way2blogging">
  33. <input id="Text1" type="text" />
  34.  
  35. //if text area rquired
  36. // <textarea id="transliterateTextarea" style="width:600px;height:200px" cols="10" rows="10"></textarea>
  37.  
  38. </div>
  39. </div>
  40. </form>
  41. </body>
  42. </html>

Report this snippet  

You need to login to post a comment.