feature #14473 [DX] Minor improvement for the translation:debug output (nicolasdewez)

This PR was submitted for the master branch but it was merged into the 2.8 branch instead (closes #14473).

Discussion
----------

[DX] Minor improvement for the translation:debug output

| Q             | A
| ------------- | ---
| Bug fix?      | no
| New feature?  | no
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | #13874

Commits
-------

b941bd3 Changed output for translation:debug command
This commit is contained in:
Abdellatif Ait boudad 2015-04-26 16:54:56 +01:00
commit 7e29d2c999

View File

@ -168,7 +168,7 @@ EOF
} }
// Display header line // Display header line
$headers = array('State(s)', 'Domain', 'Id', sprintf('Message Preview (%s)', $locale)); $headers = array('State', 'Domain', 'Id', sprintf('Message Preview (%s)', $locale));
foreach ($fallbackCatalogues as $fallbackCatalogue) { foreach ($fallbackCatalogues as $fallbackCatalogue) {
$headers[] = sprintf('Fallback Message Preview (%s)', $fallbackCatalogue->getLocale()); $headers[] = sprintf('Fallback Message Preview (%s)', $fallbackCatalogue->getLocale());
} }
@ -215,26 +215,20 @@ EOF
} else { } else {
$table->render($output); $table->render($output);
} }
$output->writeln('');
$output->writeln('<info>Legend:</info>');
$output->writeln(sprintf(' %s Missing message', $this->formatState(self::MESSAGE_MISSING)));
$output->writeln(sprintf(' %s Unused message', $this->formatState(self::MESSAGE_UNUSED)));
$output->writeln(sprintf(' %s Same as the fallback message', $this->formatState(self::MESSAGE_EQUALS_FALLBACK)));
} }
private function formatState($state) private function formatState($state)
{ {
if (self::MESSAGE_MISSING === $state) { if (self::MESSAGE_MISSING === $state) {
return '<fg=red>x</>'; return '<error>missing</error>';
} }
if (self::MESSAGE_UNUSED === $state) { if (self::MESSAGE_UNUSED === $state) {
return '<fg=yellow>o</>'; return '<comment>unused</comment>';
} }
if (self::MESSAGE_EQUALS_FALLBACK === $state) { if (self::MESSAGE_EQUALS_FALLBACK === $state) {
return '<fg=green>=</>'; return '<info>fallback</info>';
} }
return $state; return $state;