@skip405/bel-lat v2.0.1
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-latUsage
By default, the package transliterates in accordance with the Łacinka rules.
import belLat from '@skip405/bel-lat';
belLat('Лацінка'); // Łacinkawhich is equivalent to:
import belLat from '@skip405/bel-lat';
belLat('Лацінка', { style: 'lacinka' }); // ŁacinkaInstruction 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' }); // ShchuchynshchynaBasic 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'] ]
}); // avN.B. conversion is done on a per-character basis, it is not possible to omit multiple characters in a single call.
Testing
npm testLicense
The MIT License (MIT). Please see License File for more information.