ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
translator_functions.php
Go to the documentation of this file.
1 <?php
2 
4 
12 function __($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 
34 function 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 
55 function 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 
76 function 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 
98 function 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 
121 function 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 
145 function 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 
163 function __e()
164 {
165  echo call_user_func_array('__', func_get_args());
166 }
167 
173 function n__e()
174 {
175  echo call_user_func_array('n__', func_get_args());
176 }
177 
183 function p__e()
184 {
185  echo call_user_func_array('p__', func_get_args());
186 }
187 
193 function d__e()
194 {
195  echo call_user_func_array('d__', func_get_args());
196 }
197 
203 function dp__e()
204 {
205  echo call_user_func_array('dp__', func_get_args());
206 }
207 
213 function dnp__e()
214 {
215  echo call_user_func_array('dnp__', func_get_args());
216 }
__e()
Prints function result.
__($original)
Returns the translation of a string.
$context
Definition: webdav.php:25
n__e()
Prints function result.
dnp__($domain, $context, $original, $plural, $value)
Returns the singular/plural translation of a string in a specific domain and context.
d__e()
Prints function result.
p__e()
Prints function result.
$text
Definition: errorreport.php:18
dp__e()
Prints function result.
n__($original, $plural, $value)
Returns the singular/plural translation of a string.
dnp__e()
Prints function result.
if(!array_key_exists('domain', $_REQUEST)) $domain
Definition: resume.php:8
np__($context, $original, $plural, $value)
Returns the singular/plural translation of a string in a specific context.
d__($domain, $original)
Returns the translation of a string in a specific domain.
p__($context, $original)
Returns the translation of a string in a specific context.
dp__($domain, $context, $original)
Returns the translation of a string in a specific domain and context.