forked from pjetcetal/IrcBot
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtranslate_krzb.py
More file actions
23 lines (21 loc) · 877 Bytes
/
translate_krzb.py
File metadata and controls
23 lines (21 loc) · 877 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
def tr(txt):
if txt is None: return "чего переводить-то?"
tr_dict = {
'q': 'й', 'w': 'ц', 'e': 'у', 'r': 'к', 't': 'е', 'y': 'н', 'u': 'г',
'i': 'ш', 'o': 'щ', 'p': 'з', '[': 'х', ']': 'ъ', 'a': 'ф', 's': 'ы',
'd': 'в', 'f': 'а', 'g': 'п', 'h': 'р', 'j': 'о', 'k': 'л', 'l': 'д',
';': 'ж', "'": 'э', 'z': 'я', 'x': 'ч', 'c': 'с', 'v': 'м', 'b': 'и',
'n': 'т', 'm': 'ь', ',': 'б', '.': 'ю', '/': '.', '&': '?', '`': 'ё',
'~': 'ё', '>': 'ю', '<': 'б'
}
def t(x):
if x in tr_dict:
x = tr_dict.get(x)
return x
txt_list = list()
txt_tuple = tuple(txt)
for i in txt_tuple:
y = t(i.lower())
txt_list.append(y)
res = ''.join(txt_list)
return res