[FEATURE] Provide feature flag for new translation server's export 27/62127/4
authorGeorg Ringer <georg.ringer@gmail.com>
Mon, 28 Oct 2019 12:45:04 +0000 (13:45 +0100)
committerBenni Mack <benni@typo3.org>
Wed, 30 Oct 2019 12:58:55 +0000 (13:58 +0100)
The feature switch `betaTranslationServer` makes it possible for users
to test and use the new translation server.

The integration is currently work in progress but will be finished before
the LTS release of version 10.
Once the work has been stabilized and tested well,
the feature flag will be removed for 10 and backported for 9.

Resolves: #89526
Releases: master
Change-Id: Ic88e4b6568dbe53cd88e63a8a1dd39787219e9e4
Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/62127
Tested-by: Joerg Kummer <typo3@enobe.de>
Tested-by: TYPO3com <noreply@typo3.com>
Tested-by: Benni Mack <benni@typo3.org>
Reviewed-by: Joerg Kummer <typo3@enobe.de>
Reviewed-by: Benni Mack <benni@typo3.org>
typo3/sysext/core/Configuration/DefaultConfiguration.php
typo3/sysext/core/Configuration/DefaultConfigurationDescription.yaml
typo3/sysext/core/Documentation/Changelog/master/Feature-89526-FeatureFlagBetaTranslationServer.rst [new file with mode: 0644]
typo3/sysext/install/Classes/Service/LanguagePackService.php

index ae008f1..e0e1d78 100644 (file)
@@ -76,6 +76,7 @@ return [
             'unifiedPageTranslationHandling' => false,
             'security.frontend.keepSessionDataOnLogout' => false,
             'rearrangedRedirectMiddlewares' => false,
+            'betaTranslationServer' => false,
         ],
         'createGroup' => '',
         'sitename' => 'TYPO3',
index f6c93d3..41e1139 100644 (file)
@@ -226,6 +226,9 @@ SYS:
               rearrangedRedirectMiddlewares:
                 type: bool
                 description: 'If on, the middlewares "base redirect" and "redirects" are switched, so that "redirects" (if ext:redirects is installed) is executed before "base redirect". The new ordering aims to be a better default shipped by the TYPO3 core.'
+              betaTranslationServer:
+                type: bool
+                description: 'If on, the new translation server is used which is filled by exports of https://crowdin.com/project/typo3-cms. This setting will be removed as soon as the new integration is stable.'
         availablePasswordHashAlgorithms:
             type: array
             description: 'A list of available password hash mechanisms. Extensions may register additional mechanisms here. This is usually not extended in LocalConfiguration.php.'
diff --git a/typo3/sysext/core/Documentation/Changelog/master/Feature-89526-FeatureFlagBetaTranslationServer.rst b/typo3/sysext/core/Documentation/Changelog/master/Feature-89526-FeatureFlagBetaTranslationServer.rst
new file mode 100644 (file)
index 0000000..314bd25
--- /dev/null
@@ -0,0 +1,29 @@
+.. include:: ../../Includes.txt
+
+====================================================
+Feature: #89526 - FeatureFlag: betaTranslationServer
+====================================================
+
+See :issue:`89526`
+
+Description
+===========
+
+The feature switch `betaTranslationServer` makes it possible for installations to fetch translations from the new translation server (beta status).
+The new translation server is building labels from Crowdin (https://crowdin.com/project/typo3-cms) instead of the current translation server based on Pootle (https://translation.typo3.org/).
+
+The integration is currently work in progress but will be finished before the LTS release of version 10.
+Once the work has been stabilized and tested well, the feature flag will be removed for 10 and backported for 9.
+
+If you are interested in this topic, join the Crowdin Initiative. All information can be found at https://typo3.org/community/teams/typo3-development/initiatives/localization-with-crowdin/.
+
+
+Impact
+======
+
+Be aware that using this translation server is currently experimental. This means:
+
+- Translations are incomplete and might be removed and added anytime
+- Translations of community extensions are currently not available
+
+.. index:: Backend, Frontend, ext:core
index 067a730..480411a 100644 (file)
@@ -16,6 +16,7 @@ namespace TYPO3\CMS\Install\Service;
  */
 
 use Symfony\Component\Finder\Finder;
+use TYPO3\CMS\Core\Configuration\Features;
 use TYPO3\CMS\Core\Core\Environment;
 use TYPO3\CMS\Core\Localization\Locales;
 use TYPO3\CMS\Core\Package\PackageManager;
@@ -43,6 +44,9 @@ class LanguagePackService
      */
     protected $registry;
 
+    private const DEFAULT_LANGUAGE_PACK_URL = 'https://typo3.org/fileadmin/ter/';
+    private const BETA_LANGUAGE_PACK_URL = 'https://beta-translation.typo3.org/fileadmin/ter/';
+
     public function __construct()
     {
         $this->locales = GeneralUtility::makeInstance(Locales::class);
@@ -183,7 +187,7 @@ class LanguagePackService
         }
         if (empty($downloadBaseUrl)) {
             // Hard coded fallback if something went wrong fetching & parsing mirror list
-            $downloadBaseUrl = 'https://typo3.org/fileadmin/ter/';
+            $downloadBaseUrl = self::DEFAULT_LANGUAGE_PACK_URL;
         }
         $this->registry->set('languagePacks', 'baseUrl', $downloadBaseUrl);
         return $downloadBaseUrl;
@@ -222,6 +226,12 @@ class LanguagePackService
         if (empty($languagePackBaseUrl)) {
             throw new \RuntimeException('Language pack baseUrl not found', 1520169691);
         }
+
+        if ($languagePackBaseUrl === self::DEFAULT_LANGUAGE_PACK_URL
+            && GeneralUtility::makeInstance(Features::class)->isFeatureEnabled('betaTranslationServer')) {
+            $languagePackBaseUrl = self::BETA_LANGUAGE_PACK_URL;
+        }
+
         // Allow to modify the base url on the fly by calling a signal
         $signalSlotDispatcher = GeneralUtility::makeInstance(Dispatcher::class);
         $signalSlotDispatcher->dispatch(