Skip to content

Commit

Permalink
Fix the translation commands when a template contains a syntax error
Browse files Browse the repository at this point in the history
  • Loading branch information
fabpot committed Nov 29, 2019
1 parent fa783f9 commit f63e843
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 4 deletions.
Expand Up @@ -204,7 +204,7 @@ protected function execute(InputInterface $input, OutputInterface $output)
}

// Extract used messages
$extractedCatalogue = $this->extractMessages($locale, $viewsPaths);
$extractedCatalogue = $this->extractMessages($io->getErrorStyle(), $locale, $viewsPaths);

// Load defined messages
$currentCatalogue = $this->loadCurrentMessages($locale, $transPaths);
Expand Down Expand Up @@ -330,12 +330,16 @@ private function sanitizeString($string, $length = 40)
*
* @return MessageCatalogue
*/
private function extractMessages($locale, $transPaths)
private function extractMessages(SymfonyStyle $errorIo, $locale, $transPaths)
{
$extractedCatalogue = new MessageCatalogue($locale);
foreach ($transPaths as $path) {
if (is_dir($path)) {
$this->extractor->extract($path, $extractedCatalogue);
try {
$this->extractor->extract($path, $extractedCatalogue);
} catch (\Exception $e) {
$errorIo->warning($e->getMessage());
}
}
}

Expand Down
Expand Up @@ -215,7 +215,11 @@ protected function execute(InputInterface $input, OutputInterface $output)
$this->extractor->setPrefix($prefix);
foreach ($viewsPaths as $path) {
if (is_dir($path)) {
$this->extractor->extract($path, $extractedCatalogue);
try {
$this->extractor->extract($path, $extractedCatalogue);
} catch (\Exception $e) {
$errorIo->warning($e->getMessage());
}
}
}

Expand Down

0 comments on commit f63e843

Please sign in to comment.