-
Notifications
You must be signed in to change notification settings - Fork 37
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
php bin/console fop:translations:import ISO_CODE
- Loading branch information
1 parent
5da0635
commit 4dbbed3
Showing
2 changed files
with
80 additions
and
33 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
<?php | ||
Check failure on line 1 in src/Commands/Translations/ImportLanguage.php
|
||
|
||
namespace FOP\Console\Commands\Translations; | ||
|
||
use FOP\Console\Command; | ||
use Symfony\Component\Console\Input\InputOption; | ||
use Symfony\Component\Console\Input\InputInterface; | ||
use Symfony\Component\Console\Output\OutputInterface; | ||
|
||
final class ImportLanguage extends Command | ||
{ | ||
/** | ||
* {@inheritdoc} | ||
*/ | ||
protected function configure() | ||
{ | ||
$this | ||
->setName('fop:translations') | ||
->setName('fop:translations:import') | ||
->setDescription('Import a translation by iso code') | ||
->setHelp('This command will import or update a translation package') | ||
->addUsage('./bin/console op:translations:import fr ( import fr translation package )') | ||
->addArgument( | ||
'iso', | ||
InputOption::VALUE_REQUIRED, | ||
'iso of language to import ex: fr', | ||
); | ||
} | ||
|
||
/** | ||
* {@inheritdoc} | ||
*/ | ||
protected function execute(InputInterface $input, OutputInterface $output) | ||
{ | ||
$iso = $input->getArgument('iso'); | ||
$languagePackImporter = $this->getContainer()->get('prestashop.adapter.language.pack.importer'); | ||
$errors = $languagePackImporter->import($iso); | ||
if (empty($errors)) { | ||
$this->io->text('lang '.$iso.' added !'); | ||
} | ||
|
||
return 0; // return 0 on success or 1 on failure. | ||
} | ||
} |