5 * Contains \Drupal\Console\Command\MigrateDebugCommand.
8 namespace Drupal\Console\Command\Locale;
10 use Symfony\Component\Console\Input\InputArgument;
11 use Symfony\Component\Console\Input\InputInterface;
12 use Symfony\Component\Console\Output\OutputInterface;
13 use Symfony\Component\Console\Command\Command;
14 use Drupal\Console\Core\Style\DrupalStyle;
15 use Drupal\Console\Command\Shared\LocaleTrait;
16 use Drupal\Console\Core\Command\Shared\CommandTrait;
17 use Drupal\Console\Utils\Site;
18 use Drupal\Console\Extension\Manager;
19 use Drupal\Console\Annotations\DrupalCommand;
23 * extension = "locale",
24 * extensionType = "module"
27 class TranslationStatusCommand extends Command
40 protected $extensionManager;
43 * TranslationStatusCommand constructor.
46 * @param Manager $extensionManager
48 public function __construct(
50 Manager $extensionManager
53 $this->extensionManager = $extensionManager;
54 parent::__construct();
57 protected function configure()
60 ->setName('locale:translation:status')
61 ->setDescription($this->trans('commands.locale.translation.status.description'))
64 InputArgument::OPTIONAL,
65 $this->trans('commands.locale.translation.status.arguments.language')
69 protected function execute(InputInterface $input, OutputInterface $output)
71 $io = new DrupalStyle($input, $output);
72 $language = $input->getArgument('language');
74 $this->trans('commands.locale.translation.status.messages.project'),
75 $this->trans('commands.locale.translation.status.messages.version'),
76 $this->trans('commands.locale.translation.status.messages.local-age'),
77 $this->trans('commands.locale.translation.status.messages.remote-age'),
78 $this->trans('commands.locale.translation.status.messages.info'),
81 $locale = $this->extensionManager->getModule('locale');
82 $this->site->loadLegacyFile($locale->getPath(true) . '/locale.compare.inc');
84 $languages = locale_translatable_language_list();
85 $status = locale_translation_get_status();
88 $io->info($this->trans('commands.locale.translation.status.messages.no-languages'));
93 $io->info($this->trans('commands.locale.translation.status.messages.no-translations'));
98 $projectsStatus = $this->projectsStatus();
100 foreach ($projectsStatus as $langcode => $rows) {
102 if ($language !='' && !($language == $langcode || strtolower($language) == strtolower($languages[$langcode]->getName()))) {
105 $io->info($languages[$langcode]->getName());
106 foreach ($rows as $row) {
107 if ($row[0] == 'drupal') {
108 $row[0] = $this->trans('commands.common.messages.drupal-core');
112 $io->table($tableHeader, $tableRows, 'compact');