You are here

public function DefaultTranslator::trans in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 vendor/symfony/validator/DefaultTranslator.php \Symfony\Component\Validator\DefaultTranslator::trans()

Interpolates the given message.

Parameters are replaced in the message in the same manner that {@link strtr()} uses.

Example usage:

$translator = new DefaultTranslator();

echo $translator->trans( 'This is a {{ var }}.', array('{{ var }}' => 'donkey') );

// -> This is a donkey.

Parameters

string $id The message id:

array $parameters An array of parameters for the message:

string $domain Ignored:

string $locale Ignored:

Return value

string The interpolated string

Overrides TranslatorInterface::trans

File

vendor/symfony/validator/DefaultTranslator.php, line 78

Class

DefaultTranslator
Simple translator implementation that simply replaces the parameters in the message IDs.

Namespace

Symfony\Component\Validator

Code

public function trans($id, array $parameters = array(), $domain = null, $locale = null) {
  return strtr($id, $parameters);
}