8000 [FrameworkBundle] Fixed Translation loader and update translation com… · symfony/symfony@2ca438d · GitHub
[go: up one dir, main page]

Skip to content
< 8000 script crossorigin="anonymous" type="application/javascript" src="https://github.githubassets.com/assets/sessions-eed3aa0554dd.js" defer="defer">

Commit 2ca438d

Browse files
committed
[FrameworkBundle] Fixed Translation loader and update translation command.
1 parent 1532b4e commit 2ca438d

File tree

3 files changed

+15
-0
lines changed

3 files changed

+15
-0
lines changed

src/Symfony/Bundle/FrameworkBundle/Command/TranslationUpdateCommand.php

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,13 @@ protected function execute(InputInterface $input, OutputInterface $output)
116116
? new DiffOperation($currentCatalogue, $extractedCatalogue)
117117
: new MergeOperation($currentCatalogue, $extractedCatalogue);
118118

119+
// Exit if no messages found.
120+
if (!count($operation->getDomains())) {
121+
$output->writeln("\n<comment>No translation found.</comment>");
122+
123+
return;
124+
}
125+
119126
// show compiled list of messages
120127
if ($input->getOption('dump-messages') === true) {
121128
foreach ($operation->getDomains() as $domain) {

src/Symfony/Bundle/FrameworkBundle/Translation/TranslationLoader.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,10 @@ public function addLoader($format, LoaderInterface $loader)
4747
*/
4848
public function loadMessages($directory, MessageCatalogue $catalogue)
4949
{
50+
if (!is_dir($directory)) {
51+
return;
52+
}
53+
5054
foreach ($this->loaders as $format => $loader) {
5155
// load any existing translation files
5256
$finder = new Finder();

src/Symfony/Component/Translation/Writer/TranslationWriter.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,10 @@ public function writeTranslations(MessageCatalogue $catalogue, $format, $options
6767
// get the right dumper
6868
$dumper = $this->dumpers[$format];
6969

70+
if (isset($options['path']) && !is_dir($options['path'])) {
71+
mkdir($options['path'], 0777, true);
72+
}
73+
7074
// save
7175
$dumper->dump($catalogue, $options);
7276
}

0 commit comments

Comments
 (0)
0