PKPTemplateManager::smartyTranslate PHP Method

smartyTranslate() public method

..]} Custom Smarty function for translating localization keys. Substitution works by replacing tokens like "{$foo}" with the value of the parameter named "foo" (if supplied).
public smartyTranslate ( $params, $smarty ) : string
$params array associative array, must contain "key" parameter for string to translate plus zero or more named parameters for substitution. Translation variables can be specified also as an optional associative array named "params".
$smarty Smarty
return string the localized string, including any parameter substitutions
    function smartyTranslate($params, $smarty)
    {
        if (isset($params) && !empty($params)) {
            if (!isset($params['key'])) {
                return __('');
            }
            $key = $params['key'];
            unset($params['key']);
            if (isset($params['params']) && is_array($params['params'])) {
                $paramsArray = $params['params'];
                unset($params['params']);
                $params = array_merge($params, $paramsArray);
            }
            return __($key, $params);
        }
    }