Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- {capture assign="var"}{tr}...{/tr}{/capture}
- {$var|truncate}
- {truncate}{tr}...{/tr}{/truncate}
- function do_translation($params, $content, $smarty, &$repeat) {
- if (isset($content)) {
- $options = $params["options"];
- $content = yourTranslateFunction($content);
- if ($options['truncate']) $content = yourTruncateFunction($content);
- return $content;
- }
- }
- $smarty->registerPlugin("block", "tr", "do_translation");
- {tr truncate="1"}Really long text I want to be translated then truncated{/tr}
- $smarty->registerPlugin('block', 'tr', 'do_translation', true);
- $smarty->registerPlugin('block', 'truncate', 'do_truncation', true);
- {truncate}{tr}Really long text I want to be translated then truncated{/tr}{/truncate}
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement