/**
  * @throws TranslationsNotFoundException
  */
 public function assertAllTranslationsFound()
 {
     $missings = array();
     foreach ($this->dataCollectorTranslator->getCollectedMessages() as $message) {
         if ($message['state'] === DataCollectorTranslator::MESSAGE_MISSING) {
             $missings[] = $message;
         } elseif ($message['state'] === DataCollectorTranslator::MESSAGE_EQUALS_FALLBACK && $this->allowFallbacks === false) {
             $message['locale'] = 'fallback ' . $message['locale'] . ' found ';
             $message['locale'] .= 'but not allowed by config dev.translation.allow_fallbacks)';
             $missings[] = $message;
         }
     }
     if (count($missings) > 0) {
         throw new TranslationsNotFoundException($missings);
     }
 }
Beispiel #2
0
 public function onTerminate(Event $event)
 {
     if ($this->translator === null) {
         return;
     }
     $messages = $this->translator->getCollectedMessages();
     $created = array();
     foreach ($messages as $message) {
         if ($message['state'] === DataCollectorTranslator::MESSAGE_MISSING) {
             $m = new Message($message);
             $this->transService->createAsset($m);
             $created[] = $m;
         }
     }
     if (count($created) > 0) {
         // update filesystem
         $this->fileSystemUpdater->updateMessageCatalog($created);
     }
 }
 /**
  * {@inheritdoc}
  */
 public function lateCollect()
 {
     $messages = $this->sanitizeCollectedMessages($this->translator->getCollectedMessages());
     $this->data = $this->computeCount($messages);
     $this->data['messages'] = $messages;
 }