- Timestamp:
- Oct 19, 2013, 11:21:01 AM (11 years ago)
- Location:
- trunk/include
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/include/functions.inc.php
r24833 r24988 901 901 902 902 /** 903 * returns the corresponding value from $lang if existing. Else, the key is 904 * returned 905 * 906 * @param string key 903 * translation function 904 * returns the corresponding value from $lang if existing, else the key is returned 905 * if more than one parameter is provided sprintf is applied 906 * @param string $key 907 * @param mixed $args,... optional arguments 907 908 * @return string 908 909 */ … … 915 916 if ($conf['debug_l10n'] and !isset($lang[$key]) and !empty($key)) 916 917 { 917 trigger_error('[l10n] language key "'. $key.'" isnot defined', E_USER_WARNING);918 trigger_error('[l10n] language key "'. $key .'" not defined', E_USER_WARNING); 918 919 } 919 920 $val = $key; 920 921 } 922 923 if (func_num_args() > 1) 924 { 925 $val = vsprintf($val, array_slice(func_get_args(), 1)); 926 } 927 921 928 return $val; 922 929 } 923 930 924 931 /** 925 * returns the prin ftvalue for strings including %d932 * returns the printf value for strings including %d 926 933 * return is concorded with decimal value (singular, plural) 927 934 * -
trunk/include/template.class.php
r23688 r24988 96 96 $this->smarty->registerPlugin('modifiercompiler', 'translate_dec', array('Template', 'modcompiler_translate_dec') ); 97 97 $this->smarty->registerPlugin('modifier', 'explode', array('Template', 'mod_explode') ); 98 $this->smarty->registerPlugin( 98 $this->smarty->registerPlugin('modifier', 'get_extent', array($this, 'get_extent') ); 99 99 $this->smarty->registerPlugin('block', 'html_head', array($this, 'block_html_head') ); 100 100 $this->smarty->registerPlugin('block', 'html_style', array($this, 'block_html_style') ); … … 488 488 } 489 489 490 static function get_php_str_val($str)490 private static function get_php_str_val($str) 491 491 { 492 492 if (is_string($str) && strlen($str)>1) … … 508 508 { 509 509 global $conf, $lang; 510 if ( $conf['compiled_template_cache_language'] 511 && ($key=self::get_php_str_val($params[0])) !== null) 512 { 513 if (isset($lang[$key])) 510 511 switch (count($params)) 512 { 513 case 1: 514 if ($conf['compiled_template_cache_language'] 515 && ($key=self::get_php_str_val($params[0])) !== null 516 && isset($lang[$key]) 517 ) { 514 518 return var_export($lang[$key], true); 515 } 516 return 'l10n('.$params[0].')'; 519 } 520 return 'l10n('.$params[0].')'; 521 522 default: 523 if ($conf['compiled_template_cache_language']) 524 { 525 $ret = 'sprintf('; 526 $ret .= self::modcompiler_translate( array($params[0]) ); 527 $ret .= ','. implode(',', array_slice($params, 1)); 528 $ret .= ')'; 529 return $ret; 530 } 531 return 'l10n('.$params[0].','.implode(',', array_slice($params, 1)).')'; 532 } 517 533 } 518 534 … … 520 536 { 521 537 global $conf, $lang, $lang_info; 522 if ( 538 if ($conf['compiled_template_cache_language']) 523 539 { 524 540 $ret = 'sprintf(';
Note: See TracChangeset
for help on using the changeset viewer.