<?php
use Symfony\Component\Translation\Translator;
use Symfony\Component\Translation\MessageSelector;
use Symfony\Component\Translation\Loader\ArrayLoader;
$translator = new Translator('de_DE');
$translator->addLoader('array', new ArrayLoader());
// German translations
$translator->addResource('array', array(
'budgie' => 'Wellensittich',
), 'de');
// English translations
$translator->addResource('array', array(
'budgie' => 'Budgerigar',
), 'en');
// German translations with domain "badisch"
$translator->addResource('array', array(
'budgie' => 'Wellesiddich',
), 'de', 'badisch');
echo $translator->trans('budgie') . PHP_EOL;
echo $translator->trans('budgie', array(), null, 'en_US') . PHP_EOL;
echo $translator->trans('budgie', array(), 'badisch') . PHP_EOL;