Convert Mongolian text to English
I often needs to convert Mongolian letters to English. Most scripts uses only English letters to create folders, create Files and SEF URLs. So I always had to create Mongolian to English converter.
$txt = mb_strtolower($txt, 'UTF-8');That's it. 1st line converts all unicode mongolian text to lowercase, rest is just replacing letters
$Msearch = array('а','б','в','г','д','е','ё','ж','з','и','й','к','л','м','н','о','ө','п','р','с','т','у','ү','ф','х','ц','ч','ш','щ','ъ','ь','ы','э','ю','я');
$Mreplace = array('a','b','v','g','d','e','yo','j','z','i','i','k','l','m','n','o','o','p','r','s','t','u','u','f','h','ts','ch','sh','sh','-','-','ii','e','yu','ya');
$txt = str_replace($Msearch, $Mreplace, $txt);
Comments
Post a Comment