Stanimal
Stanimal

Reputation: 15

Disable Google Transliterate In javascript

I had this webpage in which I had integrated Google Transliterate Input Tools. However, I am unable to disable it. On their website, it is given how to disable it with .disableTransliterate() but I dont know how or where to put it. Please help me, I am a beginner.

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

Upvotes: 0

Views: 222

Answers (1)

Jyot Mehta
Jyot Mehta

Reputation: 11

You need to call the the function .disableTransliteration() on the control object that you created at time of initializing the instance.

What you can do is :

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

        // Create an instance on TransliterationControl with the required
       // options.
       control = new google.elements.transliteration.TransliterationControl(options);

       // Enable transliteration in the textbox with id
       // 'transliterateArea'.
       control.makeTransliteratable(['transliterateArea']);
  }

  //To run the instance
  google.setOnloadCallback(onLoad);

  // To turn off the transliteration
  control.disableTransliteration();

</script>

Above script works for me :)

Upvotes: 1

Related Questions