public function translate($params, &$smarty)
    {
        // All parameters other than 'l' and 'd' and 'js' are supposed to be variables. Build an array of var => value pairs
        // and pass it to the translator
        $vars = array();

        foreach ($params as $name => $value) {
            if (!in_array($name, $this->protectedParams)) {
                $vars["%$name"] = $value;
            }
        }

        $str = $this->translator->trans(
            $this->getParam($params, 'l'),
            $vars,
            $this->getParam($params, 'd', $this->defaultTranslationDomain),
            $this->getParam($params, 'locale', $this->defaultLocale),
            $this->getBoolean($this->getParam($params, 'default', true), true),
            $this->getBoolean($this->getParam($params, 'fallback', true), true)
        );

        if ($this->getParam($params, 'js', 0)) {
            $str = preg_replace("/(['\"])/", "\\\\$1", $str);
        }

        return $str;
    }