コード例 #1
0
 /**
  * @param TemplateDefinition $template the template to process, or null for using the front template
  *
  * @return ParserInterface the Thelia parser²
  */
 protected function getParser($template = null)
 {
     $parser = $this->container->get("thelia.parser");
     // Define the template that should be used
     $parser->setTemplateDefinition($template ?: TemplateHelper::getInstance()->getActiveFrontTemplate());
     return $parser;
 }
コード例 #2
0
ファイル: ViewListener.php プロジェクト: alex63530/thelia
 /**
  *
  * Launch the parser defined on the constructor and get the result.
  *
  * The result is transform id needed into a Response object
  *
  * @param \Symfony\Component\HttpKernel\Event\GetResponseForControllerResultEvent $event
  */
 public function onKernelView(GetResponseForControllerResultEvent $event)
 {
     $parser = $this->container->get('thelia.parser');
     $parser->setTemplateDefinition(TemplateHelper::getInstance()->getActiveFrontTemplate());
     $request = $this->container->get('request');
     $response = null;
     try {
         $content = $parser->render($request->attributes->get('_view') . ".html");
         if ($content instanceof Response) {
             $response = $content;
         } else {
             $response = new Response($content, $parser->getStatus() ?: 200);
         }
     } catch (ResourceNotFoundException $e) {
         throw new NotFoundHttpException();
     } catch (AuthenticationException $ex) {
         // Redirect to the login template
         $response = RedirectResponse::create($this->container->get('thelia.url.manager')->viewUrl($ex->getLoginTemplate()));
     } catch (OrderException $e) {
         switch ($e->getCode()) {
             case OrderException::CART_EMPTY:
                 // Redirect to the cart template
                 $response = RedirectResponse::create($this->container->get('router.chainRequest')->generate($e->cartRoute, $e->arguments, Router::ABSOLUTE_URL));
                 break;
             case OrderException::UNDEFINED_DELIVERY:
                 // Redirect to the delivery choice template
                 $response = RedirectResponse::create($this->container->get('router.chainRequest')->generate($e->orderDeliveryRoute, $e->arguments, Router::ABSOLUTE_URL));
                 break;
         }
         if (null === $response) {
             throw $e;
         }
     }
     $event->setResponse($response);
 }
コード例 #3
0
ファイル: HttpException.php プロジェクト: alex63530/thelia
 protected function display404(GetResponseForExceptionEvent $event)
 {
     // Define the template thant shoud be used
     $this->parser->setTemplateDefinition(TemplateHelper::getInstance()->getActiveFrontTemplate());
     $response = new Response($this->parser->render(ConfigQuery::getPageNotFoundView()), 404);
     $event->setResponse($response);
 }
コード例 #4
0
 /**
  * Render the payment gateway template. The module should provide the gateway URL and the form fields names and values.
  *
  * @param Order  $order       the order
  * @param string $gateway_url the payment gateway URL
  * @param array  $form_data   an associative array of form data, that will be rendered as hiddent fields
  *
  * @return Response the HTTP response.
  */
 public function generateGatewayFormResponse($order, $gateway_url, $form_data)
 {
     /** @var ParserInterface $parser */
     $parser = $this->container->get("thelia.parser");
     $parser->setTemplateDefinition(TemplateHelper::getInstance()->getActiveFrontTemplate());
     $renderedTemplate = $parser->render("order-payment-gateway.html", array("order_id" => $order->getId(), "cart_count" => $this->getRequest()->getSession()->getSessionCart($this->getDispatcher())->getCartItems()->count(), "gateway_url" => $gateway_url, "payment_form_data" => $form_data));
     return Response::create($renderedTemplate);
 }
コード例 #5
0
ファイル: ErrorListener.php プロジェクト: badelas/thelia
 public function defaultErrorFallback(GetResponseForExceptionEvent $event)
 {
     $this->parser->assign("status_code", 500);
     $this->parser->assign("exception_message", $event->getException()->getMessage());
     $this->parser->setTemplateDefinition($this->securityContext->hasAdminUser() ? TemplateHelper::getInstance()->getActiveAdminTemplate() : TemplateHelper::getInstance()->getActiveFrontTemplate());
     $response = new Response($this->parser->render(ConfigQuery::getErrorMessagePageName()), 500);
     $event->setResponse($response);
 }
