From 9786bb9868b134112dfac8d80ec1004c55b7fdd8 Mon Sep 17 00:00:00 2001
From: Florian Mast <flo.mast@web.de>
Date: Sat, 3 Dec 2016 13:45:23 +0100
Subject: [PATCH] [BUGFIX] Respect availableLanguages from
 AdditionalConfiguration.php

if $GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['lang']['availableLanguages']
is set in AdditionalConfiguration.php, the language module will now
respect that setting.

Resolves: #78876
Releases: master
Change-Id: Iec6a0f05db835ae949fbacdc2cdf500a0950d57c
Reviewed-on: https://review.typo3.org/50871
Reviewed-by: Anja Leichsenring <aleichsenring@ab-softlab.de>
Tested-by: Anja Leichsenring <aleichsenring@ab-softlab.de>
Reviewed-by: Susanne Moog <susanne.moog@typo3.org>
Tested-by: Susanne Moog <susanne.moog@typo3.org>
---
 .../Classes/Domain/Repository/LanguageRepository.php     | 9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)

diff --git a/typo3/sysext/lang/Classes/Domain/Repository/LanguageRepository.php b/typo3/sysext/lang/Classes/Domain/Repository/LanguageRepository.php
index 9afbde889afc..c6b5bf990533 100644
--- a/typo3/sysext/lang/Classes/Domain/Repository/LanguageRepository.php
+++ b/typo3/sysext/lang/Classes/Domain/Repository/LanguageRepository.php
@@ -85,11 +85,10 @@ class LanguageRepository
      */
     public function __construct()
     {
-        $configurationManager = GeneralUtility::makeInstance(ConfigurationManager::class);
-        try {
-            $globalSettings = $configurationManager->getLocalConfigurationValueByPath($this->configurationPath);
-            $this->selectedLocales = (array)$globalSettings['availableLanguages'];
-        } catch (\Exception $e) {
+        if (isset($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['lang']['availableLanguages'])) {
+            $this->selectedLocales = $GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['lang']['availableLanguages'];
+        } else {
+            $configurationManager = GeneralUtility::makeInstance(ConfigurationManager::class);
             $configurationManager->setLocalConfigurationValueByPath(
                 $this->configurationPath,
                 ['availableLanguages' => []]
-- 
GitLab