Transliteration rules from Russian to English - complete alphabet and ready-made PHP function
Transliteration or transliteration can be needed anywhere, for example, to compose URLs. Transliteration is often used in various official documents and media - in ordinary passports, in foreign passports, in international certificates, in bank cards, etc. Sometimes there is a need to indicate your own data in transliteration - for this you need a table with the rules for translating each character into a character in another language.
Even such large organizations as banks, correct transliteration is not always done, for example, on one bank card the name and surname can be written in one way, but on another card according to different rules. Also on the net, you can find many tables with transliteration rules , but as it turned out, different characters are encoded differently in them - there is no unity of transliteration.
Therefore, it was required to create a table based on the transliteration rules in popular services. As a result of the analysis, a complete alphabet was prepared with the rules for transliteration from Russian into English.
Complete transliteration alphabet
Uppercase | ||
---|---|---|
A => A | K => K | X => H |
B => B | L => L | C => C |
B => V | M => M | H => CH |
G => G | N => N | W => SH |
D => D | O => O | Щ => SHCH |
E => E | P => P | b => |
Ё => YO | R => R | S => Y |
F => ZH | C => S | b => |
Z => Z | T => T | E => E |
AND => I | U => U | YU => YU |
Y => Y | Ф => F | I => YA |
Lowercase | ||
a => a | k => k | x => h |
b => b | l => l | c => c |
in => v | m => m | h => ch |
r => g | n => n | w => sh |
d => d | o => o | u => shch |
e => e | n => p | ъ => |
ё => yo | p => r | s => y |
f => zh | c => s | ь => |
s => z | t => t | e => e |
and => i | y => u | yu => yu |
th => y | f => f | i => ya |
PHP function for transliteration
Below is a ready-made PHP function for translating from Russian to English . It can be useful for URL transliterations and more, it can be easily modified to suit your needs.
function get_translit ($ string) {
$ converter = array (
'A' => 'A', 'B' => 'B', 'C' => 'V', 'D' => 'G', 'D' => 'D', 'E' => 'E', 'E' => 'YO', 'F' => 'ZH', 'Z' => 'Z', 'I' => 'I', 'Y' => 'Y',
'K' => 'K', 'L' => 'L', 'M' => 'M', 'N' => 'N', 'O' => 'O', 'P' => 'P', 'P' => 'R', 'C' => 'S', 'T' => 'T', 'Y' => 'U', 'F' => 'F',
'X' => 'H', 'Ts' => 'C', 'H' => 'CH', 'W' => 'SH', 'Щ' => 'SHCH', 'b' => '', 'Y' => 'Y', 'b' => '', 'E' => 'E', 'Y' => 'YU', 'I' => 'YA',
'a' => 'a', 'b' => 'b', 'c' => 'v', 'd' => 'g', 'd' => 'd', 'e' => 'e', 'e' => 'yo', 'f' => 'zh', 'z' => 'z', 'and' => 'i', 'd' => 'y',
'k' => 'k', 'l' => 'l', 'm' => 'm', 'n' => 'n', 'o' => 'o', 'n' => 'p', 'p' => 'r', 'c' => 's', 't' => 't', 'y' => 'u', 'f' => 'f',
'x' => 'h', 'q' => 'c', 'h' => 'ch', 'w' => 'sh', 'u' => 'shch', 'ъ' => '', 's' => 'y', 'b' => '', 'e' => 'e', 'y' => 'yu', 'i' => 'ya',
);
$ string = strtr ($ string, $ converter);
return $ string;
}
Thus, using the above transliteration rules or a ready-made PHP function from this article, you can get correctly transliterated text that will match the transliteration in popular services and systems.
Latest articles
- 03.04.24IT / Уроки PHP Уроки простыми словами. Урок 3. Все операторы PHP с примерами, с выводом работы кода на экран.
- 02.04.24IT / Уроки PHP Уроки простыми словами. Урок 2. Типы данных в PHP с примерами.
- 02.04.24IT / Уроки PHP Уроки простыми словами. Урок 1. Коротко о языке веб-программирования PHP. Основы синтаксиса.
- 09.11.23IT / Database Errors when migrating from MySQL 5.6 to 5.7 and how to fix them - database dump import failed with an error or INSERT does not work. Disabling STRICT_TRANS_TABLES strict mode or using IGNORE
- 08.07.22IT / Misc Convert office files DOC, DOCX, DOCM, RTF to DOCX, DOCM, DOC, RTF, PDF, HTML, XML, TXT formats without loss and markup changes