Skip to content

Commit

Permalink
[FEATURE] Provide feature flag for new translation server's export
Browse files Browse the repository at this point in the history
The feature switch `newTranslationServer` makes it possible for users
to use the new translation server.

The new translation server is building labels from
Crowdin (https://crowdin.com/project/typo3-cms) instead of the previous
translation server based on Pootle (https://translation.typo3.org/).

Resolves: #89556
Releases: 9.5
Change-Id: I41127eb37ead07cf360aa9ba4d1c2bf021b69a31
Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/62743
Tested-by: TYPO3com <noreply@typo3.com>
Tested-by: Chris Müller <typo3@krue.ml>
Tested-by: Markus Klein <markus.klein@typo3.org>
Tested-by: Benni Mack <benni@typo3.org>
Reviewed-by: Markus Klein <markus.klein@typo3.org>
Reviewed-by: Jan Stockfisch <typo3@jan-stockfisch.de>
Reviewed-by: Jörg Bösche <typo3@joergboesche.de>
Reviewed-by: Chris Müller <typo3@krue.ml>
Reviewed-by: Benni Mack <benni@typo3.org>
  • Loading branch information
georgringer authored and bmack committed Jan 9, 2020
1 parent ab16e2e commit 07eea94
Show file tree
Hide file tree
Showing 5 changed files with 41 additions and 2 deletions.
1 change: 1 addition & 0 deletions typo3/sysext/core/Configuration/DefaultConfiguration.php
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@
'TypoScript.strictSyntax' => true,
'simplifiedControllerActionDispatching' => false,
'security.frontend.keepSessionDataOnLogout' => false,
'newTranslationServer' => false,
],
'createGroup' => '',
'sitename' => 'TYPO3',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -230,6 +230,9 @@ SYS:
security.frontend.keepSessionDataOnLogout:
type: bool
description: 'If on, session data is kept in an anonymous session after frontend user logged out. As this is a potential security risk, it is recommended to disable this option if not specifically needed.'
newTranslationServer:
type: bool
description: 'If on, the new translation server is used which is filled by exports of https://crowdin.com/project/typo3-cms.'
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.'
Expand Down
3 changes: 2 additions & 1 deletion typo3/sysext/core/Configuration/FactoryConfiguration.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,8 @@
'SYS' => [
'sitename' => 'New TYPO3 site',
'features' => [
'unifiedPageTranslationHandling' => true
'unifiedPageTranslationHandling' => true,
'newTranslationServer' => true,
],
],
];
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
.. include:: ../../Includes.txt

===================================================
Feature: #89526 - FeatureFlag: newTranslationServer
===================================================

See :issue:`89556`

Description
===========

The feature switch `newTranslationServer` makes it possible for installations to fetch translations from the new translation server.
The new translation server is building labels from Crowdin (https://crowdin.com/project/typo3-cms) instead of the previous translation server based on Pootle (https://translation.typo3.org/).

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/.

It is very simple to provide translations by registering at Crowdin and suggest translations online.

Impact
======

The feature is enabled by default for new installations.

.. index:: Backend, Frontend, ext:core
12 changes: 11 additions & 1 deletion typo3/sysext/install/Classes/Service/LanguagePackService.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
*/

use Symfony\Component\Finder\Finder;
use TYPO3\CMS\Core\Configuration\Features;
use TYPO3\CMS\Core\Core\Environment;
use TYPO3\CMS\Core\Http\RequestFactory;
use TYPO3\CMS\Core\Localization\Locales;
Expand Down Expand Up @@ -50,6 +51,9 @@ class LanguagePackService
*/
protected $requestFactory;

private const DEFAULT_LANGUAGE_PACK_URL = 'https://typo3.org/fileadmin/ter/';
private const NEW_LANGUAGE_PACK_URL = 'https://localize.typo3.org/fileadmin/ter/';

public function __construct()
{
$this->locales = GeneralUtility::makeInstance(Locales::class);
Expand Down Expand Up @@ -195,7 +199,7 @@ public function updateMirrorBaseUrl(): string
}
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;
Expand Down Expand Up @@ -234,6 +238,12 @@ public function languagePackDownload(string $key, string $iso): string
if (empty($languagePackBaseUrl)) {
throw new \RuntimeException('Language pack baseUrl not found', 1520169691);
}

if ($languagePackBaseUrl === self::DEFAULT_LANGUAGE_PACK_URL
&& GeneralUtility::makeInstance(Features::class)->isFeatureEnabled('newTranslationServer')) {
$languagePackBaseUrl = self::NEW_LANGUAGE_PACK_URL;
}

// Allow to modify the base url on the fly by calling a signal
$signalSlotDispatcher = GeneralUtility::makeInstance(Dispatcher::class);
$signalSlotDispatcher->dispatch(
Expand Down

0 comments on commit 07eea94

Please sign in to comment.