Show
Ignore:
Timestamp:
09/02/08 16:19:23 (4 months ago)
Author:
moeffju
Message:

Add an option to set the system locale to use.
This is preliminary and should probably be replaced by a setting in the chosen language file.

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • trunk/htdocs/system/classes/locale.php

    r2427 r2433  
    2828        self::$locale= strtolower( $locale ); 
    2929        self::$uselocale= self::load_domain( 'habari' ); 
     30    } 
     31     
     32    /** 
     33     * Set system locale. 
     34     * 
     35     * The problem is that every platform has its own way to designate a locale, 
     36     * so for German you could have 'de', 'de_DE', 'de_DE.UTF-8', 'de_DE.UTF-8@euro' 
     37     * (Linux) or 'DEU' (Windows), etc. 
     38     * 
     39     * @todo: This setting should probably be stored in the language files. 
     40     * 
     41     * @param string... $locale The locale(s) to set. They will be tried in order. 
     42     * @return string the locale that was picked, or FALSE if an error occurred 
     43     */ 
     44    public static function set_system_locale() 
     45    { 
     46        if ( func_num_args() == 0 ) return; 
     47        $args= func_get_args(); 
     48        array_unshift( $args, LC_ALL ); 
     49         
     50        return call_user_func_array( 'setlocale', $args ); 
    3051    } 
    3152