You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

39 lines
1.0 KiB

<?php
// (c) Copyright by authors of the Tiki Wiki CMS Groupware Project
//
// All Rights Reserved. See copyright.txt for details and a complete list of authors.
// Licensed under the GNU LESSER GENERAL PUBLIC LICENSE. See license.txt for details.
// $Id$
/**
* Smarty plugin
* @package Smarty
* @subpackage plugins
*
* Smarty {translation lang=XX}{/translation} block plugin
*
* Type: block function<br>
* Name: translation<br>
* Purpose: Support many languages in a template, only showing block
if language matches
* @param array
* <pre>
* Params: lang: string (language, ex: en, pt-br)
* </pre>
* @param string contents of the block
* @param Smarty clever simulation of a method
* @return string string $content re-formatted
*/
function smarty_block_translation($params, $content, $smarty, &$repeat)
{
if (! $repeat && ! empty($content)) {
$lang = $params['lang'];
if ($smarty->getTemplateVars('language') == $lang) {
return $content;
} else {
return '';
}
}
}