コード例 #6
0
ファイル: AdminUtilities.php プロジェクト: alex63530/thelia
 protected function fetchSnippet($smarty, $templateName, $variablesArray)
 {
     $data = '';
     $snippet_path = sprintf('%s/%s/%s.html', THELIA_TEMPLATE_DIR, TemplateHelper::getInstance()->getActiveAdminTemplate()->getPath(), $templateName);
     if (false !== ($snippet_content = file_get_contents($snippet_path))) {
         $smarty->assign($variablesArray);
         $data = $smarty->fetch(sprintf('string:%s', $snippet_content));
     }
     return $data;
 }
コード例 #7
0
ファイル: Template.php プロジェクト: badelas/thelia
 public function buildArray()
 {
     $type = $this->getArg('template-type')->getValue();
     if ($type == 'front-office') {
         $templateType = TemplateDefinition::FRONT_OFFICE;
     } elseif ($type == 'back-office') {
         $templateType = TemplateDefinition::BACK_OFFICE;
     } elseif ($type == 'pdf') {
         $templateType = TemplateDefinition::PDF;
     } elseif ($type == 'email') {
         $templateType = TemplateDefinition::EMAIL;
     }
     return TemplateHelper::getInstance()->getList($templateType);
 }
コード例 #8
0
 public function buildArray()
 {
     try {
         /** @var TheliaTemplateHelper $templateHelper */
         $templateHelper = $this->container->get('thelia.template_helper');
     } catch (\Exception $ex) {
         $templateHelper = TemplateHelper::getInstance();
     }
     $frontTemplatePath = $templateHelper->getActiveFrontTemplate()->getAbsolutePath();
     $list = [];
     $finder = Finder::create()->files()->in($frontTemplatePath)->notPath('/bower_components/')->notPath('/node_modules/')->ignoreVCS(true)->ignoreDotFiles(true)->sortByName()->name("*.html");
     foreach ($finder as $file) {
         $list[] = $file;
     }
     return $list;
 }
コード例 #9
0
ファイル: Lang.php プロジェクト: fachriza/thelia
 protected function fixMissingFlag()
 {
     // Be sure that a lang have a flag, otherwise copy the
     // "unknown" flag
     $adminTemplate = TemplateHelper::getInstance()->getActiveAdminTemplate();
     $unknownFlag = ConfigQuery::getUnknownFlagPath();
     $unknownFlagPath = $adminTemplate->getAbsolutePath() . DS . $unknownFlag;
     if (!file_exists($unknownFlagPath)) {
         throw new \RuntimeException(Translator::getInstance()->trans("The image which replaces an undefined country flag (%file) was not found. Please check unknown-flag-path configuration variable, and check that the image exists.", array("%file" => $unknownFlag)));
     }
     // Check if the country flag exists
     $countryFlag = rtrim(dirname($unknownFlagPath), DS) . DS . $this->getCode() . '.png';
     if (!file_exists($countryFlag)) {
         $fs = new Filesystem();
         $fs->copy($unknownFlagPath, $countryFlag);
     }
 }
コード例 #10
0
ファイル: BaseController.php プロジェクト: alex63530/thelia
 protected function generateOrderPdf($order_id, $fileName)
 {
     $order = OrderQuery::create()->findPk($order_id);
     // check if the order has the paid status
     if (!$this->getSecurityContext()->hasAdminUser()) {
         if (!$order->isPaid()) {
             throw new NotFoundHttpException();
         }
     }
     $html = $this->renderRaw($fileName, array('order_id' => $order_id), TemplateHelper::getInstance()->getActivePdfTemplate());
     try {
         $pdfEvent = new PdfEvent($html);
         $this->dispatch(TheliaEvents::GENERATE_PDF, $pdfEvent);
         if ($pdfEvent->hasPdf()) {
             return $this->pdfResponse($pdfEvent->getPdf(), $order->getRef());
         }
     } catch (\Exception $e) {
         \Thelia\Log\Tlog::getInstance()->error(sprintf('error during generating invoice pdf for order id : %d with message "%s"', $order_id, $e->getMessage()));
     }
 }
コード例 #11
0
ファイル: MessageTest.php プロジェクト: badelas/thelia
 protected function tearDown()
 {
     $dir = TemplateHelper::getInstance()->getActiveMailTemplate()->getAbsolutePath();
     ConfigQuery::write('active-mail-template', $this->backup_mail_template);
     $fs = new Filesystem();
     $fs->remove($dir);
 }
