Skip to content

Convert cyrillic Belarusian characters to Latin characters using transliteration. Can transliterate in accordance with the "Instruction on transliteration of geographical names" or in accordance with the rules of the Belarusian Latin alphabet (Łacinka).

License

Notifications You must be signed in to change notification settings

skip405/bel-lat

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

belLat

Convert cyrillic Belarusian characters to Latin characters using transliteration. Can transliterate in accordance with the "Instruction on transliteration of geographical names" (2000 and 2023) or in accordance with the rules of the Belarusian Latin alphabet (Łacinka).

Installation

npm i @skip405/bel-lat

Usage

By default, the package transliterates in accordance with the Łacinka rules.

import belLat from '@skip405/bel-lat';

belLat('Лацінка'); // Łacinka

which is equivalent to:

import belLat from '@skip405/bel-lat';

belLat('Лацінка', { style: 'lacinka' }); // Łacinka

Instruction for geographical names

You can specify conversion in accordance with the instructions for geographical names (2000 and 2023), e.g.

import belLat from '@skip405/bel-lat';

belLat('Шчучыншчына', { style: 'geo-2000' }); // Ščučynščyna
belLat('Шчучыншчына', { style: 'geo-2023' }); // Shchuchynshchyna

Basic replacements

The package allows to specify own replacement symbols.

import belLat from '@skip405/bel-lat';

belLat("№", {
  customReplacements: [ ['№', ['#']] ]
}); // #

N.B. if you need more complex conversions please prepare the string beforehand using other means.

Basic omissions

If you'd like to omit any characters from conversion you can specify _omitted as a value for a custom replacement.

import belLat from '@skip405/bel-lat';

belLat("абв", {
  customReplacements: [ ['б', '_omitted'] ]
}); // av

N.B. conversion is done on a per-character basis, it is not possible to omit multiple characters in a single call.

Testing

npm test

License

The MIT License (MIT). Please see License File for more information.

About

Convert cyrillic Belarusian characters to Latin characters using transliteration. Can transliterate in accordance with the "Instruction on transliteration of geographical names" or in accordance with the rules of the Belarusian Latin alphabet (Łacinka).

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published