Changeset 2427
- Timestamp:
- 09/01/08 18:08:38 (3 months ago)
- Files:
-
- 1 modified
-
trunk/htdocs/system/classes/locale.php (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/htdocs/system/classes/locale.php
r2380 r2427 260 260 * @param string $domain (optional) The domain to search for the message 261 261 **/ 262 public static function _e( $text, $domain= 'habari' ) 263 { 264 echo self::_t( $text, $domain ); 262 public static function _e( ) 263 { 264 $args = func_get_args(); 265 echo call_user_func_array(array('Locale', '_t'), $args); 265 266 } 266 267 267 268 /** 268 269 * Return a version of the string translated into the current locale 269 * 270 * 270 271 * @param string $text The text to echo translated 271 * @param string $domain (optional) The domain to search for the message 272 * @param string $domain (optional) The domain to search for the message 272 273 * @return string The translated string 273 274 **/ 274 public static function _t( $text, $domain= 'habari' ) 275 { 275 public static function _t($text, $args = array(), $domain = 'habari') 276 { 277 if( is_string($args) ) { 278 $domain = $args; 279 } 280 276 281 if ( isset( self::$messages[$domain][$text] ) ) { 277 returnself::$messages[$domain][$text][1][0];282 $t = self::$messages[$domain][$text][1][0]; 278 283 } 279 284 else { 280 return $text; 281 } 285 $t = $text; 286 } 287 288 if(!empty($args) && is_array($args)) { 289 array_unshift($args, $t); 290 $t = call_user_func_array('sprintf', $args); 291 } 292 293 return $t; 282 294 } 283 295 … … 324 336 * @param string $text The text to translate 325 337 **/ 326 function _e( $text, $ domain= 'habari' )327 { 328 return Locale::_e( $text, $ domain );338 function _e( $text, $args = array(), $domain= 'habari' ) 339 { 340 return Locale::_e( $text, $args, $domain ); 329 341 } 330 342 … … 348 360 * @return string The translated string 349 361 **/ 350 function _t( $text, $ domain= 'habari' )351 { 352 return Locale::_t( $text, $ domain );362 function _t( $text, $args = array(), $domain= 'habari' ) 363 { 364 return Locale::_t( $text, $args, $domain ); 353 365 } 354 366
