summaryrefslogtreecommitdiff
path: root/it_text.class
diff options
context:
space:
mode:
authorChristian Weber2007-09-15 00:39:29 +0000
committerChristian Weber2007-09-15 00:39:29 +0000
commite37959f4c05704b0d0e255589e5332a5b0865467 (patch)
tree594622bc8d86968cf3dd70a1809745ec2b8ec174 /it_text.class
parent6ec76f855d6a824f06ac6e912d3079c0655326fe (diff)
downloaditools-e37959f4c05704b0d0e255589e5332a5b0865467.tar.gz
itools-e37959f4c05704b0d0e255589e5332a5b0865467.tar.bz2
itools-e37959f4c05704b0d0e255589e5332a5b0865467.zip
@param $p['fallbacklanguage'] optional language to use for undefined texts (useful for partially translated projects)
Diffstat (limited to 'it_text.class')
-rw-r--r--it_text.class9
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>" : '';
}