Universal Translator, multi-user, intelligent, working (!), and using Yandex

There are always issues with translators. The most noticeable one is... Most don't work anymore (after Google changed it's API policy). And the working ones use an API key often stop working when too much people use them together.

So I took an old beautiful project HG Universal Translator by Frank Ramos, which seems to be abandoned (last version is not working and is 4 years old, even the version sold for 1 L$ on SL markedplace is announced as not working) and made necessary changes to make it work.


Why is it beautiful? Because it's multi-user and intelligent. Instead of having each user querying the translation API, the translator groups the requests. So if 10 people want English translation while someone speaks in Spanish, only 1 translation request is made, instead of 10.

And why intelligent? Because every translator checks to see if there is another one running around. If there are several translators, one becomes the master (the one making the translation requests), the other ones become slave (just delivering to "their" local users).

So you can drop a translator on your sim, and users can wear one as a hud, it doesn't hurt: the http requests to the translation API are optimized, and only one request per language pair (english to spanish, english to french...) is made.

Did I make all this? Nope. This was the way it worked in the Hank Ramos original translator.

So what did I do?
- I adapted the script to use Yandex translation instead of Google. Yandex use an API Key they give for free, and the registration process is SIMPLE (register, get the key). Google and Microsoft (to cite only two) for example, not only charge for the API key, but the registration process is over complicated.
- So user getting a copy can easily get their own key, instead of having to distribute a copy with hardcoded key which, soon or late, will go beyond the allowed use if shared by dozens of users.
- Therefore, I also store the key in a separate notecard. It is not hardcoded in the script like in some other Yandex translators available.
- I wrote replacements for missing scripts in the published version of HG Universal Translator. Actually, this version, made opensource, was unable to work, even without the Google API issue, some needed scripts were not included.

... And some other minor changes.

Zircon - This is a contributing Drupal Theme
Design by WeebPal.