Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Getting error in Google Transliterate API in javascript

I am using Google Transliterate API in my project to translate English text to Gujarati. It was working fine, however I am facing issue in google-jsapi now.

Here's my code:

<script type="text/javascript" src="http://www.google.com/jsapi"></script>

<script>
google.load("elements", "1", {
    packages: "transliteration"
});

function onLoad() {

    var options = {
        sourceLanguage: 'en',
        destinationLanguage: ['gu'],
        shortcutKey: 'ctrl+g',
        transliterationEnabled: true
    };
    // Create an instance on TransliterationControl with the required
    // options.
    var control = new google.elements.transliteration.TransliterationControl(options);

    // Enable transliteration in the textfields with the given ids.

    var ids = [ "cus_name", "address"];
    control.makeTransliteratable(ids);

    // Show the transliteration control which can be used to toggle between
    // English and Hindi and also choose other destination language.

    control.showControl('translControl');

}

google.setOnLoadCallback(onLoad);
</script>

Errors:

  • Loading elements other than inputtools with the jsapi loader is unsupported. Ec @ loader.js:90

  • Uncaught Error: Must call google.charts.load before google.charts.setOnLoadCallback at Object.E.M [as setOnLoadCallback] (loader.js:87) at test.html:32

I have checked with Google's API Developer guide .. but that also results in same problem.

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

Please help me with this issue.

like image 212
Vivek Gondhiya Avatar asked Jun 13 '20 12:06

Vivek Gondhiya


1 Answers

It happens all around the web. so I have used older version of jsapi and it works at my site http://vaani.neechalkaran.com/ script is http://vaani.neechalkaran.com/Scripts/google_jsapi.js

like image 145
Neechalkaran Avatar answered Nov 13 '22 12:11

Neechalkaran