Skip to content

Commit

Permalink
[BUGFIX] Set typo3Language for new site languages if possible
Browse files Browse the repository at this point in the history
If a sys_language record is properly filled with the language
information, the site language record can be filled as well.

Setting the typo3Language by default with the correct languages makes it
easier to setup languages.

Resolves: #92422
Releases: master, 10.4
Change-Id: I3c9e2322cd0aa3963ede36586cc97babe0f003a8
Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/65897
Tested-by: TYPO3com <noreply@typo3.com>
Tested-by: Josef Glatz <josefglatz@gmail.com>
Tested-by: Oliver Bartsch <bo@cedev.de>
Tested-by: Andreas Fernandez <a.fernandez@scripting-base.de>
Reviewed-by: Josef Glatz <josefglatz@gmail.com>
Reviewed-by: Oliver Bartsch <bo@cedev.de>
Reviewed-by: Andreas Fernandez <a.fernandez@scripting-base.de>
  • Loading branch information
georgringer authored and andreaskienast committed Sep 26, 2020
1 parent 0fc833a commit 457bfb5
Showing 1 changed file with 7 additions and 0 deletions.
Expand Up @@ -27,6 +27,7 @@
use TYPO3\CMS\Core\Database\ConnectionPool;
use TYPO3\CMS\Core\Database\Query\Restriction\HiddenRestriction;
use TYPO3\CMS\Core\Http\JsonResponse;
use TYPO3\CMS\Core\Localization\Locales;
use TYPO3\CMS\Core\Utility\ArrayUtility;
use TYPO3\CMS\Core\Utility\GeneralUtility;
use TYPO3\CMS\Core\Utility\MathUtility;
Expand Down Expand Up @@ -98,6 +99,12 @@ public function newInlineChildAction(ServerRequestInterface $request): ResponseI
if (!empty($row['language_isocode'])) {
$defaultDatabaseRow['iso-639-1'] = $row['language_isocode'];
$defaultDatabaseRow['base'] = '/' . $row['language_isocode'] . '/';

$locales = GeneralUtility::makeInstance(Locales::class);
$allLanguages = $locales->getLanguages();
if (isset($allLanguages[$row['language_isocode']])) {
$defaultDatabaseRow['typo3Language'] = $row['language_isocode'];
}
}
if (!empty($row['flag']) && $row['flag'] === 'multiple') {
$defaultDatabaseRow['flag'] = 'global';
Expand Down

0 comments on commit 457bfb5

Please sign in to comment.