summaryrefslogtreecommitdiff
path: root/app/functions.php
diff options
context:
space:
mode:
authorFrederic Guillot <fred@kanboard.net>2015-05-24 16:30:40 -0400
committerFrederic Guillot <fred@kanboard.net>2015-05-24 16:30:40 -0400
commit03fc8a1bce033cc8334f588f3c95baffa1291b54 (patch)
tree76f36cc3ecbf165476bae8a6e4f1e4f1340b6ec6 /app/functions.php
parenteeac2329baab1fdae7cbf6c707ed2ffd8beb4c1b (diff)
Avoid creating multiple instances of Translator
Diffstat (limited to 'app/functions.php')
-rw-r--r--app/functions.php25
1 files changed, 4 insertions, 21 deletions
diff --git a/app/functions.php b/app/functions.php
index 439375be..e4b38cdd 100644
--- a/app/functions.php
+++ b/app/functions.php
@@ -9,8 +9,7 @@ use Core\Translator;
*/
function t()
{
- $t = new Translator;
- return call_user_func_array(array($t, 'translate'), func_get_args());
+ return call_user_func_array(array(Translator::getInstance(), 'translate'), func_get_args());
}
/**
@@ -20,19 +19,7 @@ function t()
*/
function e()
{
- $t = new Translator;
- return call_user_func_array(array($t, 'translateNoEscaping'), func_get_args());
-}
-
-/**
- * Translate a currency
- *
- * @return string
- */
-function c($value)
-{
- $t = new Translator;
- return $t->currency($value);
+ return call_user_func_array(array(Translator::getInstance(), 'translateNoEscaping'), func_get_args());
}
/**
@@ -42,8 +29,7 @@ function c($value)
*/
function n($value)
{
- $t = new Translator;
- return $t->number($value);
+ return Translator::getInstance()->number($value);
}
/**
@@ -53,8 +39,7 @@ function n($value)
*/
function dt($format, $timestamp)
{
- $t = new Translator;
- return $t->datetime($format, $timestamp);
+ return Translator::getInstance()->datetime($format, $timestamp);
}
/**
@@ -67,5 +52,3 @@ function p($value, $t1, $t2)
{
return $value > 1 ? $t2 : $t1;
}
-
-