From f28822ff2081c469ae0131274150be9d5ac0bd93 Mon Sep 17 00:00:00 2001 From: Romain d'Alverny Date: Tue, 22 May 2012 19:47:12 +0000 Subject: new _h() helper, more helping _e() --- langs.inc.php | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) (limited to 'langs.inc.php') diff --git a/langs.inc.php b/langs.inc.php index f81e000ba..1d592e3d7 100644 --- a/langs.inc.php +++ b/langs.inc.php @@ -159,8 +159,22 @@ function _t($s = null, $opt = null) { return ($s == '' ? '---' : (array_key_exists($s, $_t) ? $_t[$s] : $s)); } -function _e($s = null) { - echo _t($s); +/** + * Shorthand to echo localized strings. + * +*/ +function _e($s = null, $args = null) { + if (is_array($args)) + echo vsprintf(_t($s), $args); + else + echo _t($s); +} + +function _h($s, $args = null, $tag = 'p') { + if (is_array($args)) + $s = vsprintf(_t($s), $args); + + echo sprintf('<%s>%s', $tag, $s, $tag); } /** -- cgit v1.2.1