src/IntlService.php
public function _($text, $replacements = null, $locale = null)
    {
        if (!$locale) {
            $locale = $this->getLocale();
        }

        if ($this->translator !== null) {
            $text = $this->translator->translate($text, $locale);
        }

        return $this->replace($text, $replacements);
    }
public function _($text, $replacements = null, $locale = null)
    {
        if (!$locale) {
            $locale = $this->getLocale();
        }

        if ($this->translator !== null) {
            $text = $this->translator->translate($text, $locale);
        }

        return $this->replace($text, $replacements);
    }
public function _ ( $ text , $ replacements = null , $ locale = null ) { if ( ! $ locale ) { $ locale = $ this -> getLocale ( ) ; } if ( $ this -> translator !== null ) { $ text = $ this -> translator -> translate ( $ text , $ locale ) ; } return $ this -> replace ( $ text , $ replacements ) ; }
Translate a text.

@param string     $text         The text to translate.
@param array|null $replacements Values that should be replaced.
@param string     $locale       The locale or null to use the current locale.

@return string Translated text or given text if no translation found.
Translate a text .