Skip to content

Commit

Permalink
just download and put new messages
Browse files Browse the repository at this point in the history
  • Loading branch information
nediam committed Sep 24, 2015
1 parent 0108efb commit 662d548
Showing 1 changed file with 2 additions and 10 deletions.
12 changes: 2 additions & 10 deletions Service/PhraseApp.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
use Symfony\Bundle\FrameworkBundle\Translation\TranslationLoader;
use Symfony\Component\Finder\Finder;
use Symfony\Component\Finder\SplFileInfo;
use Symfony\Component\Translation\Catalogue\DiffOperation;
use Symfony\Component\Translation\MessageCatalogue;
use Symfony\Component\Translation\Writer\TranslationWriter;

Expand Down Expand Up @@ -176,22 +175,15 @@ protected function dumpMessages($targetLocale)
$extractedCatalogue = new MessageCatalogue($targetLocale);
$this->translationLoader->loadMessages($this->getTmpPath(), $extractedCatalogue);

// load any existing messages from the translation files
$this->logger->notice('Loading existing catalogues from "{translationsPath}"', ['translationsPath' => $this->translationsPath]);
$currentCatalogue = new MessageCatalogue($targetLocale);
$this->translationLoader->loadMessages($this->translationsPath, $currentCatalogue);

$operation = new DiffOperation($extractedCatalogue, $currentCatalogue);

// Exit if no messages found.
if (0 === count($operation->getDomains())) {
if (0 === count($extractedCatalogue->getDomains())) {
$this->logger->warning('No translation found for locale {locale}', ['locale' => $targetLocale]);

return;
}

$this->logger->notice('Writing translation file for locale "{locale}".', ['locale' => $targetLocale]);
$this->translationWriter->writeTranslations($operation->getResult(), $this->outputFormat, ['path' => $this->translationsPath]);
$this->translationWriter->writeTranslations($extractedCatalogue, $this->outputFormat, ['path' => $this->translationsPath]);
}

/**
Expand Down

0 comments on commit 662d548

Please sign in to comment.