[limb-svn] r5830 - 3.x/trunk/limb/i18n
svn at limb-project.com
svn at limb-project.com
Tue May 8 15:04:03 MSD 2007
Author: dan82
Date: 2007-05-08 15:04:03 +0400 (Tue, 08 May 2007)
New Revision: 5830
URL: http://fisheye.limb-project.com/changelog/limb/?cs=5830
Modified:
3.x/trunk/limb/i18n/common.inc.php
Log:
-- i18n - added function of a transliteration lmb_translit_russian().
Modified: 3.x/trunk/limb/i18n/common.inc.php
===================================================================
--- 3.x/trunk/limb/i18n/common.inc.php 2007-05-08 09:01:52 UTC (rev 5829)
+++ 3.x/trunk/limb/i18n/common.inc.php 2007-05-08 11:04:03 UTC (rev 5830)
@@ -22,4 +22,30 @@
return $toolkit->translate($text, $arg1, $arg2);
}
+
+function lmb_translit_russian($input, $encoding = 'utf8')
+{
+ if($encoding != 'utf8')
+ $input = iconv($encoding, 'utf8', $input);
+
+ $arrRus = array('à', 'á', 'â', 'ã', 'ä', 'å', '¸', 'æ', 'ç', 'è', 'é', 'ê', 'ë', 'ì',
+ 'í', 'î', 'ï', 'ð', 'ñ', 'ò', 'ó', 'ô', 'õ', 'ö', '÷', 'ø', 'ù', 'ü',
+ 'û', 'ú', 'ý', 'þ', 'ÿ',
+ 'À', 'Á', 'Â', 'Ã', 'Ä', 'Å', '¨', 'Æ', 'Ç', 'È', 'É', 'Ê', 'Ë', 'Ì',
+ 'Í', 'Î', 'Ï', 'Ð', 'Ñ', 'Ò', 'Ó', 'Ô', 'Õ', 'Ö', '×', 'Ø', 'Ù', 'Ü',
+ 'Û', 'Ú', 'Ý', 'Þ', 'ß');
+ $arrEng = array('a', 'b', 'v', 'g', 'd', 'e', 'jo', 'zh', 'z', 'i', 'y', 'k', 'l', 'm',
+ 'n', 'o', 'p', 'r', 's', 't', 'u', 'f', 'kh', 'c', 'ch', 'sh', 'sch', '',
+ 'y', '', 'e', 'yu', 'ya',
+ 'A', 'B', 'V', 'G', 'D', 'E', 'JO', 'ZH', 'Z', 'I', 'Y', 'K', 'L', 'M',
+ 'N', 'O', 'P', 'R', 'S', 'T', 'U', 'F', 'KH', 'C', 'CH', 'SH', 'SCH', '',
+ 'Y', '', 'E', 'YU', 'YA');
+
+ $result = str_replace($arrRus, $arrEng, $input);
+
+ if($encoding != 'utf8') return iconv('utf8', $encoding, $result);
+ else return $result;
+}
+
+
?>
More information about the limb-svn
mailing list