Ver Mensaje Individual
  #9 (permalink)  
Antiguo 03/01/2013, 13:13
Avatar de masterpuppet
masterpuppet
Software Craftsman
 
Fecha de Ingreso: enero-2008
Ubicación: Montevideo, Uruguay
Mensajes: 3.550
Antigüedad: 16 años, 3 meses
Puntos: 845
Respuesta: clase prefabricada para smarty

Es dificil dejarlo mas claro que la doc, de todas formas podria ser lago asi:

Código PHP:
Ver original
  1. function do_translation ($params, $content, &$smarty, &$repeat)
  2. {
  3.     static $translator;
  4.     if(null === $translator) {
  5.         $translator = new Translator($params['lang']);        
  6.         ...
  7.     }    
  8.     return $translator->translate($content);            
  9. }
  10.  
  11. // register with smarty
  12. $smarty->register_block('translate', 'do_translation');
Código HTML:
Ver original
  1. {translate lang='es'}Hello, world!{/translate}
__________________
http://es.phptherightway.com/
thats us riders :)