Skip to content
Permalink
Browse files

[translator] Use DrupalStyle to show erros (#352)

  • Loading branch information...
harold20 authored and enzolutions committed May 23, 2019
1 parent 934d14f commit 491455688ef6abeed7f155b6f935a10791927c06
Showing with 14 additions and 2 deletions.
  1. +14 −2 src/Utils/TranslatorManager.php
@@ -7,6 +7,9 @@
namespace Drupal\Console\Core\Utils;
use Drupal\Console\Core\Style\DrupalStyle;
use Symfony\Component\Console\Input\ArrayInput;
use Symfony\Component\Console\Output\ConsoleOutput;
use Symfony\Component\Translation\Translator;
use Symfony\Component\Translation\Loader\YamlFileLoader;
use Symfony\Component\Translation\Loader\ArrayLoader;
@@ -47,13 +50,22 @@ class TranslatorManager implements TranslatorManagerInterface
*/
protected $coreLanguageRoot;
/**
* @var DrupalStyle
*/
private $io;
/**
* Translator constructor.
*/
public function __construct()
{
$this->parser = new Parser();
$this->filesystem = new Filesystem();
$output = new ConsoleOutput();
$input = new ArrayInput([]);
$this->io = new DrupalStyle($input, $output);
}
/**
@@ -164,7 +176,7 @@ public function loadResource($language, $directoryRoot)
try {
$this->loadTranslationByFile($resource, 'application');
} catch (ParseException $e) {
echo 'application.yml'.' '.$e->getMessage();
$this->io->error('application.yml'.' '.$e->getMessage());
}
continue;
@@ -173,7 +185,7 @@ public function loadResource($language, $directoryRoot)
try {
$this->loadTranslationByFile($resource, $key);
} catch (ParseException $e) {
echo $key.'.yml '.$e->getMessage();
$this->io->error($key.'.yml '.$e->getMessage());
}
}

0 comments on commit 4914556

Please sign in to comment.
You can’t perform that action at this time.