Index: trunk/phase3/includes/Message.php |
— | — | @@ -170,6 +170,20 @@ |
171 | 171 | } |
172 | 172 | |
173 | 173 | /** |
| 174 | + * Add parameters that are numeric and will be passed through |
| 175 | + * Language::formatNum before substitution |
| 176 | + * @param Varargs: numeric parameters |
| 177 | + * @return Message: $this |
| 178 | + */ |
| 179 | + public function numParams( /*...*/ ) { |
| 180 | + $params = func_get_args(); |
| 181 | + foreach( $params as $param ) { |
| 182 | + $this->parameters[] = self::numParam( $param ); |
| 183 | + } |
| 184 | + return $this; |
| 185 | + } |
| 186 | + |
| 187 | + /** |
174 | 188 | * Request the message in any language that is supported. |
175 | 189 | * As a side effect interface message status is unconditionally |
176 | 190 | * turned off. |
— | — | @@ -328,6 +342,10 @@ |
329 | 343 | public static function rawParam( $value ) { |
330 | 344 | return array( 'raw' => $value ); |
331 | 345 | } |
| 346 | + |
| 347 | + public static function numParam( $value ) { |
| 348 | + return array( 'num' => $value ); |
| 349 | + } |
332 | 350 | |
333 | 351 | /** |
334 | 352 | * Substitutes any paramaters into the message text. |
— | — | @@ -342,6 +360,9 @@ |
343 | 361 | $replacementKeys['$' . ($n + 1)] = $param; |
344 | 362 | } elseif ( $type === 'after' && isset( $param['raw'] ) ) { |
345 | 363 | $replacementKeys['$' . ($n + 1)] = $param['raw']; |
| 364 | + } elseif ( isset( $param['num'] ) ) { |
| 365 | + $replacementKeys['$' . ($n + 1)] = |
| 366 | + $this->language->formatNum( $param['num'] ); |
346 | 367 | } |
347 | 368 | } |
348 | 369 | $message = strtr( $message, $replacementKeys ); |