@@ -55,9 +55,9 @@ class TranslationDebugCommand extends Command
5555 private $ defaultTransPath ;
5656 private $ defaultViewsPath ;
5757 private $ transPaths ;
58- private $ viewsPaths ;
58+ private $ codePaths ;
5959
60- public function __construct (TranslatorInterface $ translator , TranslationReaderInterface $ reader , ExtractorInterface $ extractor , string $ defaultTransPath = null , string $ defaultViewsPath = null , array $ transPaths = [], array $ viewsPaths = [])
60+ public function __construct (TranslatorInterface $ translator , TranslationReaderInterface $ reader , ExtractorInterface $ extractor , string $ defaultTransPath = null , string $ defaultViewsPath = null , array $ transPaths = [], array $ codePaths = [])
6161 {
6262 parent ::__construct ();
6363
@@ -67,7 +67,7 @@ public function __construct(TranslatorInterface $translator, TranslationReaderIn
6767 $ this ->defaultTransPath = $ defaultTransPath ;
6868 $ this ->defaultViewsPath = $ defaultViewsPath ;
6969 $ this ->transPaths = $ transPaths ;
70- $ this ->viewsPaths = $ viewsPaths ;
70+ $ this ->codePaths = $ codePaths ;
7171 }
7272
7373 /**
@@ -139,9 +139,10 @@ protected function execute(InputInterface $input, OutputInterface $output): int
139139 if ($ this ->defaultTransPath ) {
140140 $ transPaths [] = $ this ->defaultTransPath ;
141141 }
142- $ viewsPaths = $ this ->viewsPaths ;
142+ $ codePaths = $ this ->codePaths ;
143+ $ codePaths [] = $ kernel ->getProjectDir ().'/src ' ;
143144 if ($ this ->defaultViewsPath ) {
144- $ viewsPaths [] = $ this ->defaultViewsPath ;
145+ $ codePaths [] = $ this ->defaultViewsPath ;
145146 }
146147
147148 // Override with provided Bundle info
@@ -150,19 +151,19 @@ protected function execute(InputInterface $input, OutputInterface $output): int
150151 $ bundle = $ kernel ->getBundle ($ input ->getArgument ('bundle ' ));
151152 $ bundleDir = $ bundle ->getPath ();
152153 $ transPaths = [is_dir ($ bundleDir .'/Resources/translations ' ) ? $ bundleDir .'/Resources/translations ' : $ bundleDir .'/translations ' ];
153- $ viewsPaths = [is_dir ($ bundleDir .'/Resources/views ' ) ? $ bundleDir .'/Resources/views ' : $ bundleDir .'/templates ' ];
154+ $ codePaths = [is_dir ($ bundleDir .'/Resources/views ' ) ? $ bundleDir .'/Resources/views ' : $ bundleDir .'/templates ' ];
154155 if ($ this ->defaultTransPath ) {
155156 $ transPaths [] = $ this ->defaultTransPath ;
156157 }
157158 if ($ this ->defaultViewsPath ) {
158- $ viewsPaths [] = $ this ->defaultViewsPath ;
159+ $ codePaths [] = $ this ->defaultViewsPath ;
159160 }
160161 } catch (\InvalidArgumentException $ e ) {
161162 // such a bundle does not exist, so treat the argument as path
162163 $ path = $ input ->getArgument ('bundle ' );
163164
164165 $ transPaths = [$ path .'/translations ' ];
165- $ viewsPaths = [$ path .'/templates ' ];
166+ $ codePaths = [$ path .'/templates ' ];
166167
167168 if (!is_dir ($ transPaths [0 ]) && !isset ($ transPaths [1 ])) {
168169 throw new InvalidArgumentException (sprintf ('"%s" is neither an enabled bundle nor a directory. ' , $ transPaths [0 ]));
@@ -172,12 +173,12 @@ protected function execute(InputInterface $input, OutputInterface $output): int
172173 foreach ($ kernel ->getBundles () as $ bundle ) {
173174 $ bundleDir = $ bundle ->getPath ();
174175 $ transPaths [] = is_dir ($ bundleDir .'/Resources/translations ' ) ? $ bundleDir .'/Resources/translations ' : $ bundle ->getPath ().'/translations ' ;
175- $ viewsPaths [] = is_dir ($ bundleDir .'/Resources/views ' ) ? $ bundleDir .'/Resources/views ' : $ bundle ->getPath ().'/templates ' ;
176+ $ codePaths [] = is_dir ($ bundleDir .'/Resources/views ' ) ? $ bundleDir .'/Resources/views ' : $ bundle ->getPath ().'/templates ' ;
176177 }
177178 }
178179
179180 // Extract used messages
180- $ extractedCatalogue = $ this ->extractMessages ($ locale , $ viewsPaths );
181+ $ extractedCatalogue = $ this ->extractMessages ($ locale , $ codePaths );
181182
182183 // Load defined messages
183184 $ currentCatalogue = $ this ->loadCurrentMessages ($ locale , $ transPaths );
0 commit comments