diff options
-rw-r--r-- | it_text.class | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/it_text.class b/it_text.class index e7b2533..0782a37 100644 --- a/it_text.class +++ b/it_text.class @@ -24,7 +24,8 @@ class it_text * Constructor * @param $p['cookiename'] optional cookie name (default: 'LANGUAGE') * @param $p['debug'] optional debug mode: display label of unknown texts, set to 'label' to always display labels instead of actual text - * @param $p['forcelanguage'] optional language to use instead of user's prefered language + * @param $p['fallbacklanguage'] optional language to use for undefined texts (useful for partially translated projects) + * @param $p['forcelanguage'] optional language to use instead of user's preferred language * @param $p['phpfile'] optional texts file, defaults to service's phpinclude/texts.php */ function it_text($p = null) @@ -107,14 +108,16 @@ function text($label, $raw = null, $language = null) if (isset($this->statictext[$label][$language])) return $this->statictext[$label][$language]; + elseif ($this->p['fallbacklanguage'] && isset($this->statictext[$label][$this->p['fallbacklanguage']])) + return $this->statictext[$label][$this->p['fallbacklanguage']]; if ($fh = fopen($GLOBALS['ULTRAHOME'] . "/log/text_log", "a")) { fputs($fh, date("Y-m-d H:i:s") . "\t" . $_SERVER['REQUEST_URI'] . "\t" . $label . "\t" . $language . "\t" . it::replace(array('auto_prepend\S+\s+'=>''), it_debug::backtrace()) . "\n"); - fclose($fh); + fclose($fh); } - return $this->p['debug'] ? "<blink>$label ($language)</blink>" : $this->statictext[$label][$this->language_failsafe]; + return $this->p['debug'] ? "<blink>$label ($language)</blink>" : ''; } |