ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
translator_functions.php
Go to the documentation of this file.
1<?php
2
4
12function __($original)
13{
14 $text = BaseTranslator::$current->gettext($original);
15
16 if (func_num_args() === 1) {
17 return $text;
18 }
19
20 $args = array_slice(func_get_args(), 1);
21
22 return vsprintf($text, is_array($args[0]) ? $args[0] : $args);
23}
24
34function n__($original, $plural, $value)
35{
36 $text = BaseTranslator::$current->ngettext($original, $plural, $value);
37
38 if (func_num_args() === 3) {
39 return $text;
40 }
41
42 $args = array_slice(func_get_args(), 3);
43
44 return vsprintf($text, is_array($args[0]) ? $args[0] : $args);
45}
46
55function p__($context, $original)
56{
57 $text = BaseTranslator::$current->pgettext($context, $original);
58
59 if (func_num_args() === 2) {
60 return $text;
61 }
62
63 $args = array_slice(func_get_args(), 2);
64
65 return vsprintf($text, is_array($args[0]) ? $args[0] : $args);
66}
67
76function d__($domain, $original)
77{
78 $text = BaseTranslator::$current->dgettext($domain, $original);
79
80 if (func_num_args() === 2) {
81 return $text;
82 }
83
84 $args = array_slice(func_get_args(), 2);
85
86 return vsprintf($text, is_array($args[0]) ? $args[0] : $args);
87}
88
98function dp__($domain, $context, $original)
99{
100 $text = BaseTranslator::$current->dpgettext($domain, $context, $original);
101
102 if (func_num_args() === 3) {
103 return $text;
104 }
105
106 $args = array_slice(func_get_args(), 3);
107
108 return vsprintf($text, is_array($args[0]) ? $args[0] : $args);
109}
110
121function np__($context, $original, $plural, $value)
122{
123 $text = BaseTranslator::$current->npgettext($context, $original, $plural, $value);
124
125 if (func_num_args() === 4) {
126 return $text;
127 }
128
129 $args = array_slice(func_get_args(), 4);
130
131 return vsprintf($text, is_array($args[0]) ? $args[0] : $args);
132}
133
145function dnp__($domain, $context, $original, $plural, $value)
146{
147 $text = BaseTranslator::$current->dnpgettext($domain, $context, $original, $plural, $value);
148
149 if (func_num_args() === 5) {
150 return $text;
151 }
152
153 $args = array_slice(func_get_args(), 5);
154
155 return vsprintf($text, is_array($args[0]) ? $args[0] : $args);
156}
157
163function __e()
164{
165 echo call_user_func_array('__', func_get_args());
166}
167
173function n__e()
174{
175 echo call_user_func_array('n__', func_get_args());
176}
177
183function p__e()
184{
185 echo call_user_func_array('p__', func_get_args());
186}
187
193function d__e()
194{
195 echo call_user_func_array('d__', func_get_args());
196}
197
203function dp__e()
204{
205 echo call_user_func_array('dp__', func_get_args());
206}
207
213function dnp__e()
214{
215 echo call_user_func_array('dnp__', func_get_args());
216}
if(!array_key_exists('domain', $_REQUEST)) $domain
Definition: resume.php:8
An exception for terminatinating execution or to throw for unit testing.
np__($context, $original, $plural, $value)
Returns the singular/plural translation of a string in a specific context.
n__($original, $plural, $value)
Returns the singular/plural translation of a string.
d__($domain, $original)
Returns the translation of a string in a specific domain.
dnp__e()
Prints function result.
dnp__($domain, $context, $original, $plural, $value)
Returns the singular/plural translation of a string in a specific domain and context.
dp__e()
Prints function result.
p__($context, $original)
Returns the translation of a string in a specific context.
p__e()
Prints function result.
dp__($domain, $context, $original)
Returns the translation of a string in a specific domain and context.
n__e()
Prints function result.
d__e()
Prints function result.
__($original)
Returns the translation of a string.
__e()
Prints function result.
$text
Definition: errorreport.php:18