Hello,

First Of all , Transliteration is an awesome research and development
work from Google.


I want to know about the commercial usage of Google's Transliteration
Api's(IE. it's free to use or not , limitations for the usage ,
restrictions , support from google in development with their fees for
that ) and about the detailed TOS.

Also having a query to the api , as i am developing a simple form
which contains numerous text fields to enter the deatils like ,
FirstName,LastName,Address Line1,Address Line2,Email and Phone Number
and furthur i want to apply google transliteration Api to that form
for converting the entered text field data in english to show both the
types on the form  i.e . The Source Language or the Default and The
Destination Language .


Second , the form that i have created using jsapi.js have a feature to
show the text entered in a text field in english and then to show that
entered text field data converted in parrallel fields using jquery in
the desired language (like hindi,tamil,singhalese,german etc ..)


Problem :  The problem coming with this code is when we provide a
space after typing any word in a particular text field it gets
converted into the desired text but when pressing tab

"like at the end of address line1 field when the typing of words gets
finished and then when tabbed to go to the next field does not
automatically converts the last word in the text field to the desired
language , we have to provide a space for it to convert and this is a
google's jsapi feature , but due to lack of control on the script can
you suggest and solution for that

google's jsapi feature - To convert entered text into desired language
after spacing which is i think is either a paid service or a paid
jsapi or any other thing ... please can you provide the reason for the
above stated problem



This is what my little modified code that is been integrated with the
referenced javasctipt  from the below given url :

https://developers.google.com/transliterate/v1/getting_started

under Transliteration with custom control



<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/
>
    <script type="text/javascript" src="https://www.google.com/jsapi";>
    </script>

<script type='text/javascript'>//<![CDATA[
$(window).load(function(){
$('#transl1').keyup(function(){
    $('#transl11').val(this.value);
});

$('#transl2').keyup(function(){
    $('#transl22').val(this.value);
});

$('#transl3').keyup(function(){
    $('#transl33').val(this.value);
});

$('#transl4').keyup(function(){
    $('#transl44').val(this.value);
});

$('#transl5').keyup(function(){
    $('#transl55').val(this.value);
});

$('#transl6').keyup(function(){
    $('#transl66').val(this.value);
});

$('#transl7').keyup(function(){
    $('#transl77').val(this.value);
});


});//]]>

</script>



    <script type="text/javascript">

      // Load the Google Transliterate API
      google.load("elements", "1", {
            packages: "transliteration"
          });

      var transliterationControl;
      function onLoad() {
        var options = {
            sourceLanguage: 'en',
            destinationLanguage: ['ar','hi','kn','ml','ta','te'],
            transliterationEnabled: true,
            shortcutKey: 'ctrl+g'
        };
        // Create an instance on TransliterationControl with the
required
        // options.
        transliterationControl =
          new
google.elements.transliteration.TransliterationControl(options);

        // Enable transliteration in the textfields with the given
ids.
        var ids = [ "transl1", "transl2", "transl3", "transl4",
"transl6", "transl7" ];
 
transliterationControl.makeTransliteratable(ids,contentEditable="true");



        // Add the STATE_CHANGED event handler to correcly maintain
the state
        // of the checkbox.
        transliterationControl.addEventListener(
 
google.elements.transliteration.TransliterationControl.EventType.STATE_CHANGED,
            transliterateStateChangeHandler);

        // Add the SERVER_UNREACHABLE event handler to display an
error message
        // if unable to reach the server.
        transliterationControl.addEventListener(
 
google.elements.transliteration.TransliterationControl.EventType.SERVER_UNREACHABLE,
            serverUnreachableHandler);

        // Add the SERVER_REACHABLE event handler to remove the error
message
        // once the server becomes reachable.
        transliterationControl.addEventListener(
 
google.elements.transliteration.TransliterationControl.EventType.SERVER_REACHABLE,
            serverReachableHandler);

        // Set the checkbox to the correct state.
        document.getElementById('checkboxId').checked =
          transliterationControl.isTransliterationEnabled();

        // Populate the language dropdown
        var destinationLanguage =
 
transliterationControl.getLanguagePair().destinationLanguage;
        var languageSelect =
document.getElementById('languageDropDown');
        var supportedDestinationLanguages =
          google.elements.transliteration.getDestinationLanguages(
            google.elements.transliteration.LanguageCode.ENGLISH);
        for (var lang in supportedDestinationLanguages) {
          var opt = document.createElement('option');
          opt.text = lang;
          opt.value = supportedDestinationLanguages[lang];
          if (destinationLanguage == opt.value) {
            opt.selected = true;
          }
          try {
            languageSelect.add(opt, null);
          } catch (ex) {
            languageSelect.add(opt);
          }
        }
      }

      // Handler for STATE_CHANGED event which makes sure checkbox
