diff options
author | Romain d'Alverny <rda@mageia.org> | 2012-05-11 10:10:17 +0000 |
---|---|---|
committer | Romain d'Alverny <rda@mageia.org> | 2012-05-11 10:10:17 +0000 |
commit | 1f89b1714f66b2a7b29f45c30ac90c3b640f8e57 (patch) | |
tree | 1875607fae95e810b24d31e77335428ec2b1737c /langs.inc.php | |
parent | 954f21aee04b66af7a450e6d6370394708dff945 (diff) | |
download | www-1f89b1714f66b2a7b29f45c30ac90c3b640f8e57.tar www-1f89b1714f66b2a7b29f45c30ac90c3b640f8e57.tar.gz www-1f89b1714f66b2a7b29f45c30ac90c3b640f8e57.tar.bz2 www-1f89b1714f66b2a7b29f45c30ac90c3b640f8e57.tar.xz www-1f89b1714f66b2a7b29f45c30ac90c3b640f8e57.zip |
new _e() and _t() i18n helper functions
Diffstat (limited to 'langs.inc.php')
-rw-r--r-- | langs.inc.php | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/langs.inc.php b/langs.inc.php index 49f326f9d..ad1f34862 100644 --- a/langs.inc.php +++ b/langs.inc.php @@ -139,6 +139,30 @@ S; } /** + * Shorthand functions to echo localized strings. + * + * @param string $s string to localize + * @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) { + if (!is_null($opt)) + $_t = $opt; + else { + global $_t; + } + return ($s == '' ? '-EMPTY-STRING-' : (array_key_exists($s, $_t) ? $_t[$s] : $s)); +} + +function _e($s = null) { + echo _t($s); +} + +/** * Class regrouping basic methods for i18n strings in their current forms. * */ |