Skip to content

Instantly share code, notes, and snippets.

@xfenix
Created August 10, 2012 14:39
Show Gist options
  • Save xfenix/3314707 to your computer and use it in GitHub Desktop.
Save xfenix/3314707 to your computer and use it in GitHub Desktop.
EnglishToRussian conversion table
table = function(code) {
var s = 'фисвуапршолдьтщзйкыегмцчня',
b = 'ФИСВУАПРШОЛДЬТЩЗЙКЫЕГМЦЧНЯ',
c = s.length,
A = [],
A2 = [],
A3 = {91: 'х', 93: 'ъ', 59: 'ж', 39: 'э', 44: 'б', 46: 'ю', 123: 'Х', 125: 'Ъ', 58: 'Ж', 34: 'Э', 60: 'Б', 62: 'Ю'},
T = [],
sk = 96,
bk = 64;
for(i = 0; i < c; ++i) A[++sk] = s[i];
for(i = 0; i < c; ++i) A2[++bk] = b[i];
T = code > 96 && code < 123 ? A : (code > 64 && code < 91 ? A2 : A3);
return T[code] != undefined ? T[code] : '';
}
@Zython112
Copy link

фисвуапршолдьтщзйкыегмцчня

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment