<?php
// +----------------------------------------------------------------------
-// | PHP Source
+// | PHP Source
// +----------------------------------------------------------------------
-// | Copyright (C) 2007 by Peter keller <peter@silmor.de>
+// | Copyright (C) 2007-8 by Peter keller <peter@silmor.de>
+// | (c) 2010-15 Konrad Rosenbaum <konrad@silmor.de>
// +----------------------------------------------------------------------
// |
// | Copyright: See COPYING file that comes with this distribution
class LanguageManager
{
private static $instance=null;//will be instantiated by singleton()
- private $lang="C";//fallback for unknown language, constructor overrides it
private $config;
private $templateFolder;
private $formatcfg;
/** returns the instance of the Language Manager */
public static function singleton()
{
+ global $default_language;
if(self::$instance===null) {
+ //this may be set in config.php, otherwise use "C"
+ if(!isset($default_language))
+ $default_language="C";
+ //instantiate LM
self::$instance = new LanguageManager();
}
/**returns the configured language template folder plus its fallback*/
public function templateFolders()
{
+ global $default_language;
$ret=array();
$ret[]=realpath($this->templateFolder());
- $ret[]=realpath($this->templateFolder."C/");
+ $ret[]=realpath($this->templateFolder.$default_language."/");
return $ret;
}
// echo "Loading ".$lang."<br/>";
$this->loadConfig($template."/".$lang."/format.cfg");
}else{
+ global $default_language;
//fall back to default language
// echo "Loading C as fallback<br/>";
- $this->loadConfig($template."/C/format.cfg");
+ $this->loadConfig($template."/".$default_language."/format.cfg");
}
//check timezone
$tz=$this->gettimezone();