Changeset 1997 for alternc/trunk/bureau/class/lang_env.php
- Timestamp:
- 10/05/07 20:07:02 (1 year ago)
- Files:
-
- alternc/trunk/bureau/class/lang_env.php (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
alternc/trunk/bureau/class/lang_env.php
r1932 r1997 1 1 <?php 2 2 3 function update_locale( ) {4 global $locales;3 function update_locale($langpath) { 4 $locales=array(); 5 5 $f=@fopen("/etc/locale.gen","rb"); 6 6 if ($f) { 7 $locales=array();8 7 while ($s=fgets($f,1024)) { 9 if (preg_match("/^([a-z][a-z]_[A-Z][A-Z])/",trim($s),$mat) ) {8 if (preg_match("/^([a-z][a-z]_[A-Z][A-Z])/",trim($s),$mat) && file_exists($langpath . '/' . $mat[1])) { 10 9 $locales[$mat[1]]=$mat[1]; 11 10 } … … 13 12 fclose($f); 14 13 } 14 return $locales; 15 15 } 16 17 16 18 17 // setlang is on the link at the login page … … 21 20 } 22 21 23 $locales=array("fr_FR"=>"fr_FR","en_US"=>"en_US"); 22 $langpath = bindtextdomain("alternc", "/var/alternc/bureau/locales"); 23 24 24 // Create or update a locale.php file if it is outdated. 25 update_locale();25 $locales = update_locale($langpath); 26 26 27 27 if (!(isset($lang))) { // Use the browser first preferred language
