You are here

public function DefaultTranslator::trans in Plug 7

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

lib/Symfony/validator/Symfony/Component/Validator/DefaultTranslator.php, line 74

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);
}