コード例 #12
0
 protected function renderTemplate()
 {
     // Get related strings, if all input data are here
     $item_to_translate = $this->getRequest()->get('item_to_translate');
     $item_name = $this->getRequest()->get('item_name', '');
     if ($item_to_translate == 'mo' && !empty($item_name)) {
         $module_part = $this->getRequest()->get('module_part', '');
     } else {
         $module_part = false;
     }
     $all_strings = array();
     $template = $directory = $i18n_directory = false;
     $walkMode = TemplateHelper::WALK_MODE_TEMPLATE;
     $templateArguments = array('item_to_translate' => $item_to_translate, 'item_name' => $item_name, 'module_part' => $module_part, 'view_missing_traductions_only' => $this->getRequest()->get('view_missing_traductions_only'), 'max_input_vars_warning' => false);
     // Find the i18n directory, and the directory to examine.
     if (!empty($item_name) || $item_to_translate == 'co') {
         switch ($item_to_translate) {
             // Module core
             case 'mo':
                 $module = $this->getModule($item_name);
                 if ($module_part == 'core') {
                     $directory = $module->getAbsoluteBaseDir();
                     $domain = $module->getTranslationDomain();
                     $i18n_directory = $module->getAbsoluteI18nPath();
                     $walkMode = TemplateHelper::WALK_MODE_PHP;
                 } elseif ($module_part == 'admin-includes') {
                     $directory = $module->getAbsoluteAdminIncludesPath();
                     $domain = $module->getAdminIncludesTranslationDomain();
                     $i18n_directory = $module->getAbsoluteAdminIncludesI18nPath();
                     $walkMode = TemplateHelper::WALK_MODE_TEMPLATE;
                 } elseif (!empty($module_part)) {
                     // Front, back, pdf or email office template,
                     // form of $module_part is [bo|fo|pdf|email].subdir-name
                     list($type, $subdir) = explode('.', $module_part);
                     switch ($type) {
                         case 'bo':
                             $directory = $module->getAbsoluteBackOfficeTemplatePath($subdir);
                             $domain = $module->getBackOfficeTemplateTranslationDomain($subdir);
                             $i18n_directory = $module->getAbsoluteBackOfficeI18nTemplatePath($subdir);
                             break;
                         case 'fo':
                             $directory = $module->getAbsoluteFrontOfficeTemplatePath($subdir);
                             $domain = $module->getFrontOfficeTemplateTranslationDomain($subdir);
                             $i18n_directory = $module->getAbsoluteFrontOfficeI18nTemplatePath($subdir);
                             break;
                         case 'email':
                             $directory = $module->getAbsoluteEmailTemplatePath($subdir);
                             $domain = $module->getEmailTemplateTranslationDomain($subdir);
                             $i18n_directory = $module->getAbsoluteEmailI18nTemplatePath($subdir);
                             break;
                         case 'pdf':
                             $directory = $module->getAbsolutePdfTemplatePath($subdir);
                             $domain = $module->getPdfTemplateTranslationDomain($subdir);
                             $i18n_directory = $module->getAbsolutePdfI18nTemplatePath($subdir);
                             break;
                         default:
                             throw new \InvalidArgumentException("Undefined module template type: '{$type}'.");
                     }
                     $walkMode = TemplateHelper::WALK_MODE_TEMPLATE;
                 }
                 // Modules translations files are in the cache, and are not always
                 // updated. Force a reload of the files to get last changes.
                 if (!empty($domain)) {
                     $this->loadTranslation($i18n_directory, $domain);
                 }
                 // List front and back office templates defined by this module
                 $templateArguments['back_office_templates'] = implode(',', $this->getModuleTemplateNames($module, TemplateDefinition::BACK_OFFICE));
                 $templateArguments['front_office_templates'] = implode(',', $this->getModuleTemplateNames($module, TemplateDefinition::FRONT_OFFICE));
                 $templateArguments['email_templates'] = implode(',', $this->getModuleTemplateNames($module, TemplateDefinition::EMAIL));
                 $templateArguments['pdf_templates'] = implode(',', $this->getModuleTemplateNames($module, TemplateDefinition::PDF));
                 // Check if we have admin-include files
                 try {
                     $finder = Finder::create()->files()->depth(0)->in($module->getAbsoluteAdminIncludesPath())->name('/\\.html$/i');
                     $hasAdminIncludes = $finder->count() > 0;
                 } catch (\InvalidArgumentException $ex) {
                     $hasAdminIncludes = false;
                 }
                 $templateArguments['has_admin_includes'] = $hasAdminIncludes;
                 break;
                 // Thelia Core
             // Thelia Core
             case 'co':
                 $directory = THELIA_LIB;
                 $domain = 'core';
                 $i18n_directory = THELIA_LIB . 'Config' . DS . 'I18n';
                 $walkMode = TemplateHelper::WALK_MODE_PHP;
                 break;
                 // Front-office template
             // Front-office template
             case 'fo':
                 $template = new TemplateDefinition($item_name, TemplateDefinition::FRONT_OFFICE);
                 break;
                 // Back-office template
             // Back-office template
             case 'bo':
                 $template = new TemplateDefinition($item_name, TemplateDefinition::BACK_OFFICE);
                 break;
                 // PDF templates
             // PDF templates
             case 'pf':
                 $template = new TemplateDefinition($item_name, TemplateDefinition::PDF);
                 break;
                 // Email templates
             // Email templates
             case 'ma':
                 $template = new TemplateDefinition($item_name, TemplateDefinition::EMAIL);
                 break;
         }
         if ($template) {
             $directory = $template->getAbsolutePath();
             $i18n_directory = $template->getAbsoluteI18nPath();
             $domain = $template->getTranslationDomain();
             // Load translations files is this template is not the current template
             // as it is not loaded in Thelia.php
             if (!TemplateHelper::getInstance()->isActive($template)) {
                 $this->loadTranslation($i18n_directory, $domain);
             }
         }
         // Load strings to translate
         if ($directory && !empty($domain)) {
             // Save the string set, if the form was submitted
             if ($i18n_directory) {
                 $save_mode = $this->getRequest()->get('save_mode', false);
                 if ($save_mode !== false) {
                     $texts = $this->getRequest()->get('text', array());
                     if (!empty($texts)) {
                         $file = sprintf("%s" . DS . "%s.php", $i18n_directory, $this->getCurrentEditionLocale());
                         $translations = $this->getRequest()->get('translation', array());
                         TemplateHelper::getInstance()->writeTranslation($file, $texts, $translations, true);
                         if ($save_mode == 'stay') {
                             return $this->generateRedirectFromRoute("admin.configuration.translations", $templateArguments);
                         } else {
                             return $this->generateRedirect(URL::getInstance()->adminViewUrl('configuration'));
                         }
                     }
                 }
             }
             // Load strings
             $stringsCount = TemplateHelper::getInstance()->walkDir($directory, $walkMode, $this->getTranslator(), $this->getCurrentEditionLocale(), $domain, $all_strings);
             // Estimate number of fields, and compare to php ini max_input_vars
             $stringsCount = $stringsCount * 2 + 6;
             if ($stringsCount > ini_get('max_input_vars')) {
                 $templateArguments['max_input_vars_warning'] = true;
                 $templateArguments['required_max_input_vars'] = $stringsCount;
                 $templateArguments['current_max_input_vars'] = ini_get('max_input_vars');
             } else {
                 $templateArguments['all_strings'] = $all_strings;
             }
         }
     }
     return $this->render('translations', $templateArguments);
 }
