Skip to content

Commit d4676d3

Browse files
author
Martynas Sudintas
committed
Merge pull request #38 from martiis/patch-1
Patch 1
2 parents b959271 + 7259b13 commit d4676d3

File tree

6 files changed

+20
-17
lines changed

6 files changed

+20
-17
lines changed

Command/ExportCommand.php

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -55,17 +55,22 @@ protected function execute(InputInterface $input, OutputInterface $output)
5555
$locales = $input->getOption('locales');
5656
if (!empty($locales)) {
5757
$export->setManagedLocales($locales);
58-
$locales = implode('</comment><info>, </info><comment>', $locales);
59-
} else {
60-
$locales = 'all';
6158
}
6259

63-
$export->export($input->getOption('domains'));
60+
$domains = $input->getOption('domains');
61+
$export->export($domains);
62+
63+
$prettify = function ($array) {
64+
return !empty($array) ? implode('</comment><info>`, `</info><comment>', $array) : 'all';
65+
};
6466

6567
$output->writeln(
6668
sprintf(
67-
'<info>Successfully exported translations for </info><comment>`%s`</comment><info> locales.</info>',
68-
$locales
69+
'<info>Successfully exported translations in `</info>'
70+
. '<comment>%s</comment><info>` locale(s) for `</info>'
71+
. '<comment>%s</comment><info>` domain(s).</info>',
72+
$prettify($locales),
73+
$prettify($domains)
6974
)
7075
);
7176
}

Controller/ListController.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313

1414
use ONGR\ElasticsearchBundle\DSL\Aggregation\TermsAggregation;
1515
use ONGR\ElasticsearchBundle\ORM\Repository;
16-
use ONGR\FilterManagerBundle\Filters\FilterInterface;
16+
use ONGR\FilterManagerBundle\Filters\ViewData;
1717
use ONGR\FilterManagerBundle\Search\SearchResponse;
1818
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
1919
use Symfony\Component\HttpFoundation\Request;
@@ -64,7 +64,7 @@ public function listAction(Request $request)
6464
/**
6565
* Creates locales list.
6666
*
67-
* @param FilterInterface $filter
67+
* @param ViewData\ChoicesAwareViewData $filter
6868
*
6969
* @return array
7070
*/
@@ -85,7 +85,7 @@ private function buildLocalesList($filter)
8585

8686
$activeLocales = [];
8787

88-
if ($filter->getState(null)->isActive()) {
88+
if ($filter->getState()->isActive()) {
8989
foreach ($filter->getChoices() as $choice) {
9090
$activeLocales[$choice->getLabel()] = $choice->isActive();
9191
}

DependencyInjection/ONGRTranslationsExtension.php

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -133,9 +133,7 @@ private function setControllerManager($repositoryId, $controllerName, ContainerB
133133
private function validateBundles($container, $bundles)
134134
{
135135
foreach ($bundles as $bundle) {
136-
try {
137-
$reflection = new \ReflectionClass($bundle);
138-
} catch (\ReflectionException $e) {
136+
if (!class_exists($bundle)) {
139137
throw new InvalidConfigurationException(
140138
"Invalid bundle namespace {$bundle}. Error: {$e->getMessage()}"
141139
);

Document/Translation.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,14 +29,14 @@ class Translation extends AbstractDocument implements \JsonSerializable
2929
private $domain;
3030

3131
/**
32-
* @var string
32+
* @var Tag[]
3333
*
3434
* @ES\Property(name="tags", type="object", multiple=true, objectName="ONGRTranslationsBundle:Tag")
3535
*/
36-
private $tags;
36+
private $tags = [];
3737

3838
/**
39-
* @var Message
39+
* @var Message[]
4040
*
4141
* @ES\Property(name="messages", type="object", multiple=true, objectName="ONGRTranslationsBundle:Message")
4242
*/

Resources/public/js/directive/InlineDirective.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ angular
2828
/**
2929
* @type {string}
3030
*/
31-
scope.value = scope.message.message ? scope.message.message : null;
31+
scope.value = scope.message ? scope.message.message : null;
3232

3333
/**
3434
* @type {int}

Storage/StorageInterface.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ interface StorageInterface
2222
* @param array $locales
2323
* @param array $domains
2424
*
25-
* @return array
25+
* @return array|\Traversable
2626
*/
2727
public function read($locales, $domains);
2828

0 commit comments

Comments
 (0)