|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
/* |
|
4
|
|
|
* This file is part of the ONGR package. |
|
5
|
|
|
* |
|
6
|
|
|
* (c) NFQ Technologies UAB <[email protected]> |
|
7
|
|
|
* |
|
8
|
|
|
* For the full copyright and license information, please view the LICENSE |
|
9
|
|
|
* file that was distributed with this source code. |
|
10
|
|
|
*/ |
|
11
|
|
|
|
|
12
|
|
|
namespace ONGR\TranslationsBundle\Command; |
|
13
|
|
|
|
|
14
|
|
|
use ONGR\TranslationsBundle\Service\Export\ExportManager; |
|
15
|
|
|
use Symfony\Bundle\FrameworkBundle\Command\ContainerAwareCommand; |
|
16
|
|
|
use Symfony\Component\Console\Input\InputInterface; |
|
17
|
|
|
use Symfony\Component\Console\Input\InputOption; |
|
18
|
|
|
use Symfony\Component\Console\Output\OutputInterface; |
|
19
|
|
|
|
|
20
|
|
|
/** |
|
21
|
|
|
* Exports translations. |
|
22
|
|
|
*/ |
|
23
|
|
|
class ExportCommand extends ContainerAwareCommand |
|
24
|
|
|
{ |
|
25
|
|
|
/** |
|
26
|
|
|
* {@inheritdoc} |
|
27
|
|
|
*/ |
|
28
|
4 |
|
protected function configure() |
|
29
|
|
|
{ |
|
30
|
4 |
|
$this->setName('ongr:translations:export'); |
|
31
|
4 |
|
$this->setDescription('Export all translations from ES to yaml.'); |
|
32
|
4 |
|
$this->addOption( |
|
33
|
4 |
|
'locales', |
|
34
|
4 |
|
'l', |
|
35
|
4 |
|
InputOption::VALUE_REQUIRED | InputOption::VALUE_IS_ARRAY, |
|
36
|
4 |
|
'Export only these locales, instead of using the managed locales.' |
|
37
|
|
|
); |
|
38
|
4 |
|
$this->addOption( |
|
39
|
4 |
|
'force', |
|
40
|
4 |
|
'f', |
|
41
|
4 |
|
InputOption::VALUE_NONE, |
|
42
|
4 |
|
'If set, the bundle will export all translations, regardless of status' |
|
43
|
4 |
|
); |
|
44
|
|
|
} |
|
45
|
4 |
|
|
|
46
|
|
|
/** |
|
47
|
|
|
* {@inheritdoc} |
|
48
|
|
|
*/ |
|
49
|
|
|
protected function execute(InputInterface $input, OutputInterface $output) |
|
50
|
4 |
|
{ |
|
51
|
|
|
/** @var ExportManager $export */ |
|
52
|
|
|
$export = $this->getContainer()->get('ongr_translations.export'); |
|
53
|
4 |
|
|
|
54
|
|
|
$locales = $input->getOption('locales'); |
|
55
|
4 |
|
if (!empty($locales)) { |
|
56
|
4 |
|
$export->setManagedLocales($locales); |
|
|
|
|
|
|
57
|
1 |
|
} |
|
58
|
|
|
|
|
59
|
|
|
$domains = $input->getOption('domains'); |
|
60
|
4 |
|
$export->export($domains, $input->getOption('force')); |
|
61
|
4 |
|
|
|
62
|
|
|
$prettify = function ($array) { |
|
63
|
|
|
return !empty($array) ? implode('</comment><info>`, `</info><comment>', $array) : 'all'; |
|
64
|
|
|
}; |
|
65
|
|
|
|
|
66
|
|
|
$output->writeln( |
|
67
|
|
|
sprintf( |
|
68
|
|
|
'<info>Successfully exported translations in `</info>' |
|
69
|
|
|
. '<comment>%s</comment><info>` locale(s) for `</info>' |
|
70
|
|
|
. '<comment>%s</comment><info>` domain(s).</info>', |
|
71
|
|
|
$prettify($locales), |
|
72
|
|
|
$prettify($domains) |
|
73
|
|
|
) |
|
74
|
|
|
); |
|
75
|
|
|
} |
|
76
|
|
|
} |
|
77
|
|
|
|
This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.
This is most likely a typographical error or the method has been renamed.