Changeset 1569 for trunk/gregarius/cls

Show
Ignore:
Timestamp:
09/10/06 11:52:49 (2 years ago)
Author:
mbonetti
Message:

Locale selection in the admin, LC_ALL

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • trunk/gregarius/cls/l10n.php

    r1479 r1569  
    3535     
    3636    function RSSl10n($locale) { 
     37        $locale = preg_replace('#[^a-zA-Z_]#','',$locale); 
     38        if (function_exists('version_compare') && version_compare("4.2.0",PHP_VERSION, "<=") && preg_match('#([a-z]{2})_([A-Z]{2})#',$locale,$m)) { 
     39            $locales=array( 
     40                $m[0].'UTF-8', 
     41                $m[0].'utf-8', 
     42                $m[0], 
     43                $m[1].'_'.strtoupper($m[1]), 
     44                $m[1], 
     45                $m[2] 
     46            ); 
     47            setlocale(LC_ALL, $locales);     
     48        } else { 
     49            setlocale(LC_ALL, $locale); 
     50        } 
     51         
    3752        $path = GREGARIUS_HOME .'/intl/' . $locale . '/LC_MESSAGES/messages.mo'; 
    3853        $streamer = new FileReader($path);