Integrating Google Transliteration with Datatables Editor inline editing

Integrating Google Transliteration with Datatables Editor inline editing

HarinandanHarinandan Posts: 4Questions: 2Answers: 0

Hi,

I'm using Google Transliteration (https://developers.google.com/transliterate/v1/getting_started). This requires to provide ID of text input to the transliterate API.

I want to use this with inline editing or editing entire row. Since IDs of text input is not created until editing is to be done, transliterate API raise exception. Any idea how these can work together?

Regards,
Harinandan

Answers

  • allanallan Posts: 63,075Questions: 1Answers: 10,384 Site admin

    Very interesting - it would be great to see this working!

    I would suggest not accessing Editor's fields by ID, but rather use the field().val() method (there are others as well such as val() for multiple values).

    Regards,
    Allan

  • HarinandanHarinandan Posts: 4Questions: 2Answers: 0

    Hi Allan,

    What you have suggested is the right approach. However, it involves much effort. To get something working quickly, I had to do a hack.

    If text field ID's are known, Google APIs handle transliteration themselves. On entering a space, they take english text, call API to transliterate and put back the transliterated output in place of the original text. Hence these are the steps I did to get transliteration working:

    1. Define a callback for open event. When this is called, form is open and text fields are created.
    2. In the above callback, call google transliteration initialization code and give the ID of text fields (hardcoded) which need transliteration support.

    Now transliteration gets enabled on those text fields whose IDs were supplied.

    Regards,
    Harinandan

  • allanallan Posts: 63,075Questions: 1Answers: 10,384 Site admin

    If text field ID's are known, Google APIs handle transliteration themselves.

    Got it - that's really nice.

    Great to hear you've got this working!

    Allan

This discussion has been closed.