Advertisement
Guest User

Untitled

a guest
Aug 29th, 2015
74
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.73 KB | None | 0 0
  1. {capture assign="var"}{tr}...{/tr}{/capture}
  2. {$var|truncate}
  3.  
  4. {truncate}{tr}...{/tr}{/truncate}
  5.  
  6. function do_translation($params, $content, $smarty, &$repeat) {
  7. if (isset($content)) {
  8. $options = $params["options"];
  9. $content = yourTranslateFunction($content);
  10. if ($options['truncate']) $content = yourTruncateFunction($content);
  11. return $content;
  12. }
  13. }
  14. $smarty->registerPlugin("block", "tr", "do_translation");
  15.  
  16. {tr truncate="1"}Really long text I want to be translated then truncated{/tr}
  17.  
  18. $smarty->registerPlugin('block', 'tr', 'do_translation', true);
  19. $smarty->registerPlugin('block', 'truncate', 'do_truncation', true);
  20.  
  21. {truncate}{tr}Really long text I want to be translated then truncated{/tr}{/truncate}
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement