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)
78
78
"/ {$ vendorDir }/drupal/console-%s/translations/ "
79
79
);
80
80
}
81
+ if (!defined ("DRUPAL_CONSOLE_LANGUAGE_INSTALLERS " )) {
82
+ define (
83
+ "DRUPAL_CONSOLE_LANGUAGE_INSTALLERS " ,
84
+ "/console/language/console-%s/translations/ "
85
+ );
86
+ }
81
87
82
88
if (!defined ("DRUPAL_CONSOLE_LIBRARY " )) {
83
89
define (
Original file line number Diff line number Diff line change @@ -109,16 +109,32 @@ private function buildCoreLanguageDirectory(
109
109
DRUPAL_CONSOLE_LANGUAGE ,
110
110
$ language
111
111
);
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
+ }
112
125
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
+ }
114
130
return $ this ->buildCoreLanguageDirectory ('en ' , $ directoryRoot );
115
131
}
116
132
117
133
if (!$ this ->coreLanguageRoot ) {
118
134
$ this ->coreLanguageRoot = $ directoryRoot ;
119
135
}
120
136
121
- return [$ language , $ coreLanguageDirectory ];
137
+ return [$ language , $ languageDirectory ];
122
138
}
123
139
124
140
/**
You can’t perform that action at this time.
0 commit comments