Archive for outubro \29\UTC 2009

Translate plugin – Smarty Template

outubro 29th, 2009
function smarty_block_translate ($params, $content, &$smarty, &$repeat) {
  if (isset($content)) {
     global $lang;
     if(isset($lang)){
        $cd_language = isset($params['lang'])?$params['lang']:LANG;
        if(isset($params['type'])){
           if($params['type']=='date'){
              $format = isset($lang['d/m/Y'][$cd_language])?$lang['d/m/Y'][$cd_language]:'d/m/Y';
              $result = date($format,$content);
           }
        }else if(isset($lang[$content][$cd_language])){
           $result = $lang[$content][$cd_language];
        }
        if(isset($result)){
           return $result;
        }
    }
    return $content;
  }
}
BlogBlogs.Com.Br