Cyrillic is a Ruby gem for the romanization (transliteration) of Cyrillic script into the Latin alphabet. It provides a simple and flexible way to convert Cyrillic text using various international and language-specific standards.
This gem supports multiple transliteration standards:
generic(Default)iso9ukrainianukrainian passportmongoliangerman
Add this line to your application's Gemfile:
gem 'cyrillic'And then execute:
$ bundle
Or install it yourself as:
$ gem install cyrillic
The gem provides a simple interface through the Cyrillic.t (or Cyrillic.transliterate) method.
By default, it uses a generic transliteration scheme.
require "cyrillic"
Cyrillic.t("Кириллица")
#=> "Kirillitsa"You can specify a transliteration standard by passing a symbol as the second argument.
Cyrillic.transliterate("Кириллица", :iso9)
#=> "Kirillica"Cyrillic.transliterate("Кирилиця", :ukrainian)
#=> "Kyrylytsia"Cyrillic.t("Монгол хэл", :mongolian)
#=> "Mongol khel"After checking out the repo, run bin/setup to install development dependencies.
To run the test suite, use the rake command:
$ rake
You can also run bin/console for an interactive prompt that will allow you to experiment with the gem.
Bug reports and pull requests are welcome on GitHub at https://github.com/rovetz/cyrillic. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the Contributor Covenant code of conduct.
The gem is available as open source under the terms of the MIT License.
Everyone interacting in the Cyrillic project’s codebases, issue trackers, chat rooms and mailing lists is expected to follow the code of conduct.