status
      // reflects the transliteration enabled or disabled status.
      function transliterateStateChangeHandler(e) {
        document.getElementById('checkboxId').checked =
e.transliterationEnabled;
      }

      // Handler for checkbox's click event.  Calls
toggleTransliteration to toggle
      // the transliteration state.
      function checkboxClickHandler() {
        transliterationControl.toggleTransliteration();
      }

      // Handler for dropdown option change event.  Calls
setLanguagePair to
      // set the new language.
      function languageChangeHandler() {
        var dropdown = document.getElementById('languageDropDown');
        transliterationControl.setLanguagePair(
            google.elements.transliteration.LanguageCode.ENGLISH,
            dropdown.options[dropdown.selectedIndex].value);
      }

      // SERVER_UNREACHABLE event handler which displays the error
message.
      function serverUnreachableHandler(e) {
        document.getElementById("errorDiv").innerHTML =
            "Transliteration Server unreachable";
      }

      // SERVER_UNREACHABLE event handler which clears the error
message.
      function serverReachableHandler(e) {
        document.getElementById("errorDiv").innerHTML = "";
      }
      google.setOnLoadCallback(onLoad);

    </script>
  </head>

<body>

<br><div> Use Tab To Switch To The Next Field </div>
<form class="cmxform" id="commentForm" method="get" action="">

    <br>First
Name&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;:&nbsp;<input
type='textbox' id="transl1"/>&nbsp;&nbsp;&nbsp;<input type="text"
id="transl11" />
    <br>Last
Name&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;:&nbsp;<input
type='textbox' id="transl2"/>&nbsp;&nbsp;&nbsp;<input type="text"
id="transl22" />
    <br>Address Line1&nbsp;&nbsp;&nbsp;&nbsp;:&nbsp;<input
type='textbox' id="transl3"/>&nbsp;&nbsp;&nbsp;<input type="text"
id="transl33" />
    <br>Address Line2&nbsp;&nbsp;&nbsp;&nbsp;:&nbsp;<input
type='textbox' id="transl4"/>&nbsp;&nbsp;&nbsp;<input type="text"
id="transl44" />
 
<br>Email&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;:&nbsp;<input
type='textbox' id="transl5"/>&nbsp;&nbsp;&nbsp;<input type="text"
id="transl55" />
    <br>Contact Number&nbsp;:&nbsp;<input type='textbox' id="transl6"/
>&nbsp;&nbsp;&nbsp;<input type="text" id="transl66" />

    <br>Type your Query Here<br><textarea id="transl7" style="width:
300px;height:50px"></textarea><br>

    <br><div id="errorDiv"></div>

    <br><input type="button" value="submit" onclick="" />
</form>

</body>

</html>








Thanks,
Kshitiz Sharma

-- 
You received this message because you are subscribed to the Google
Groups "Google AJAX APIs" group.
To post to this group, send email to
google-ajax-search-api@googlegroups.com
To unsubscribe from this group, send email to
google-ajax-search-api+unsubscr...@googlegroups.com
To view this message on the web, visit
http://groups.google.com/group/google-ajax-search-api?hl=en_US
For more options, visit this group at
http://groups.google.com/group/google-ajax-search-api?hl=en?hl=en

Reply via email to