File tree Expand file tree Collapse file tree 2 files changed +24
-2
lines changed Expand file tree Collapse file tree 2 files changed +24
-2
lines changed Original file line number Diff line number Diff line change @@ -78,6 +78,12 @@ protected function defineConstants($vendorDir)
7878 "/ {$ vendorDir }/drupal/console-%s/translations/ "
7979 );
8080 }
81+ if (!defined ("DRUPAL_CONSOLE_LANGUAGE_INSTALLERS " )) {
82+ define (
83+ "DRUPAL_CONSOLE_LANGUAGE_INSTALLERS " ,
84+ "/console/language/console-%s/translations/ "
85+ );
86+ }
8187
8288 if (!defined ("DRUPAL_CONSOLE_LIBRARY " )) {
8389 define (
Original file line number Diff line number Diff line change @@ -109,16 +109,32 @@ private function buildCoreLanguageDirectory(
109109 DRUPAL_CONSOLE_LANGUAGE ,
110110 $ language
111111 );
112+ $ installersLanguageDirectory =
113+ $ directoryRoot .
114+ sprintf (
115+ DRUPAL_CONSOLE_LANGUAGE_INSTALLERS ,
116+ $ language
117+ );
118+
119+ $ languageDirectory = null ;
120+ foreach ([$ coreLanguageDirectory , $ installersLanguageDirectory ] as $ candidate ) {
121+ if (is_dir ($ candidate )) {
122+ $ languageDirectory = $ candidate ;
123+ }
124+ }
112125
113- if (!is_dir ($ coreLanguageDirectory )) {
126+ if (!isset ($ languageDirectory )) {
127+ if ($ language == 'en ' ) {
128+ throw new \Exception ('No languages found. Make sure you have installed a console language package in a supported directory ' );
129+ }
114130 return $ this ->buildCoreLanguageDirectory ('en ' , $ directoryRoot );
115131 }
116132
117133 if (!$ this ->coreLanguageRoot ) {
118134 $ this ->coreLanguageRoot = $ directoryRoot ;
119135 }
120136
121- return [$ language , $ coreLanguageDirectory ];
137+ return [$ language , $ languageDirectory ];
122138 }
123139
124140 /**
You can’t perform that action at this time.
0 commit comments