[FrameworkBundle] Fixed Translation loader and update translation command.
This commit is contained in:
parent
1532b4e681
commit
2ca438deb6
@ -116,6 +116,13 @@ EOF
|
|||||||
? new DiffOperation($currentCatalogue, $extractedCatalogue)
|
? new DiffOperation($currentCatalogue, $extractedCatalogue)
|
||||||
: new MergeOperation($currentCatalogue, $extractedCatalogue);
|
: new MergeOperation($currentCatalogue, $extractedCatalogue);
|
||||||
|
|
||||||
|
// Exit if no messages found.
|
||||||
|
if (!count($operation->getDomains())) {
|
||||||
|
$output->writeln("\n<comment>No translation found.</comment>");
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
// show compiled list of messages
|
// show compiled list of messages
|
||||||
if ($input->getOption('dump-messages') === true) {
|
if ($input->getOption('dump-messages') === true) {
|
||||||
foreach ($operation->getDomains() as $domain) {
|
foreach ($operation->getDomains() as $domain) {
|
||||||
|
@ -47,6 +47,10 @@ class TranslationLoader
|
|||||||
*/
|
*/
|
||||||
public function loadMessages($directory, MessageCatalogue $catalogue)
|
public function loadMessages($directory, MessageCatalogue $catalogue)
|
||||||
{
|
{
|
||||||
|
if (!is_dir($directory)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
foreach ($this->loaders as $format => $loader) {
|
foreach ($this->loaders as $format => $loader) {
|
||||||
// load any existing translation files
|
// load any existing translation files
|
||||||
$finder = new Finder();
|
$finder = new Finder();
|
||||||
|
@ -67,6 +67,10 @@ class TranslationWriter
|
|||||||
// get the right dumper
|
// get the right dumper
|
||||||
$dumper = $this->dumpers[$format];
|
$dumper = $this->dumpers[$format];
|
||||||
|
|
||||||
|
if (isset($options['path']) && !is_dir($options['path'])) {
|
||||||
|
mkdir($options['path'], 0777, true);
|
||||||
|
}
|
||||||
|
|
||||||
// save
|
// save
|
||||||
$dumper->dump($catalogue, $options);
|
$dumper->dump($catalogue, $options);
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user