|
1 <?php |
|
2 |
|
3 if (!class_exists('ExecPhp_L10n')) : |
|
4 |
|
5 if (!function_exists('translate')) : |
|
6 // downward compatibility for older WP installations |
|
7 function translate($text, $domain) |
|
8 { |
|
9 global $l10n; |
|
10 |
|
11 if (isset($l10n[$domain])) { |
|
12 return $l10n[$domain]->translate($text); |
|
13 } else { |
|
14 return $text; |
|
15 } |
|
16 } |
|
17 endif; |
|
18 |
|
19 if (!function_exists('translate_sprintf')) : |
|
20 function translate_sprintf($text, $domain = 'default') |
|
21 { |
|
22 if (func_num_args() <= 2) |
|
23 return translate($text, $domain); |
|
24 $args = func_get_args(); |
|
25 array_shift($args); |
|
26 array_shift($args); |
|
27 array_unshift($args, translate($text, $domain)); |
|
28 return call_user_func_array('sprintf', $args); |
|
29 } |
|
30 endif; |
|
31 |
|
32 if (!function_exists('__s')) : |
|
33 function __s($text, $domain = 'default') |
|
34 { |
|
35 $args = func_get_args(); |
|
36 return call_user_func_array('translate_sprintf', $args); |
|
37 } |
|
38 endif; |
|
39 |
|
40 if (!function_exists('_es')) : |
|
41 function _es($text, $domain = 'default') |
|
42 { |
|
43 $args = func_get_args(); |
|
44 echo call_user_func_array('translate_sprintf', $args); |
|
45 } |
|
46 endif; |
|
47 |
|
48 if (!function_exists('escape_dquote')) : |
|
49 function escape_dquote($text) |
|
50 { |
|
51 return str_replace('"', '\"', $text); |
|
52 } |
|
53 endif; |
|
54 |
|
55 class ExecPhp_L10n |
|
56 { |
|
57 } |
|
58 endif; |
|
59 |
|
60 ?> |