silnrsi / teckit

A Text Encoding Conversion toolkit
Other
17 stars 11 forks source link

How to use converter/mapping in a web interface? #31

Open kaanchan opened 1 year ago

kaanchan commented 1 year ago

I have written a converter for Devanagari New (font) to Unicode. It is working well for our purposes but requires the conversion tools. Is there a way to use the mapping file such that I can call it from a simple web interface? I'd like to past in some Devanagari New text in a text box and get back Unicode text in another text box within a browser.

devosb commented 1 year ago

We don't have a web site, nor even the software for a such a site, to enable use of a TECkit map. SIL Converters, built on top of TECkit, has more options for conversion (such as within Microsoft Word) but no web interface.

If you would like to share the map, we have a collection of TECkit maps that I could add your map to.

bobeaton commented 1 year ago

Kaanchan, is your new converter a TECkit map? or is it an html webpage which contains the code (java?) that does the conversion?

If the former, then I think the answer is no, unless the web page you're hosting is on a server. If the server is Windows, then you could install SILConverters on that machine and call it from the page -- it's all COM based, so however you would call a COM object from your webpage, you could call the EncConverters core to do the conversion... You might get some hints from this page: https://software.sil.org/silconverters/silconverters-developer/ (I also just asked ChatGPT, "is it possible to call a COM object from javascript in an HTML webpage?" and it gives the code to use! You could also look at any of the *.vbs scripts that are installed into the C:\ProgramData\SIL\SILConverters40\MapsTables folder (e.g. SILGreek.tec.vbs if you install the BasicConverters package), which will show you how to use EncConverters via COM.

If the latter (the code to do the conversion is in the html page), then there's a 'Technical Hindi (Google group) Html Converter' feature in SILConverters (it's under the MapsTables feature tree node if you install the 'Indic Converters' feature). If you install that, then in the Add Converter dialog, you'll see the "Technical Hindi (Google group) Html Converter" option, and in the About tab of the resulting dialog, it'll show you where you can download one of those html pages. If you add the same kind of input boxes to your page as they have in theirs, then you'd be able to use the code w/in the html page to do conversions... But that would only be in currently enabled client applications; not from a website except as mentioned above.

Spinning up a RestAPI to do conversions on a server is something I'm planning to do someday, but haven't had the time yet.