| @@ 24-42 (lines=19) @@ | ||
| 21 | /** |
|
| 22 | * @author Tobias Nyholm <[email protected]> |
|
| 23 | */ |
|
| 24 | class DownloadCommand extends ContainerAwareCommand |
|
| 25 | { |
|
| 26 | protected function configure() |
|
| 27 | { |
|
| 28 | $this |
|
| 29 | ->setName('translation:download') |
|
| 30 | ->setDescription('Replace local messages with messages from remote') |
|
| 31 | ->addArgument('configuration', InputArgument::OPTIONAL, 'The configuration to use', 'default'); |
|
| 32 | } |
|
| 33 | ||
| 34 | protected function execute(InputInterface $input, OutputInterface $output) |
|
| 35 | { |
|
| 36 | $container = $this->getContainer(); |
|
| 37 | $configName = $input->getArgument('configuration'); |
|
| 38 | /** @var StorageService $storage */ |
|
| 39 | $storage = $container->get('php_translation.storage.'.$configName); |
|
| 40 | $storage->download(); |
|
| 41 | } |
|
| 42 | } |
|
| 43 | ||
| @@ 24-42 (lines=19) @@ | ||
| 21 | /** |
|
| 22 | * @author Tobias Nyholm <[email protected]> |
|
| 23 | */ |
|
| 24 | class SyncCommand extends ContainerAwareCommand |
|
| 25 | { |
|
| 26 | protected function configure() |
|
| 27 | { |
|
| 28 | $this |
|
| 29 | ->setName('translation:sync') |
|
| 30 | ->setDescription('Sync the translations with the remote storage') |
|
| 31 | ->addArgument('configuration', InputArgument::OPTIONAL, 'The configuration to use', 'default'); |
|
| 32 | } |
|
| 33 | ||
| 34 | protected function execute(InputInterface $input, OutputInterface $output) |
|
| 35 | { |
|
| 36 | $container = $this->getContainer(); |
|
| 37 | $configName = $input->getArgument('configuration'); |
|
| 38 | /** @var StorageService $storage */ |
|
| 39 | $storage = $container->get('php_translation.storage.'.$configName); |
|
| 40 | $storage->sync(); |
|
| 41 | } |
|
| 42 | } |
|
| 43 | ||