コード例 #13
0
ファイル: Message.php プロジェクト: badelas/thelia
 /**
  * Add a subject and a body (TEXT, HTML or both, depending on the message
  * configuration.
  */
 public function buildMessage($parser, \Swift_Message $messageInstance)
 {
     $parser->setTemplateDefinition(TemplateHelper::getInstance()->getActiveMailTemplate());
     $subject = $parser->fetch(sprintf("string:%s", $this->getSubject()));
     $htmlMessage = $this->getHtmlMessageBody($parser);
     $textMessage = $this->getTextMessageBody($parser);
     $messageInstance->setSubject($subject);
     // If we do not have an HTML message
     if (empty($htmlMessage)) {
         // Message body is the text message
         $messageInstance->setBody($textMessage, 'text/plain');
     } else {
         // The main body is the HTML messahe
         $messageInstance->setBody($htmlMessage, 'text/html');
         // Use the text as a message part, if we have one.
         if (!empty($textMessage)) {
             $messageInstance->addPart($textMessage, 'text/plain');
         }
     }
     return $messageInstance;
 }
コード例 #14
0
 /**
  * Internal and reusable method to retrieve HTML code
  * @param string $shortcode The shortcode
  * @param int $width Width for images
  * @param int $height Height for images
  * @return string The HTML code
  */
 protected function getShortcodeHTML($shortcode, $width, $height)
 {
     $this->parser->setTemplateDefinition(TemplateHelper::getInstance()->getActiveAdminTemplate());
     return $this->parser->render('diaporama-html.html', array('shortcode' => $shortcode, 'width' => $width, 'height' => $height));
 }
