[med-svn] r570 - trunk/community/website/inc
hanska-guest at alioth.debian.org
hanska-guest at alioth.debian.org
Thu Oct 4 19:25:59 UTC 2007
Author: hanska-guest
Date: 2007-10-04 19:25:58 +0000 (Thu, 04 Oct 2007)
New Revision: 570
Modified:
trunk/community/website/inc/locale.inc.php
Log:
Added more environment variables.
Added more en_* variants (and it_CH as well).
Modified: trunk/community/website/inc/locale.inc.php
===================================================================
--- trunk/community/website/inc/locale.inc.php 2007-10-04 19:08:40 UTC (rev 569)
+++ trunk/community/website/inc/locale.inc.php 2007-10-04 19:25:58 UTC (rev 570)
@@ -8,15 +8,18 @@
$locales_dir = "/srv/alioth.debian.org/chroot/home/groups/debian-med/htdocs/locale/";
-$available = array();
-$handle = opendir($locales_dir) or die("Cannot open $locales_dir.\n");
-while ($file = readdir($handle)) {
- clearstatcache();
- if ($file != "." && $file != "..") {
- if (is_dir($locales_dir.$file))
- $available[] = $file;
- }
-}
+$available = array(
+ "en" => true,
+ "en_US" => true, "en_GB" => true,
+ "en_AU" => true, "en_BW" => true,
+ "en_CA" => true, "en_DK" => true,
+ "en_HK" => true, "en_IE" => true,
+ "en_IN" => true, "en_NZ" => true,
+ "en_PH" => true, "en_SG" => true,
+ "en_ZA" => true, "en_ZW" => true,
+ "it" => true,
+ "it_IT" => true, "it_CH" => true,
+ );
$i = 0;
foreach ($lang_arr as $lang_code) {
@@ -32,15 +35,35 @@
// let's sort them by priority, highest first
krsort($langs);
-$locale = "it_IT";
-$priority = "1.0";
+$locale = "en_US";
+$priority = "0.0";
foreach ($langs as $index => $language) {
-// preg_match("/([a-z]+)_[A-Z]+/", $language, $matches);
-// $test = $matches[1];
var_dump($language);
- if (in_array($language, $available)) {
- $locale = $language;
+ if ($available($language)) {
+ switch ($language) {
+ case "it":
+ case "it_IT":
+ case "it_CH":
+ $locale = "it_IT"; break;
+ case "en":
+ case "en_US":
+ case "en_GB":
+ case "en_AU":
+ case "en_BW":
+ case "en_CA":
+ case "en_DK":
+ case "en_HK":
+ case "en_IE":
+ case "en_IN":
+ case "en_NZ":
+ case "en_PH":
+ case "en_SG":
+ case "en_ZA":
+ case "en_ZW":
+ default:
+ $locale = "en_US"; break;
+ }
$priority = $index;
break;
}
@@ -53,6 +76,8 @@
}
putenv("LC_ALL=$locale");
+putenv("LANG=$locale");
+putenv("LANGUAGE=$locale");
setlocale(LC_ALL, $locale);
$domain = "messages";
//bindtextdomain("messages", $locales_dir);
More information about the debian-med-commit
mailing list