aboutsummaryrefslogtreecommitdiffstats
path: root/langs.inc.php
diff options
context:
space:
mode:
Diffstat (limited to 'langs.inc.php')
-rw-r--r--langs.inc.php24
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.
*
*/