コード例 #15
0
 protected function listDirectoryContent($requiredExtension)
 {
     $list = array();
     $dir = TemplateHelper::getInstance()->getActiveMailTemplate()->getAbsolutePath();
     $finder = Finder::create()->files()->in($dir)->ignoreDotFiles(true)->sortByName()->name("*.{$requiredExtension}");
     foreach ($finder as $file) {
         $list[] = $file->getBasename();
     }
     return $list;
 }
コード例 #16
0
ファイル: MessageController.php プロジェクト: badelas/thelia
 public function previewAction($messageId, $html = true)
 {
     if (null !== ($response = $this->checkAuth(AdminResources::MESSAGE, [], AccessManager::VIEW))) {
         return $response;
     }
     if (null === ($message = MessageQuery::create()->findPk($messageId))) {
         $this->pageNotFound();
     }
     $parser = $this->getParser(TemplateHelper::getInstance()->getActiveMailTemplate());
     foreach ($this->getRequest()->query->all() as $key => $value) {
         $parser->assign($key, $value);
     }
     if ($html) {
         $content = $message->setLocale($this->getCurrentEditionLocale())->getHtmlMessageBody($parser);
     } else {
         $content = $message->setLocale($this->getCurrentEditionLocale())->getTextMessageBody($parser);
     }
     return new Response($content);
 }
コード例 #17
0
ファイル: BaseFacade.php プロジェクト: alex63530/thelia
 /**
  * Return platform Parser
  *
  * @return ParserInterface
  */
 public function getParser()
 {
     if ($this->parser == null) {
         $this->parser = $this->container->get('thelia.parser');
         // Define the current back-office template that should be used
         $this->parser->setTemplateDefinition(TemplateHelper::getInstance()->getActiveAdminTemplate());
     }
     return $this->parser;
 }
コード例 #18
0
ファイル: Thelia.php プロジェクト: badelas/thelia
 private function loadModuleTranslationDirectories(Module $module, array &$translationDirs)
 {
     // Core module translation
     if (is_dir($dir = $module->getAbsoluteI18nPath())) {
         $translationDirs[$module->getTranslationDomain()] = $dir;
     }
     // Admin includes translation
     if (is_dir($dir = $module->getAbsoluteAdminIncludesI18nPath())) {
         $translationDirs[$module->getAdminIncludesTranslationDomain()] = $dir;
     }
     // Module back-office template, if any
     $templates = TemplateHelper::getInstance()->getList(TemplateDefinition::BACK_OFFICE, $module->getAbsoluteTemplateBasePath());
     foreach ($templates as $template) {
         $translationDirs[$module->getBackOfficeTemplateTranslationDomain($template->getName())] = $module->getAbsoluteBackOfficeI18nTemplatePath($template->getName());
     }
     // Module front-office template, if any
     $templates = TemplateHelper::getInstance()->getList(TemplateDefinition::FRONT_OFFICE, $module->getAbsoluteTemplateBasePath());
     foreach ($templates as $template) {
         $translationDirs[$module->getFrontOfficeTemplateTranslationDomain($template->getName())] = $module->getAbsoluteFrontOfficeI18nTemplatePath($template->getName());
     }
     // Module pdf template, if any
     $templates = TemplateHelper::getInstance()->getList(TemplateDefinition::PDF, $module->getAbsoluteTemplateBasePath());
     foreach ($templates as $template) {
         $translationDirs[$module->getPdfTemplateTranslationDomain($template->getName())] = $module->getAbsolutePdfI18nTemplatePath($template->getName());
     }
     // Module email template, if any
     $templates = TemplateHelper::getInstance()->getList(TemplateDefinition::EMAIL, $module->getAbsoluteTemplateBasePath());
     foreach ($templates as $template) {
         $translationDirs[$module->getEmailTemplateTranslationDomain($template->getName())] = $module->getAbsoluteEmailI18nTemplatePath($template->getName());
     }
 }
