/**
  * Combines JSON with js translation and renders js-resource
  *
  * @param array $domains
  * @param string $locale
  * @param bool $debug
  * @return string
  */
 public function renderJsTranslationContent(array $domains, $locale, $debug = false)
 {
     $domainsTranslations = $this->translator->getTranslations($domains, $locale);
     $result = ['locale' => $locale, 'defaultDomains' => $domains, 'messages' => []];
     if ($debug) {
         $result['debug'] = true;
     }
     foreach ($domainsTranslations as $domain => $translations) {
         $result['messages'] += array_combine(array_map(function ($id) use($domain) {
             return sprintf('%s:%s', $domain, $id);
         }, array_keys($translations)), array_values($translations));
     }
     return $this->templating->render($this->template, ['json' => $result]);
 }