Home

Awesome

Iuliia

Transliterate Cyrillic → Latin in every possible way

This is the TypeScript port of the Python iuliia package

NPM Version Build Status Code Coverage Code Quality

Transliteration means representing Cyrillic data (mainly names and geographic locations) with Latin letters. It is used for international passports, visas, green cards, driving licenses, mail and goods delivery etc.

Iuliia makes transliteration as easy as:

// Typescript, ES6
import * as iuliia from "iuliia";
iuliia.translate("Юлия Щеглова", iuliia.WIKIPEDIA);
'Yuliya Shcheglova'
// CommonJS
const iuliia = require("iuliia");
iuliia.translate("Юлия Щеглова", iuliia.WIKIPEDIA);
'Yuliya Shcheglova'

Why use Iuliia

For schema details and other information, see https://iuliia.ru/ (in Russian).

Issues and limitations

Installation

npm install iuliia

Usage

ES2015 JavaScript:

import iuliia from "iuliia";

// list all supported schemas
for (let schemaName of iuliia.Schemas.names()) {
    console.log(schemaName);
}

// transliterate using specified schema
let source = "Юлия Щеглова";
iuliia.translate(source, iuliia.ICAO_DOC_9303);
// "Iuliia Shcheglova"

// or pick schema by name
let schema = iuliia.Schemas.get("wikipedia");
iuliia.translate(source, schema);
// "Yuliya Shcheglova"

ES5 browser JavaScript:

<script src="https://unpkg.com/iuliia@latest/dist/umd/iuliia.min.js"></script>
<script>
    var source = "Юлия Щеглова";
    var result = iuliia.translate(source, iuliia.WIKIPEDIA);
    console.log(result);
</script>

Supported schemas:

ala_lc          iuliia.ALA_LC
ala_lc_alt      iuliia.ALA_LC_ALT
bgn_pcgn        iuliia.BGN_PCGN
bgn_pcgn_alt    iuliia.BGN_PCGN_ALT
bs_2979         iuliia.BS_2979
bs_2979_alt     iuliia.BS_2979_ALT
gost_779        iuliia.GOST_779
gost_779_alt    iuliia.GOST_779_ALT
gost_7034       iuliia.GOST_7034
gost_16876      iuliia.GOST_16876
gost_16876_alt  iuliia.GOST_16876_ALT
gost_52290      iuliia.GOST_52290
gost_52535      iuliia.GOST_52535
icao_doc_9303   iuliia.ICAO_DOC_9303
iso_9_1954      iuliia.ISO_9_1954
iso_9_1968      iuliia.ISO_9_1968
iso_9_1968_alt  iuliia.ISO_9_1968_ALT
mosmetro        iuliia.MOSMETRO
mvd_310         iuliia.MVD_310
mvd_310_fr      iuliia.MVD_310_FR
mvd_782         iuliia.MVD_782
scientific      iuliia.SCIENTIFIC
telegram        iuliia.TELEGRAM
ungegn_1987     iuliia.UNGEGN_1987
wikipedia       iuliia.WIKIPEDIA
yandex_maps     iuliia.YANDEX_MAPS
yandex_money    iuliia.YANDEX_MONEY

Development setup

Install dependencies:

npm ci

Generate schemas from the schemas repository:

npm run generate

Format the source code:

npm run format

Run ESLint checks:

npm run lint

Run unit tests:

npm test

Build JS:

npm run build

Contributing

Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.

Make sure to add or update tests as appropriate.

Use Conventional Commits for commit messages.

Changelog

License

MIT

<!-- Markdown link & img dfn's -->