Translate english to hindi by google api

December 8, 2010 | In: ajax, javascript, php, web development

Sometimes we need to develop a website with Hindi font. But main problem is how to insert content in Hindi in admin panel. so here is a solution by this admin can enter content in Hindi font.
It will work like: When admin type any word like ‘welcm‘ and then type space it will automatically convert into ‘वेलकम

<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
    <title>Translate English to Hindi</title>
    <script type="text/javascript" src="http://www.google.com/jsapi"></script>
    <script type="text/javascript">
      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
        };
 
        var control =
            new google.elements.transliteration.TransliterationControl(options);
 
        // Enable transliteration in the editable elements with id
        // 'transliterateDiv'.
        control.makeTransliteratable(['transliterateDiv']);
        control.makeTransliteratable(['transliterateDiv2']);
      }
      google.setOnLoadCallback(onLoad);
    </script>
  </head>
  <body>
  	<textarea name="description" cols="100" rows="10" style="border:1px solid #999999; color:#333333; font-size:12px;" id="transliterateDiv"></textarea>
  	<textarea name="description2" cols="100" rows="10" style="border:1px solid #999999; color:#333333; font-size:12px;" id="transliterateDiv2"></textarea>
  </body>
</html>



4 Responses to Translate english to hindi by google api

Avatar

Buy Guaranteed Facebook Fans

November 28th, 2011 at 7:00 pm

Related.. Trackback…

[…]the time to read or visit the content or sites we have linked to below the[…]…

Avatar

Homepage

August 15th, 2012 at 4:07 pm

… [Trackback]…

[…] Informations on that Topic: naveenos.com/2010/12/translate-english-to-hindi-by-google-api.html […]…

Avatar

میر شکیل حسین

April 21st, 2013 at 7:14 am

i want (transliterateDiv) to keep original text and (transliterateDiv2) should display translaated text

Avatar

DesiGirlsPhone

May 11th, 2017 at 2:38 am

GOOD

Comment Form

Leave a Reply

Your email address will not be published. Required fields are marked *

*

Categories

Latest comments


    Fatal error: Uncaught Error: Call to undefined function split() in /home4/nos/public_html/naveenos.com/wp-content/themes/smoker/functions.php:72 Stack trace: #0 /home4/nos/public_html/naveenos.com/wp-content/themes/smoker/sidebar.php(11): mdv_recent_comments() #1 /home4/nos/public_html/naveenos.com/wp-content/themes/smoker/single.php(47): include('/home4/nos/publ...') #2 /home4/nos/public_html/naveenos.com/wp-includes/template-loader.php(74): include('/home4/nos/publ...') #3 /home4/nos/public_html/naveenos.com/wp-blog-header.php(19): require_once('/home4/nos/publ...') #4 /home4/nos/public_html/naveenos.com/index.php(17): require('/home4/nos/publ...') #5 {main} thrown in /home4/nos/public_html/naveenos.com/wp-content/themes/smoker/functions.php on line 72