Location: PHPKode > projects > Open Rent Stock > rentstock/ext/smarty/smarty_extensions/function.T.php
<?php
/**
 * translation function
 * simple:
 * @param v string stranslation key
 * {T v="translation-key"}
 * 
 * with vsprintf
 * @param v string stranslation key
 * @param v1 v2 v3 ... string replace values
 * {T v="translation-key" v1="insert value 1" v2="insert value 2" ...and so on...}
 */
function smarty_function_T($params, &$smarty){
    global $rs_language;
    
    if (!isset($params['v'])) {
        $smarty->trigger_error("assign: missing 'v' parameter");
        return;
    }
    $args = array();
    $i = 1;
    while(isset($params['v'.$i])){
    	$args[] = isset($params['html']) ? $params['v'.$i] : htmlentities($params['v'.$i], ENT_QUOTES, SMARTY_MOD_HTML_USE_CHARSET);
    	$i ++;
    }
    if(count($args)){
    	$txt = vsprintf($rs_language->get_translation($params['v']), $args);
    }else{
    	$txt = $rs_language->get_translation($params['v']);
    }
    if(isset($params['html'])){
    	$txt = htmlentities($string, ENT_QUOTES, SMARTY_MOD_HTML_USE_CHARSET);
    }
    if(isset($params['js'])){
    	$txt = strtr($txt, array('\\'=>'\\\\',"'"=>"\\'",'"'=>'\\"',"\r"=>'\\r',"\n"=>'\\n','</'=>'<\/'));
    }
    return $txt;
}
?>
Return current item: Open Rent Stock