Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/proton-neutron/lacinka
Belarusian Latin Alphabet Converter
https://github.com/proton-neutron/lacinka
Last synced: about 2 months ago
JSON representation
Belarusian Latin Alphabet Converter
- Host: GitHub
- URL: https://github.com/proton-neutron/lacinka
- Owner: proton-neutron
- License: mit
- Created: 2016-09-11T13:32:44.000Z (about 8 years ago)
- Default Branch: master
- Last Pushed: 2024-05-09T13:05:55.000Z (5 months ago)
- Last Synced: 2024-07-28T13:21:47.935Z (2 months ago)
- Language: PHP
- Homepage:
- Size: 29.3 KB
- Stars: 2
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- Awesome-Belarusian - lacinka - Belarusian Latin Alphabet Converter (<a name="repositories"></a> Рэпазыторыі з зыходным кодам ##)
README
# Belarusian "Lacinka" Converter
The tool provides you with API that enables you to convert from Belarusian Latin script to Belarusian Cyrillic script and backward.
## Basic usage
### Composer
```bash
$ composer require michaskruzelka/lacinka
```### PHP
```php
use Michaskruzelka\Lacinka\Converter;$converter = new Converter();
```Conversion to Belarusian Traditional Latin alphabet:
```php
$text = "
Лацінка — іміджавая рэч, яна стварае зусім іншае ўражанне ад мовы, нязвыклае, больш еўрапейскае
— яна злучае нас з блізкімі нам народамі Цэнтральнай і Ўсходняй Еўропы: палякамі, чэхамі, харватамі,
якім лацінка адкрывае беларускую мову як мову блізкую і зразумелую. Можа і камусь з беларусаў
яе існаванне можа дадаць цікавасці да беларускай мовы?
";$convertedText = $converter->convert($text);
```To Belarusian Academic (Geographic) Latin alphabet:
```php
$convertedText = $converter->setVersion('geographic')->convert($text);
```To Belarusian Cyrillic alphabet:
```php
$text = "
Łacinka — imidžavaja reč, jana stvaraje zusim inšaje ŭražannie ad movy, niazvykłaje, bolš jeŭrapiejskaje
— jana złučaje nas z blizkimi nam narodami Centralnaj i Ŭschodniaj Jeŭropy: palakami, čechami, charvatami,
jakim łacinka adkryvaje biełaruskuju movu jak movu blizkuju i zrazumiełuju. Moža i kamuś z biełarusaŭ
jaje isnavannie moža dadać cikavasci da biełaruskaj movy?
";$convertedText = $converter->directToCyrillic()->convert($text);
```## Advanced questions
> The conversion rules are not comprehensive. How can I improve them?You don't have to modify anything in business logic. Instead, all rules are stored in the /config/rules.xml file
where you can add, remove or modify any rule. Your rule should be structured as follows:```xml
[number]
[Some implementation of RendererInterface]
[Search Pattern, can include or inheriting nodes]
[Replacement, can include or inheriting nodes]
[true|false][From latin to cyrillic]
[true|false][From cyrillic to latin]
<[version]>[true|false][version]>
...
<[orthography]>[true|false][orthography]>
...
[letter|word|etc]
[letter|word|etc]
...
...
...
...
```
Moreover, you can apply your own rules in any xml file:
```php
$converter = (new Converter(false))->initRules([path_to_the_xml_file]);
```> Is it possible to add another version of Belarusian Latin script (for instance, Archaic)?
Yes. Every version of the alphabet must be specified in /config/settings.php file.
```php
...
'versions' => [
'traditional',
'geographic',
'[your_version]'
],
...
```
```php
$converter->setVersion([your_version]);
```> How to extend functionality of the converter?
You can add new renderers. They must implement 'Michaskruzelka\Lacinka\Renderers\RendererInterface'.
## Links
- [Belarusian Latin Alphabet (Wikipedia)](https://en.wikipedia.org/wiki/Belarusian_Latin_alphabet)
- [ГІСТОРЫЯ МОВЫ Беларуская лацінка (Мова Нанова)](http://www.movananova.by/zaniatki/gistoryya-movy-belaruskaya-lacinka.html)
- [Лацінка вяртаецца (Наша Ніва)](http://nn.by/?c=ar&i=32647)
- [Як правільна пісаць беларускай лацінкай? (Наша Ніва)](http://nn.by/?c=ar&i=147849)