diff options
author | Frédéric Guillot <fred@kanboard.net> | 2014-05-22 12:28:28 -0400 |
---|---|---|
committer | Frédéric Guillot <fred@kanboard.net> | 2014-05-22 12:28:28 -0400 |
commit | 2230dd4e6b148346c0ec596b9e3e12996a762ed8 (patch) | |
tree | ef99ccde4f8b18592a3fb06a6ec45162c501fe38 /app/translator.php | |
parent | a750b8ab2a0cb715da6fd9025a7ec8375db68a4d (diff) |
Code refactoring (add autoloader and change files organization)
Diffstat (limited to 'app/translator.php')
-rw-r--r-- | app/translator.php | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/app/translator.php b/app/translator.php new file mode 100644 index 00000000..338821d3 --- /dev/null +++ b/app/translator.php @@ -0,0 +1,36 @@ +<?php + +use Core\Translator; + +// Get a translation +function t() +{ + $t = new Translator; + return call_user_func_array(array($t, 'translate'), func_get_args()); +} + +// Get a locale currency +function c($value) +{ + $t = new Translator; + return $t->currency($value); +} + +// Get a formatted number +function n($value) +{ + $t = new Translator; + return $t->number($value); +} + +// Get a locale date +function dt($format, $timestamp) +{ + $t = new Translator; + return $t->datetime($format, $timestamp); +} + +// Plurals, return $t2 if $value > 1 +function p($value, $t1, $t2) { + return $value > 1 ? $t2 : $t1; +} |