Iuliia

Small elixir lib to properly transliterate cyrillic to latin. Uses https://github.com/nalgeon/iuliia for transliteration schemas.

Installation

3o*2-fP6xsw.F-gGR@ojAZgsBz

Not yet available at Hex (stay tuned)

def deps do
  [
    {:iuliia, "~> 0.1.0"}
  ]
end

Documentation

Will be available at https://hexdocs.pm/iuliia (stay tuned)

Usage

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

Iuliia.Schema.available_schemas

["ala_lc", "ala_lc_alt", "bgn_pcgn", "bgn_pcgn_alt", "bs_2979", "bs_2979_alt",
  "gost_16876", "gost_16876_alt", "gost_52290", "gost_52535", "gost_7034",
  "gost_779", "gost_779_alt", "icao_doc_9303", "iso_9_1954", "iso_9_1968",
  "iso_9_1968_alt", "mosmetro", "mvd_310", "mvd_310_fr", "mvd_782", "scientific",
  "telegram", "ungegn_1987", "wikipedia", "yandex_maps", "yandex_money"]

Get one schema data

Iuliia.Schema.lookup("wikipedia")

%{
  "description" => "Wikipedia transliteration schema",
  "ending_mapping" => %{"ий" => "y", "ый" => "y"},
  ...
}

Pick one and transliterate

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

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

Development

Check out repo:

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

Check out submodule with schemas:

git submodule update --init

Setup dependencies:

mix deps.get

Run specs:

mix test

Or open console to try it:

iex -S mix

Before push please run

mix format
mix credo

Support

Sponsored by Evrone

License

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