Source

SounsenseRus / LOGconverter.py

Full commit
import codecs
from time import sleep

def translit(s):
    "Russian translit: converts 'привет'->'privet'"
    assert s is not str, "Error: argument MUST be string"
    table1 = str.maketrans("абвгдеёзийклмнопрстуфхъыьэАБВГДЕЁЗИЙКЛМНОПРСТУФХЪЫЬЭ","abvgdeezijklmnoprstufh'y'eABVGDEEZIJKLMNOPRSTUFH'Y'E")
    table2 = {'ж':'zh','ц':'ts','ч':'ch','ш':'sh','щ':'sch','ю':'ju','я':'ja',
                  'Ж':'Zh','Ц':'Ts','Ч':'Ch','Щ':'Sch','Ю':'Ju','Я':'Ja'}
    for k in table2.keys():
        s = s.replace(k,table2[k])
    return s.translate(table1)

f = codecs.open('..\gamelog.txt', 'r', "windows-1251")

while 1:
      
      where = f.tell()
      line = f.readline()
      if not line:
           sleep(0.05) 
           f.seek(where)
      else:
        
                       line=translit(line)
                       s = codecs.open('gamelog.txt', 'a', "windows-1251")
                       s.write(line)
                       s.close()
                       print("trans")