Small elixir lib to properly transliterate cyrillic to latin. Uses https://github.com/nalgeon/iuliia for transliteration schemas.
def deps do
[
{:iuliia, "~> 0.1.3"}
]
end
Available at https://hexdocs.pm/iuliia
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"
Check out repo:
git clone [email protected]:adnikiforov/iuliia-rb.git
Setup dependencies:
mix deps.get
Run specs:
mix test
Or open console to try it:
iex -S mix
Before PR please run
mix format
mix credo
mix test
The lib is available as open source under the terms of the MIT License.