@@ 94-109 (lines=16) @@ | ||
91 | * @param int $category categoria del mensaje (LC_CTYPE, LC_NUMERIC, LC_TIME, LC_COLLATE, LC_MONETARY, LC_MESSAGES, LC_ALL) |
|
92 | * @return string |
|
93 | * */ |
|
94 | public static function cget($sentence, $category) |
|
95 | { |
|
96 | /** |
|
97 | * Obtengo la traduccion |
|
98 | * */ |
|
99 | $sentence = dcgettext(textdomain(null), $sentence, $category); |
|
100 | ||
101 | /** |
|
102 | * Si se pasan multiples parametros |
|
103 | * */ |
|
104 | if (func_num_args() > 2) { |
|
105 | $sentence = $sentence = self::sprintf($sentence, func_get_args(), 2); |
|
106 | } |
|
107 | ||
108 | return $sentence; |
|
109 | } |
|
110 | ||
111 | /** |
|
112 | * Obtiene una traduccion al plural por categoria, cuando se pasan argumentos adicionales se remplaza con sprintf |
|
@@ 120-135 (lines=16) @@ | ||
117 | * @param int $category categoria del mensaje (LC_CTYPE, LC_NUMERIC, LC_TIME, LC_COLLATE, LC_MONETARY, LC_MESSAGES, LC_ALL) |
|
118 | * @return string |
|
119 | * */ |
|
120 | public static function cnget($sentence1, $sentence2, $n, $category) |
|
121 | { |
|
122 | /** |
|
123 | * Obtengo la traduccion en funcion del dominio |
|
124 | * */ |
|
125 | $sentence = dcngettext(textdomain(null), $sentence1, $sentence2, $n, $category); |
|
126 | ||
127 | /** |
|
128 | * Si se pasan multiples parametros |
|
129 | * */ |
|
130 | if (func_num_args() > 4) { |
|
131 | $sentence = self::sprintf($sentence, func_get_args(), 4); |
|
132 | } |
|
133 | ||
134 | return $sentence; |
|
135 | } |
|
136 | ||
137 | ||
138 | private static function sprintf($sentence, $args, $offset) |