/**
  * exposeTranslationAction action.
  */
 public function exposeTranslationAction($domain_name, $_locale, $_format)
 {
     $files = $this->translationFinder->getResources($domain_name, $_locale);
     $catalogues = array();
     foreach ($files as $file) {
         $extension = pathinfo($file->getFilename(), \PATHINFO_EXTENSION);
         if (isset($this->loaders[$extension])) {
             $catalogues[] = $this->loaders[$extension]->load($file, $_locale, $domain_name);
         }
     }
     $messages = array();
     foreach ($catalogues as $catalogue) {
         $messages = array_merge_recursive($messages, $catalogue->all());
     }
     return new Response($this->engine->render('BazingaExposeTranslationBundle::exposeTranslation.' . $_format . '.twig', array('messages' => $messages, 'locale' => $_locale, 'defaultDomains' => $this->defaultDomains)));
 }
 /**
  * exposeTranslationAction action.
  */
 public function exposeTranslationAction(Request $request, $domain_name, $_locale, $_format)
 {
     $cache = new ConfigCache($this->cacheDir . '/' . $domain_name . '.' . $_locale . "." . $_format, $this->debug);
     if (!$cache->isFresh()) {
         $files = $this->translationFinder->getResources($domain_name, $_locale);
         $resources = array();
         $catalogues = array();
         foreach (iterator_to_array($files) as $file) {
             $extension = pathinfo($file->getFilename(), \PATHINFO_EXTENSION);
             if (isset($this->loaders[$extension])) {
                 $resources[] = new FileResource($file->getPath());
                 $catalogues[] = $this->loaders[$extension]->load($file, $_locale, $domain_name);
             }
         }
         $messages = array();
         foreach ($catalogues as $catalogue) {
             $messages = array_merge_recursive($messages, $catalogue->all());
         }
         $content = $this->engine->render('BazingaExposeTranslationBundle::exposeTranslation.' . $_format . '.twig', array('messages' => $messages, 'locale' => $_locale, 'defaultDomains' => $this->defaultDomains));
         $cache->write($content, $resources);
     }
     $content = file_get_contents((string) $cache);
     return new Response($content, 200, array('Content-Type' => $request->getMimeType($_format)));
 }