Changeset 1586 for trunk/gregarius/cls/l10n.php
- Timestamp:
- 09/17/06 12:12:16 (2 years ago)
- Files:
-
- 1 modified
-
trunk/gregarius/cls/l10n.php (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/gregarius/cls/l10n.php
r1584 r1586 38 38 function RSSl10n() { 39 39 $this -> locale = preg_replace('#[^a-zA-Z_]#','',$this -> __detectUserLang()); 40 41 $ll=explode('_',$this -> locale); 42 $this->isloang=$ll[0].'-'.strtoupper($ll[1]); 43 44 if (function_exists('version_compare') && version_compare("4.3.0",PHP_VERSION, "<=") && preg_match('#([a-z]{2})_([A-Z]{2})#',$this -> locale,$m)) { 40 $this -> isolang=str_replace('_','-',$this -> locale); 41 if (function_exists('version_compare') && version_compare("4.3.0",PHP_VERSION, "<=") && preg_match('#([a-z]{2})_?([A-Z]{2})?#',$this -> locale,$m)) { 45 42 $locales=array( 46 $m[0].' UTF-8',47 $m[0].' utf-8',43 $m[0].'.UTF-8', 44 $m[0].'.utf-8', 48 45 $m[0], 49 $m[1] .'_'.strtoupper($m[1]),50 $m[1] ,51 $m[2]46 $m[1], 47 $m[1].'_'.strtoupper($m[1]) 48 //$m[2] 52 49 ); 53 50 setlocale(LC_ALL, $locales); … … 81 78 */ 82 79 function __detectUserLang() { 83 if (isset($_REQUEST['lang']) && preg_match('#^[a-z]{2}_ [A-Z]{2}$#',$_REQUEST['lang']) && file_exists(GREGARIUS_HOME .'intl/'.$_REQUEST['lang'])) {80 if (isset($_REQUEST['lang']) && preg_match('#^[a-z]{2}_?([A-Z]{2})?$#',$_REQUEST['lang']) && file_exists(GREGARIUS_HOME .'intl/'.$_REQUEST['lang'])) { 84 81 setcookie(RSS_LOCALE_COOKIE,$_REQUEST['lang'],time()+3600*6,getPath()); 85 82 return $_REQUEST['lang']; … … 103 100 // xx-yy -> xx_YY 104 101 $ret= $pm[1] ."_".strtoupper($pm[2]); 105 } elseif(file_exists(GREGARIUS_HOME .'intl/'.$pm[1] ."_".strtoupper($pm[1]))) {106 // xx-yy -> xx_XX107 $ret= $pm[1] ."_".strtoupper($pm[1]);108 102 } 109 } elseif(file_exists(GREGARIUS_HOME .'intl/'.$pm[1] ."_".strtoupper($pm[1]))) {110 // xx -> xx _XX111 $ret= $pm[1] ."_".strtoupper($pm[1]);103 } elseif(file_exists(GREGARIUS_HOME .'intl/'.$pm[1] )) { 104 // xx -> xx 105 $ret= $pm[1]; 112 106 } elseif($pm[1] == 'en') { 113 107 // ugly: a better way would be to look up all the available locales
