How to use Google input tools in dash?

I’m working on a Dash web application and would like to enhance the input components by adding Google Input Tools, which suggests transliterated text as the user types. Is it possible to achieve this functionality in Dash, and if so, could someone provide guidance on how to implement it? I’m not sure where to start or what libraries or APIs to use for this purpose. Any help would be greatly appreciated.

It looks like an API does exist for this, granted this is for bulk data but I’d imagine the idea is the same for a single input.

Google also has a ton of various API’s, the one below specifically for google translate

Either of these might be a good start, I’m imagining the API won’t be the hard part but the various encodings some languages can have.

2 Likes

I found a way to use the Google Input Tools API , and they use a JavaScript function to integrate it into their input functionality. However, I’m facing a problem regarding how to add the JavaScript file to the <head> section of a web page in a Dash application. Additionally, I need to run this JavaScript snippet within the <body> section after defining the input. How can I achieve this?

let transliterationInput = document.getElementById("transliteration");
enableTransliteration(transliterationInput,'ne');

Hello @Ananthzeke,

You can do this two ways (that I thought of), you can change the app template, or you can add an input to your layout and target it with a script in your assets folder.

The issue here is that you wont be able to send this info back to Dash straightforwardly.