7
7
8
8
namespace Drupal \Console \Core \Utils ;
9
9
10
+ use Drupal \Console \Core \Style \DrupalStyle ;
11
+ use Symfony \Component \Console \Input \ArrayInput ;
12
+ use Symfony \Component \Console \Output \ConsoleOutput ;
10
13
use Symfony \Component \Translation \Translator ;
11
14
use Symfony \Component \Translation \Loader \YamlFileLoader ;
12
15
use Symfony \Component \Translation \Loader \ArrayLoader ;
@@ -47,13 +50,22 @@ class TranslatorManager implements TranslatorManagerInterface
47
50
*/
48
51
protected $ coreLanguageRoot ;
49
52
53
+ /**
54
+ * @var DrupalStyle
55
+ */
56
+ private $ io ;
57
+
50
58
/**
51
59
* Translator constructor.
52
60
*/
53
61
public function __construct ()
54
62
{
55
63
$ this ->parser = new Parser ();
56
64
$ this ->filesystem = new Filesystem ();
65
+
66
+ $ output = new ConsoleOutput ();
67
+ $ input = new ArrayInput ([]);
68
+ $ this ->io = new DrupalStyle ($ input , $ output );
57
69
}
58
70
59
71
/**
@@ -164,7 +176,7 @@ public function loadResource($language, $directoryRoot)
164
176
try {
165
177
$ this ->loadTranslationByFile ($ resource , 'application ' );
166
178
} catch (ParseException $ e ) {
167
- echo 'application.yml ' .' ' .$ e ->getMessage ();
179
+ $ this -> io -> error ( 'application.yml ' .' ' .$ e ->getMessage () );
168
180
}
169
181
170
182
continue ;
@@ -173,7 +185,7 @@ public function loadResource($language, $directoryRoot)
173
185
try {
174
186
$ this ->loadTranslationByFile ($ resource , $ key );
175
187
} catch (ParseException $ e ) {
176
- echo $ key .'.yml ' .$ e ->getMessage ();
188
+ $ this -> io -> error ( $ key .'.yml ' .$ e ->getMessage () );
177
189
}
178
190
}
179
191
0 commit comments