A small but very useful transliteration script from Russian

Recently I needed to find a quick solution for transliterating Cyrillic into Latin, which would work with a large number of lines at a time. It was not an option to translate even with a file via google translate, since there will still be a limit and you will have to make several visits. And if you need to drive about 20 thousand lines at a time by transliteration, then this is no longer a great idea.

On the site usefulscript.ru managed to find a small script that solved all the problems.

Let's create a regular html page and add a text area with a translation button there

<div style="text-align: center;">
    <textarea id="text" cols="35" rows="8" style="width: 600px; height: 150px; color: #0C3A45; border: 1px solid #CCCCCC; background: #F2F2F2;"></textarea>
    <br>
    <input type="button" value="Translate this!" onclick="send()">
</div>

and connect the script

<script type='text/javascript'>
    function send(){
    var text = document.getElementById('text').value;
    var transl = new Array();
        transl['А']='A';     transl['а']='a';
        transl['Б']='B';   &nbsðÊÉíU  ðÊÉíU                  ЛÉÉíU           ™ÉÉíU  XÊÉíU          ÊÉíU   @      ÊÉíU          ansl['в']='v';
        transl['Г']='G';     transl['г']='g';
        transl['Д']='D';     transl['д']='d';
        transl['Е']='E';     transl['е']='e';
        transl['Ё']='Yo';    transl['Ñ‘']='yo';
        transl['Ж']='Zh';    transl['ж']='zh';
        transl['З']='Z';     transl['з']='z';
        transl['И']='I';     transl['и']='i';
        transl['Й']='J';     transl['й']='j';
        transl['К']='K';     transl['к']='k';
        transl['Л']='L';     transl['л']='l';
        transl['Ðœ']='M';     transl['м']='m';
        transl['Н']='N';     transl['н']='n';
        transl['О']='O';     transl['о']='o';
        transl['П']='P';     transl['п']='p';
        transl['Р']='R';     transl['Ñ€']='r';
        transl['С']='S';     transl['с']='s';
        transl['Т']='T';     transl['Ñ‚']='t';
        transl['У']='U';     transl['у']='u';
        transl['Ф']='F';     transl['Ñ„']='f';
        transl['Ð¥']='X';     transl['Ñ…']='x';
        transl['Ц']='C';     transl['ц']='c';
        transl['Ч']='Ch';    transl['ч']='ch';
        transl['Ш']='Sh';    transl['ш']='sh';
        transl['Щ']='Shh';    transl['щ']='shh';
        transl['Ъ']='"';     transl['ÑŠ']='"';
        transl['Ы']='Y\'';    transl['Ñ‹']='y\'';
        transl['Ь']='\'';    transl['ÑŒ']='\'';
        transl['Э']='E\'';    transl['э']='e\'';
        transl['Ю']='Yu';    transl['ÑŽ']='yu';
        transl['Я']='Ya';    transl['я']='ya';

        var result = '';
        for(i=0;i<text.length;i++) {
            if(transl[text[i]] != undefined) { result += transl[text[i]]; }
            else { result += text[i]; }
        }
        document.getElementById('text').value = result;
    }
</script>
 

Thus, we insert the text into the field, click on the button and the Cyrillic alphabet changes to the Latin alphabet. Checked on 29 thousand lines.

Plain text

  • No HTML tags allowed.
  • Lines and paragraphs break automatically.
  • Web page addresses and email addresses turn into links automatically.
The comment language code.