rubytransliterationcyrillic

Transliterate cyrillic symbols in string into latin in Ruby?


How do I transliterate Cyrillic symbols in string into Latin in Ruby? I can't find any docs on that. I thought there should be some standard function for that.


Solution

  • You can use the translit gem:

    require 'translit'
    
    str = "Кириллица"
    Translit.convert(str, :english)
    #=> "Kirillica"