Skip to content

Russian transliteration using nalgeon/iuliia schemas

License

Notifications You must be signed in to change notification settings

adnikiforov/iuliia-rb

Repository files navigation

Iuliia

Small gem to properly transliterate cyrillic to latin. Use https://github.com/nalgeon/iuliia for transliteration schemas.

Ruby

Installation

Gem has been renamed to iuliia. This is the last version of iuliia-rb. Please, use iuliia instead.

Add this line to your application's Gemfile:

gem 'iuliia'

And then execute:

$ bundle

Or install it yourself as:

$ gem install iuliia

Usage

Get available schemas (dynamically generated from JSON definitions in lib/schemas)

Iuliia::Schema.available_schemas

[
    ['mvd_310', 'MVD 310-1997 transliteration schema'], 
    ['bs_2979', 'British Standard 2979:1958 transliteration schema'], 
    ['gost_779_alt', 'GOST 7.79-2000 (aka ISO 9:1995) transliteration schema'], 
    ['icao_doc_9303', 'ICAO DOC 9303 transliteration schema'], 
    ['mvd_310_fr', 'MVD 310-1997 transliteration schema'], 
    ['mvd_782', 'MVD 782-2000 transliteration schema'], 
    ['iso_9_1968_alt', 'ISO/R 9:1968 transliteration schema'], 
    ['mosmetro', 'Moscow Metro map transliteration schema'], 
    ['gost_7034', 'GOST R 7.0.34-2014 transliteration schema'], 
    ['gost_16876_alt', 'GOST 16876-71 (aka GOST 1983) transliteration schema'], 
    ['gost_52290', 'GOST R 52290-2004 transliteration schema'], 
    ['ungegn_1987', 'UNGEGN 1987 V/18 transliteration schema'], 
    ['telegram', 'Telegram transliteration schema'], 
    ['gost_16876', 'GOST 16876-71 (aka GOST 1983) transliteration schema'], 
    ['gost_779', 'GOST 7.79-2000 (aka ISO 9:1995) transliteration schema'], 
    ['wikipedia', 'Wikipedia transliteration schema'], 
    ['bgn_pcgn', 'BGN/PCGN transliteration schema'], 
    ['iso_9_1968', 'ISO/R 9:1968 transliteration schema'], 
    ['yandex_money', 'Yandex.Money transliteration schema'], 
    ['ala_lc', 'ALA-LC transliteration schema.'], 
    ['yandex_maps', 'Yandex.Maps transliteration schema'], 
    ['gost_52535', 'GOST R 52535.1-2006 transliteration schema'], 
    ['bgn_pcgn_alt', 'BGN/PCGN transliteration schema'], 
    ['iso_9_1954', 'ISO/R 9:1954 transliteration schema'], 
    ['bs_2979_alt', 'British Standard 2979:1958 transliteration schema'], 
    ['scientific', 'Scientific transliteration schema'], 
    ['ala_lc_alt', 'ALA-LC transliteration schema.']
]

Pick one and transliterate

Iuliia.translate('Юлия, съешь ещё этих мягких французских булок из Йошкар-Олы, да выпей алтайского чаю', schema: 'mvd_782')

"Yuliya, syesh' eshche etikh myagkikh frantsuzskikh bulok iz Yoshkar-Oly, da vypey altayskogo chayu"

TODO

  • Add documentation
  • Maybe some more specs
  • Implement reverse translit (not available for all schemas though): #3

Development

Check out repo:

git clone git@github.com:adnikiforov/iuliia-rb.git

Check out submodule with schemas:

git submodule update --init

Setup dependencies:

bin/setup

Run specs:

bundle exec rspec

Or open console to try it:

bin/console

To install this gem onto your local machine, run bundle exec rake install.

Support

Sponsored by Evrone

License

The gem is available as open source under the terms of the MIT License.