コード例 #19
0
 public function __construct()
 {
     // Initialize the deprecated TemplateHelper class to ensure backward compatibility
     TemplateHelper::init($this);
 }
コード例 #20
0
ファイル: Thelia.php プロジェクト: alex63530/thelia
 /**
  *
  * Load some configuration
  * Initialize all plugins
  *
  */
 protected function loadConfiguration(ContainerBuilder $container)
 {
     $loader = new XmlFileLoader($container, new FileLocator(THELIA_ROOT . "/core/lib/Thelia/Config/Resources"));
     $finder = Finder::create()->name('*.xml')->depth(0)->in(THELIA_ROOT . "/core/lib/Thelia/Config/Resources");
     /** @var \SplFileInfo $file */
     foreach ($finder as $file) {
         $loader->load($file->getBaseName());
     }
     if (defined("THELIA_INSTALL_MODE") === false) {
         $modules = ModuleQuery::getActivated();
         $translationDirs = array();
         /** @var ParserInterface $parser */
         $parser = $container->getDefinition('thelia.parser');
         /** @var Module $module */
         foreach ($modules as $module) {
             try {
                 $definition = new Definition();
                 $definition->setClass($module->getFullNamespace());
                 $definition->addMethodCall("setContainer", array(new Reference('service_container')));
                 $container->setDefinition("module." . $module->getCode(), $definition);
                 $compilers = call_user_func(array($module->getFullNamespace(), 'getCompilers'));
                 foreach ($compilers as $compiler) {
                     if (is_array($compiler)) {
                         $container->addCompilerPass($compiler[0], $compiler[1]);
                     } else {
                         $container->addCompilerPass($compiler);
                     }
                 }
                 $loader = new XmlFileLoader($container, new FileLocator($module->getAbsoluteConfigPath()));
                 $loader->load("config.xml", "module." . $module->getCode());
                 // Core module translation
                 if (is_dir($dir = $module->getAbsoluteI18nPath())) {
                     $translationDirs[$module->getTranslationDomain()] = $dir;
                 }
                 // Admin includes translation
                 if (is_dir($dir = $module->getAbsoluteAdminIncludesI18nPath())) {
                     $translationDirs[$module->getAdminIncludesTranslationDomain()] = $dir;
                 }
                 // Module back-office template, if any
                 $templates = TemplateHelper::getInstance()->getList(TemplateDefinition::BACK_OFFICE, $module->getAbsoluteTemplateBasePath());
                 foreach ($templates as $template) {
                     $translationDirs[$module->getBackOfficeTemplateTranslationDomain($template->getName())] = $module->getAbsoluteBackOfficeI18nTemplatePath($template->getName());
                 }
                 // Module front-office template, if any
                 $templates = TemplateHelper::getInstance()->getList(TemplateDefinition::FRONT_OFFICE, $module->getAbsoluteTemplateBasePath());
                 foreach ($templates as $template) {
                     $translationDirs[$module->getFrontOfficeTemplateTranslationDomain($template->getName())] = $module->getAbsoluteFrontOfficeI18nTemplatePath($template->getName());
                 }
                 $this->addStandardModuleTemplatesToParserEnvironment($parser, $module);
             } catch (\InvalidArgumentException $e) {
                 Tlog::getInstance()->addError(sprintf("Failed to load module %s: %s", $module->getCode(), $e->getMessage()), $e);
                 throw $e;
             }
         }
         // Load core translation
         $translationDirs['core'] = THELIA_ROOT . 'core' . DS . 'lib' . DS . 'Thelia' . DS . 'Config' . DS . 'I18n';
         // Standard templates (front, back, pdf, mail)
         $th = TemplateHelper::getInstance();
         /** @var TemplateDefinition $templateDefinition */
         foreach ($th->getStandardTemplateDefinitions() as $templateDefinition) {
             if (is_dir($dir = $templateDefinition->getAbsoluteI18nPath())) {
                 $translationDirs[$templateDefinition->getTranslationDomain()] = $dir;
             }
         }
         if ($translationDirs) {
             $this->loadTranslation($container, $translationDirs);
         }
     }
 }