summaryrefslogtreecommitdiff
path: root/app/translator.php
blob: ac4d72e2002e56c620ca06e47231b53e69404d78 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
<?php

use Core\Translator;

// Get a translation
function t()
{
    $t = new Translator;
    return call_user_func_array(array($t, 'translate'), func_get_args());
}

// translate with no html escaping
function e()
{
    $t = new Translator;
    return call_user_func_array(array($t, 'translateNoEscaping'), 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;
}