Skip to content

Instantly share code, notes, and snippets.

@MasFlam
Last active August 6, 2020 14:19
Show Gist options
  • Save MasFlam/49a0416bc5990e922bfcf15a11cd3f5f to your computer and use it in GitHub Desktop.
Save MasFlam/49a0416bc5990e922bfcf15a11cd3f5f to your computer and use it in GitHub Desktop.
latin to cyrillic pseudo-translator
const RUS = ["А","Б","Ц","Д","Э","Ф","Г","Х","И","Й","К","ЛЬ","М","Н","О","П","Q","Р","С","Т","У","V","В","X","Ы","З","а","б","ц","д","э","ф","г","х","и","й","к","ль","м","н","о","п","q","р","с","т","у","v","в","x","ы","з",",","<",".",">","/","?",";",":","'","\"","\\","|","[","{","]","}","-","=","_","+","1","2","3","4","5","6","7","8","9","0","!","@","#","$","%","^","&","*","(",")","`","~"," "];
const LAT = ["A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z","a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z",",","<",".",">","/","?",";",":","'","\"","\\","|","[","{","]","}","-","=","_","+","1","2","3","4","5","6","7","8","9","0","!","@","#","$","%","^","&","*","(",")","`","~"," "];
const latToRus = (str) =>
str.split("")
.map(ch => RUS[LAT.indexOf(ch)])
.map(ch => ch == undefined ? '‽' : ch)
.reduce((a, b) => a + b);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment