1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/kanboard_ynh.git synced 2024-09-03 19:36:17 +02:00
kanboard_ynh/sources/app/functions.php

72 lines
996 B
PHP
Raw Normal View History

2014-10-22 19:59:09 +02:00
<?php
use Core\Translator;
2014-11-23 20:13:38 +01:00
/**
* Translate a string
*
* @return string
*/
2014-10-22 19:59:09 +02:00
function t()
{
$t = new Translator;
return call_user_func_array(array($t, 'translate'), func_get_args());
}
2014-11-23 20:13:38 +01:00
/**
* Translate a string with no HTML escaping
*
* @return string
*/
2014-10-22 19:59:09 +02:00
function e()
{
$t = new Translator;
return call_user_func_array(array($t, 'translateNoEscaping'), func_get_args());
}
2014-11-23 20:13:38 +01:00
/**
* Translate a currency
*
* @return string
*/
2014-10-22 19:59:09 +02:00
function c($value)
{
$t = new Translator;
return $t->currency($value);
}
2014-11-23 20:13:38 +01:00
/**
* Translate a number
*
* @return string
*/
2014-10-22 19:59:09 +02:00
function n($value)
{
$t = new Translator;
return $t->number($value);
}
2014-11-23 20:13:38 +01:00
/**
* Translate a date
*
* @return string
*/
2014-10-22 19:59:09 +02:00
function dt($format, $timestamp)
{
$t = new Translator;
return $t->datetime($format, $timestamp);
}
2014-11-23 20:13:38 +01:00
/**
* Handle plurals, return $t2 if $value > 1
*
* @todo Improve this function
* @return mixed
*/
2015-02-25 17:29:06 +01:00
function p($value, $t1, $t2)
{
2014-10-22 19:59:09 +02:00
return $value > 1 ? $t2 : $t1;
}
2015-02-25 17:29:06 +01:00