From 0a02d4840465e4be069861d65e4b6e93669bdb5a Mon Sep 17 00:00:00 2001
From: Christian Kuhn <lolli@schwarzbu.ch>
Date: Tue, 19 Apr 2016 13:18:13 +0200
Subject: [PATCH] [BUGFIX] Flush l10n cache after translation update

The language module should flush l10n caches after translation
update, otherwise translation changes have no immediate effect.

Change-Id: Ibf412293139e6fc82da243ba22d7d13d187add5e
Resolves: #75778
Releases: master, 7.6
Reviewed-on: https://review.typo3.org/47780
Reviewed-by: Georg Ringer <georg.ringer@gmail.com>
Tested-by: Georg Ringer <georg.ringer@gmail.com>
Reviewed-by: Wouter Wolters <typo3@wouterwolters.nl>
Tested-by: Wouter Wolters <typo3@wouterwolters.nl>
---
 .../lang/Classes/Command/LanguageCommandController.php       | 3 +++
 typo3/sysext/lang/Classes/Controller/LanguageController.php  | 5 +++++
 2 files changed, 8 insertions(+)

diff --git a/typo3/sysext/lang/Classes/Command/LanguageCommandController.php b/typo3/sysext/lang/Classes/Command/LanguageCommandController.php
index e91f42083dcf..ba4d53b4f37c 100644
--- a/typo3/sysext/lang/Classes/Command/LanguageCommandController.php
+++ b/typo3/sysext/lang/Classes/Command/LanguageCommandController.php
@@ -14,6 +14,7 @@ namespace TYPO3\CMS\Lang\Command;
  * The TYPO3 project - inspiring people to share!
  */
 
+use TYPO3\CMS\Core\Cache\CacheManager;
 use TYPO3\CMS\Core\Package\PackageInterface;
 use TYPO3\CMS\Core\Package\PackageManager;
 use TYPO3\CMS\Core\Utility\GeneralUtility;
@@ -93,6 +94,8 @@ class LanguageCommandController extends CommandController
                 $this->output->progressAdvance();
             }
         }
+        // Flush language cache
+        GeneralUtility::makeInstance(CacheManager::class)->getCache('l10n')->flush();
         $this->output->progressFinish();
     }
 
diff --git a/typo3/sysext/lang/Classes/Controller/LanguageController.php b/typo3/sysext/lang/Classes/Controller/LanguageController.php
index 9a2bb7adf5cc..37c916d57b3e 100644
--- a/typo3/sysext/lang/Classes/Controller/LanguageController.php
+++ b/typo3/sysext/lang/Classes/Controller/LanguageController.php
@@ -18,6 +18,7 @@ use TYPO3\CMS\Backend\Template\Components\ButtonBar;
 use TYPO3\CMS\Backend\Template\Components\Menu\Menu;
 use TYPO3\CMS\Backend\Template\Components\Menu\MenuItem;
 use TYPO3\CMS\Backend\View\BackendTemplateView;
+use TYPO3\CMS\Core\Cache\CacheManager;
 use TYPO3\CMS\Core\Imaging\Icon;
 use TYPO3\CMS\Core\Utility\GeneralUtility;
 use TYPO3\CMS\Extbase\Mvc\Controller\ActionController;
@@ -180,6 +181,8 @@ class LanguageController extends ActionController
             $response['progress'] = $progress > 100 ? 100 : $progress;
         }
         $this->view->assign('response', $response);
+        // Flush language cache
+        GeneralUtility::makeInstance(CacheManager::class)->getCache('l10n')->flush();
     }
 
     /**
@@ -201,6 +204,8 @@ class LanguageController extends ActionController
             }
         }
         $this->view->assign('response', $response);
+        // Flush language cache
+        GeneralUtility::makeInstance(CacheManager::class)->getCache('l10n')->flush();
     }
 
     /**
-- 
GitLab