diff options
author | Romain d'Alverny <rda@mageia.org> | 2012-06-20 19:41:33 +0000 |
---|---|---|
committer | Romain d'Alverny <rda@mageia.org> | 2012-06-20 19:41:33 +0000 |
commit | 4e22a3b5f3797f11b415c61393cbf42594a4c16d (patch) | |
tree | 03f5c64339b8abc382b76631a640b3bb52a52af2 | |
parent | b76b7e92ca29bb3d4f18745cfe0fe5957d6da60e (diff) | |
download | www-4e22a3b5f3797f11b415c61393cbf42594a4c16d.tar www-4e22a3b5f3797f11b415c61393cbf42594a4c16d.tar.gz www-4e22a3b5f3797f11b415c61393cbf42594a4c16d.tar.bz2 www-4e22a3b5f3797f11b415c61393cbf42594a4c16d.tar.xz www-4e22a3b5f3797f11b415c61393cbf42594a4c16d.zip |
more readable func _d()
-rw-r--r-- | langs.inc.php | 19 |
1 files changed, 15 insertions, 4 deletions
diff --git a/langs.inc.php b/langs.inc.php index d4bbabb87..bc6ecc07b 100644 --- a/langs.inc.php +++ b/langs.inc.php @@ -148,22 +148,33 @@ S; * @param boolean $ret return value? * * @return null|string - * - * FIXME Yes, it's terribly wrong/evil to rely on an unknown global $_t. - * Solution? rethink the whole i18n thing in an integrated one. */ function _t($s = null, $opt = null, $post = ' ') { return _d($s, $opt) . $post; } +/** + * @param string $s + * @param array $opt + * + * @return string + * + * FIXME Yes, it's terribly wrong/evil to rely on an unknown global $_t. + * Solution? rethink the whole i18n thing in an integrated one. +*/ function _d($s = null, $opt = null) { + if ($s == '') + return null; + if (!is_null($opt)) $_t = $opt; else { global $_t; } - return trim(str_replace('{ok}', '', ($s == '' ? '---' : (array_key_exists($s, $_t) ? $_t[$s] : $s)))); + $ret = array_key_exists($s, $_t) ? $_t[$s] : $s; + + return trim(str_replace('{ok}', '', $ret)); } /** |