/** * Builds a translator * @return \Symfony\Component\Translation\TranslatorInterface */ public function build() { $fixer = new VendorDirectoryFixer(); // Set up the Translation component $translator = new Translator($this->locale); $pos = strpos($this->locale, '_'); $file = 'validators.' . ($pos ? substr($this->locale, 0, $pos) : $this->locale) . '.xlf'; $translator->addLoader('xlf', new XliffFileLoader()); $translator->addResource('xlf', $fixer->getLocation('form', self::FORM_TRANSLATIONS_DIR . $file), $this->locale, self::TRANSLATION_DOMAIN); $translator->addResource('xlf', $fixer->getLocation('validator', self::VALIDATOR_TRANSLATIONS_DIR . $file), $this->locale, self::TRANSLATION_DOMAIN); return $translator; }
public function __construct() { $fixer = new VendorDirectoryFixer(); $dir = $fixer->getLocation('twig-bridge', self::TEMPLATE_DIR); $this->twig_loader = new \Twig_Loader_Filesystem(array($dir)); }