correct language loading and timestamp formatting
authorKonrad Rosenbaum <konrad@silmor.de>
Wed, 28 Mar 2012 17:35:55 +0000 (19:35 +0200)
committerKonrad Rosenbaum <konrad@silmor.de>
Wed, 28 Mar 2012 17:35:55 +0000 (19:35 +0200)
www/inc/classes/language_manager.php
www/inc/wext/format.php

index d981777..c32b345 100644 (file)
@@ -66,8 +66,10 @@ class LanguageManager
                // check if cookie is set
                if (isset($_COOKIE[COOKIE_LANGUAGE])) {
                        $langs[]= $_COOKIE[COOKIE_LANGUAGE];
+//                     echo "cookie ".$_COOKIE[COOKIE_LANGUAGE];
                }
                if(isset($_SERVER["HTTP_ACCEPT_LANGUAGE"])){
+//                     echo "server lang ".$_SERVER["HTTP_ACCEPT_LANGUAGE"];
                        foreach(explode(",",$_SERVER["HTTP_ACCEPT_LANGUAGE"]) as $l){
                                //the language itself
                                $langs[]=trim(strtolower($l));
@@ -206,7 +208,7 @@ class LanguageManager
                                                //hours
                                                $s=floor($d/60)."";
                                                if(strlen($s)<2)$s="0".$s;
-                                               $t+=$s;
+                                               $t.=$s;
                                                //T or t? make a colon?
                                                if($format[$i]=='t')$t.=":";
                                                //minutes
index 2a58fb2..095e5aa 100644 (file)
@@ -14,8 +14,15 @@ class WOServerFormat extends WOServerFormatAbstract
                parent::__construct();
                global $template;
                $this->loadConfig($template."/format.cfg");
-               if($lang!="" && $lang!="C" && preg_match('/^[a-zA-Z0-9_-]+$/',$lang))
+//             echo "Loading base while ".$lang."<br/>";
+               if($lang!="" && $lang!="C" && preg_match('/^[a-zA-Z0-9_-]+$/',$lang)){
+//                     echo "Loading ".$lang."<br/>";
                        $this->loadConfig($template."/".$lang."/format.cfg");
+               }else{
+                       //fall back to default language
+//                     echo "Loading C as fallback<br/>";
+                       $this->loadConfig($template."/C/format.cfg");
+               }
                //check timezone
                $tz=$this->gettimezone();
                if($tz==null || $tz==false || $tz==""){