src/Language/Translator.php
public function translate($id, array $parameters = array(), $locale = null) {
        if (null === $locale) {
            $locale = $this->getLocale();
        } else {
            $this->assertValidLocale($locale);
        }
        //Get the translations
        $translations = $this->getTranslation($locale);

        //Calculate the translation and replace the parameters
        return strtr($this->getTranslationForId($id, $translations), $parameters);
    }
public function translate($id, array $parameters = array(), $locale = null) {
        if (null === $locale) {
            $locale = $this->getLocale();
        } else {
            $this->assertValidLocale($locale);
        }
        //Get the translations
        $translations = $this->getTranslation($locale);

        //Calculate the translation and replace the parameters
        return strtr($this->getTranslationForId($id, $translations), $parameters);
    }
Translates the given message.

@param string      $id         The message id (may also be an object that can be cast to string)
@param array       $parameters An array of parameters for the message
@param string|null $locale     The locale or null to use the default

@throws \InvalidArgumentException If the locale contains invalid characters

@return string The translated string