2017 © Pedro Peláez
 

library php-translit

PHP library to convert text from one script to another.

image

ironsmile/php-translit

PHP library to convert text from one script to another.

  • Wednesday, May 31, 2017
  • by ironsmile
  • Repository
  • 2 Watchers
  • 0 Stars
  • 0 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 13 Forks
  • 0 Open issues
  • 4 Versions
  • 0 % Grown

The README.md

translit

translit is a PHP library to convert text from one script to another. Currently it assume conversion of Cyrillic, Georgian, Armenian and Greek scripts into Roman (Latin). Cyrillic has sub-groups for Russian, Ukrainian, Belarusian, Bulgarian and Kazakh languages with custom rules., (*1)

Main class Translit could be used as singleton or object itself. Built-in translitaration tables could be refered by following language codes: * ru - Russian cyrillic chars, * uk - Ukrainian cyrillic chars, * mk - Macedonian cyrillic chars, * be - Belarusian cyrillic chars (converted to latin with diacritical), * bg - Bulgarian cyrillic chars (converted to latin with diacritical), * kk - Kazakh cyrillic chars (converted to latin with diacritical), * ka - Georgian chars, * hy - Armenian chars (converted to latin with diacritical), * el - Greek chars (converted to latin with diacritical), * cyrillic - all cyrillic chars according to ISO 9:1995, * latin - only latin chars without diacritical marks, * ascii - only ASCII chars, all non ASCII will be replaced with question mark., (*2)

Language codes could be combined by comma to handle more cases, e.g., (*3)

echo Translit::object()->convert('Беларусь', 'be') . ' vs ' .
    Translit::object()->convert('Беларусь', 'be,latin');

produce output:, (*4)

Bielaruś vs Bielarus

By default wrong language codes ignored. But this behavior could be changed by using strict mode. For all language codes that prepended with exclamation mark exception will be fired if any error (no conversion table, wrong format, empty). For example:, (*5)

// following code returns 'Привет' as is because handler ru_ru not defined
echo Translit::object()->convert('Привет', 'ru_ru') . PHP_EOL;

// but next code fires Exception, because strict mode have used
echo Translit::object()->convert('Привет', '!ru_ru') . PHP_EOL;

There are many sources of these tables which could be used - ISO and BGN/PCGN standards, a lot of native standards and informal standard used by people. For this library I assume next order of sources - native, ISO, BGN/PCGN, informal., (*6)

All transliteration tables were created from information found at Wikipedia. The links to these pages posted into header of each file. Please update me if any mistakes found or you have new transliteration tables to add here., (*7)

The Versions

31/05 2017

dev-master

9999999-dev

PHP library to convert text from one script to another.

  Sources   Download

MIT

The Requires

  • php >=5.2.0

 

translit transliteration romanization latinization

31/05 2017

v1.0.2

1.0.2.0

PHP library to convert text from one script to another.

  Sources   Download

MIT

The Requires

  • php >=5.2.0

 

translit transliteration romanization latinization

31/05 2017

v1.0.1

1.0.1.0

PHP library to convert text from one script to another.

  Sources   Download

MIT

The Requires

  • php >=5.2.0

 

translit transliteration romanization latinization

24/02 2017

v1.0.0

1.0.0.0

PHP library to convert text from one script to another.

  Sources   Download

MIT

The Requires

  • php >=5.2.0

 

translit transliteration romanization latinization