src/FormView.php
protected function translate($str, $params = array())
    {
        if (isset($this->translator)) {
            return $this->translator->trans($str, $params);
        }
        else {
            $finalParams = array();
            foreach ($params as $placeholder => $value) {
                $finalParams['{'.$placeholder.'}'] = $value;
            }
            return strtr($str, $finalParams);
        }
    }
protected function translate($str, $params = array())
    {
        if (isset($this->translator)) {
            return $this->translator->trans($str, $params);
        }
        else {
            $finalParams = array();
            foreach ($params as $placeholder => $value) {
                $finalParams['{'.$placeholder.'}'] = $value;
            }
            return strtr($str, $finalParams);
        }
    }
protected function translate ( $ str , $ params = array ( ) ) { if ( isset ( $ this -> translator ) ) { return $ this -> translator -> trans ( $ str , $ params ) ; } else { $ finalParams = array ( ) ; foreach ( $ params as $ placeholder => $ value ) { $ finalParams [ '{' . $ placeholder . '}' ] = $ value ; } return strtr ( $ str , $ finalParams ) ; } }
Translate a string if the translator has been injected

@param $str string The string that will be translated
@param array $params
@return string
Translate a string if the translator has been injected