AJAX Transliteration

This is a somewhat random project, but I hope someone besides me can find it useful.

A few months ago, I coded a site for Kovalev Insurance Agency, which is a bilingual site and involved some Russian translation. My favorite online translator is PROMPT with the
exception of the fact that the site is sometimes quite slow. One of the features of this translator is transliteration of unknown words, which essentially phonetically converts English letters to their Russian equivalents. This is a very useful feature when the translator is not producing the desired word or when proper names are involved. PROMPT has some issues though – the site tends to be slow and sometimes unavailable, and it does not include provisions for special (non-phonetic)
Russian characters. …and this… is how this page was born.

The idea here is quite simple. A map file will define how to map supplied text to desired text. This setup allows for custom conversions as depicted with the hacker transliteration mapping :-). In order to support AJAX applications (implementation details of AJAX are out of the scope of this article), everything is done via a GET-style URL encoding:

  • map – will specify which map to use
  • text – will specify the text to be translated

For example: “transliterator.php?map=hacker.txt&text=eleet

The map file setup is simple: source_character(s)***resulting_character(s) (i.e. E***3)

Well, enough talk, how about a demo! – enter the string into the text box below and Transliterate!

Text:

Use Rusmap.txt (Russian Mapping – View Map)

Use Hacker.txt (Hacker Mapping – View Map)

Transliterate On-the-Fly (implemented via AJAX)



Transliteration Result: