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

55 lines
851 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()
{
2015-08-16 17:04:56 +02:00
return call_user_func_array(array(Translator::getInstance(), 'translate'), func_get_args());
2014-10-22 19:59:09 +02:00
}
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()
{
2015-08-16 17:04:56 +02:00
return call_user_func_array(array(Translator::getInstance(), 'translateNoEscaping'), func_get_args());
2014-10-22 19:59:09 +02:00
}
2014-11-23 20:13:38 +01:00
/**
* Translate a number
*
* @return string
*/
2014-10-22 19:59:09 +02:00
function n($value)
{
2015-08-16 17:04:56 +02:00
return Translator::getInstance()->number($value);
2014-10-22 19:59:09 +02:00
}
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)
{
2015-08-16 17:04:56 +02:00
return Translator::getInstance()->datetime($format, $timestamp);
2014-10-22 19:59:09 +02:00
}
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;
}