Skip to content
Permalink
Browse files

Support new installers location. Avoid infinite loop in translator. Fix

  • Loading branch information...
eiriksm authored and enzolutions committed Aug 20, 2019
1 parent 5134178 commit cf7a95f2d69e76fd693626f5a6228d90f56118fb
Showing with 24 additions and 2 deletions.
  1. +6 −0 src/Utils/DrupalFinder.php
  2. +18 −2 src/Utils/TranslatorManager.php
@@ -78,6 +78,12 @@ protected function defineConstants($vendorDir)
"/{$vendorDir}/drupal/console-%s/translations/"
);
}
if (!defined("DRUPAL_CONSOLE_LANGUAGE_INSTALLERS")) {
define(
"DRUPAL_CONSOLE_LANGUAGE_INSTALLERS",
"/console/language/console-%s/translations/"
);
}
if (!defined("DRUPAL_CONSOLE_LIBRARY")) {
define(
@@ -109,16 +109,32 @@ private function buildCoreLanguageDirectory(
DRUPAL_CONSOLE_LANGUAGE,
$language
);
$installersLanguageDirectory =
$directoryRoot .
sprintf(
DRUPAL_CONSOLE_LANGUAGE_INSTALLERS,
$language
);
$languageDirectory = null;
foreach ([$coreLanguageDirectory, $installersLanguageDirectory] as $candidate) {
if (is_dir($candidate)) {
$languageDirectory = $candidate;
}
}
if (!is_dir($coreLanguageDirectory)) {
if (!isset($languageDirectory)) {
if ($language == 'en') {
throw new \Exception('No languages found. Make sure you have installed a console language package in a supported directory');
}
return $this->buildCoreLanguageDirectory('en', $directoryRoot);
}
if (!$this->coreLanguageRoot) {
$this->coreLanguageRoot = $directoryRoot;
}
return [$language, $coreLanguageDirectory];
return [$language, $languageDirectory];
}
/**

0 comments on commit cf7a95f

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