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).
npm i @skip405/bel-lat
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
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
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.
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.
npm test
The MIT License (MIT). Please see License File for more information.