Security update for Core, with self-updated composer
[yaffs-website] / vendor / drupal / console / src / Utils / TranslatorManager.php
index b6e31ea1fb4a8c0be99f7bc7ab96b3a6539f5552..835433c501772550728789d5639e0ac19ec6a365 100644 (file)
@@ -18,6 +18,8 @@ use Symfony\Component\Finder\Finder;
  */
 class TranslatorManager extends TranslatorManagerBase
 {
+    protected $extensions = [];
+
     /**
      * @param $extensionPath
      */
@@ -73,12 +75,30 @@ class TranslatorManager extends TranslatorManagerBase
         );
     }
 
+    /**
+     * @param $library
+     */
+    private function addResourceTranslationsByLibrary($library)
+    {
+        /** @var \Drupal\Console\Core\Utils\DrupalFinder $drupalFinder */
+        $drupalFinder = \Drupal::service('console.drupal_finder');
+        $path =  $drupalFinder->getComposerRoot() . '/vendor/' . $library;
+        $this->addResourceTranslationsByExtensionPath(
+            $path
+        );
+    }
+
     /**
      * @param $extension
      * @param $type
      */
     public function addResourceTranslationsByExtension($extension, $type)
     {
+        if (array_search($extension, $this->extensions) !== false) {
+            return;
+        }
+
+        $this->extensions[] = $extension;
         if ($type == 'module') {
             $this->addResourceTranslationsByModule($extension);
             return;
@@ -87,5 +107,9 @@ class TranslatorManager extends TranslatorManagerBase
             $this->addResourceTranslationsByTheme($extension);
             return;
         }
+        if ($type == 'library') {
+            $this->addResourceTranslationsByLibrary($extension);
+            return;
+        }
     }
 }