intermediate commit
This commit is contained in:
28
common/helpers/TransliteratorHelper.php
Normal file
28
common/helpers/TransliteratorHelper.php
Normal file
@ -0,0 +1,28 @@
|
||||
<?php
|
||||
|
||||
namespace common\helpers;
|
||||
|
||||
class TransliteratorHelper
|
||||
{
|
||||
private static $rus = [
|
||||
'А', 'Б', 'В', 'Г', 'Д', 'Е', 'Ё', 'Ж', 'З', 'И', 'Й', 'К', 'Л', 'М', 'Н', 'О', 'П', 'Р', 'С', 'Т', 'У',
|
||||
'Ф', 'Х', 'Ц', 'Ч', 'Ш', 'Щ', 'Ъ', 'Ы', 'Ь', 'Э', 'Ю', 'Я', 'а', 'б', 'в', 'г', 'д', 'е', 'ё', 'ж', 'з',
|
||||
'и', 'й', 'к', 'л', 'м', 'н', 'о', 'п', 'р', 'с', 'т', 'у', 'ф', 'х', 'ц', 'ч', 'ш', 'щ', 'ъ', 'ы', 'ь',
|
||||
'э', 'ю', 'я'
|
||||
];
|
||||
|
||||
private static $lat = [
|
||||
'A', 'B', 'V', 'G', 'D', 'E', 'Yo', 'Zh', 'Z', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'R', 'S', 'T', 'U',
|
||||
'F', 'H', 'C', 'Ch', 'Sh', 'Shch', 'Y', 'Y', 'Y', 'E', 'Yu', 'Ya','a', 'b', 'v', 'g', 'd', 'e', 'yo', 'zh',
|
||||
'z', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'r', 's', 't', 'u', 'f', 'h', 'c', 'ch', 'sh', 'shch', 'y',
|
||||
'y', 'y', 'e', 'yu', 'ya'
|
||||
];
|
||||
|
||||
public static function transliterate($source)
|
||||
{
|
||||
if ($source) {
|
||||
return str_replace(self::$rus, self::$lat, $source);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user