[BUGFIX] Flush l10n cache after translation update 85/47785/3
authorChristian Kuhn <lolli@schwarzbu.ch>
Tue, 19 Apr 2016 11:18:13 +0000 (13:18 +0200)
committerChristian Kuhn <lolli@schwarzbu.ch>
Tue, 19 Apr 2016 13:18:20 +0000 (15:18 +0200)
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/47785
Reviewed-by: Christian Kuhn <lolli@schwarzbu.ch>
Tested-by: Christian Kuhn <lolli@schwarzbu.ch>
typo3/sysext/lang/Classes/Command/LanguageCommandController.php
typo3/sysext/lang/Classes/Controller/LanguageController.php

index 47e86ff..9c8c17c 100644 (file)
@@ -14,6 +14,8 @@ namespace TYPO3\CMS\Lang\Command;
  * The TYPO3 project - inspiring people to share!
  */
 
+use TYPO3\CMS\Core\Cache\CacheManager;
+use TYPO3\CMS\Core\Utility\GeneralUtility;
 use TYPO3\CMS\Core\Package\PackageInterface;
 use TYPO3\CMS\Core\Package\PackageManager;
 
@@ -62,7 +64,7 @@ class LanguageCommandController extends \TYPO3\CMS\Extbase\Mvc\Controller\Comman
         $languageRepository = $this->objectManager->get(\TYPO3\CMS\Lang\Domain\Repository\LanguageRepository::class);
         $locales = array();
         if (!empty($localesToUpdate)) {
-            $locales = \TYPO3\CMS\Core\Utility\GeneralUtility::trimExplode(',', $localesToUpdate, true);
+            $locales = GeneralUtility::trimExplode(',', $localesToUpdate, true);
         } else {
             $languages = $languageRepository->findSelected();
             foreach ($languages as $language) {
@@ -87,6 +89,8 @@ class LanguageCommandController extends \TYPO3\CMS\Extbase\Mvc\Controller\Comman
                 $this->output->progressAdvance();
             }
         }
+        // Flush language cache
+        GeneralUtility::makeInstance(CacheManager::class)->getCache('l10n')->flush();
         $this->output->progressFinish();
     }
 
index 02e3d1c..636c147 100644 (file)
@@ -17,6 +17,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;
@@ -172,6 +173,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();
     }
 
     /**
@@ -193,6 +196,8 @@ class LanguageController extends ActionController
             }
         }
         $this->view->assign('response', $response);
+        // Flush language cache
+        GeneralUtility::makeInstance(CacheManager::class)->getCache('l10n')->flush();
     }
 
     /**