-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[FEATURE] respect the feature to overwrite language files in ext_loca…
…lconf.php - https://docs.typo3.org/m/typo3/reference-coreapi/12.4/en-us/ApiOverview/Localization/ManagingTranslations.html?highlight=locallangxmloverride#custom-translations [TASK] dropped TYPO3 11 support [TASK] bump version to 12.4.1
- Loading branch information
Showing
9 changed files
with
158 additions
and
105 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,6 +3,8 @@ | |
namespace Datamints\DatamintsLocallangBuilder\Domain\Model; | ||
|
||
use JsonSerializable; | ||
use TYPO3\CMS\Extbase\DomainObject\AbstractEntity; | ||
use TYPO3\CMS\Extbase\Persistence\ObjectStorage; | ||
|
||
/** | ||
* This file is part of the "datamints_locallang_builder" Extension for TYPO3 CMS. | ||
|
@@ -11,7 +13,7 @@ | |
* (c) 2021 Mark Weisgerber <[email protected] / [email protected]> | ||
* Locallang | ||
*/ | ||
class Locallang extends \TYPO3\CMS\Extbase\DomainObject\AbstractEntity implements JsonSerializable | ||
class Locallang extends AbstractEntity implements JsonSerializable | ||
{ | ||
|
||
/** | ||
|
@@ -38,16 +40,16 @@ class Locallang extends \TYPO3\CMS\Extbase\DomainObject\AbstractEntity implement | |
/** | ||
* translations | ||
* | ||
* @var \TYPO3\CMS\Extbase\Persistence\ObjectStorage<\Datamints\DatamintsLocallangBuilder\Domain\Model\Translation> | ||
* @var ObjectStorage<Translation> | ||
* @TYPO3\CMS\Extbase\Annotation\ORM\Cascade("remove") | ||
* @TYPO3\CMS\Extbase\Annotation\ORM\Lazy | ||
*/ | ||
protected ?\TYPO3\CMS\Extbase\Persistence\ObjectStorage $translations = null; | ||
protected ?ObjectStorage $translations = null; | ||
|
||
/** | ||
* Bidirectional for easier db-queries | ||
* | ||
* @var \Datamints\DatamintsLocallangBuilder\Domain\Model\Extension | ||
* @var Extension | ||
* @TYPO3\CMS\Extbase\Annotation\ORM\Lazy | ||
*/ | ||
protected $relatedExtension = null; | ||
|
@@ -72,7 +74,7 @@ public function __construct() | |
*/ | ||
public function initializeObject() | ||
{ | ||
$this->translations = $this->translations ?: new \TYPO3\CMS\Extbase\Persistence\ObjectStorage(); | ||
$this->translations = $this->translations ?: new ObjectStorage(); | ||
} | ||
|
||
/** | ||
|
@@ -99,21 +101,21 @@ public function setPath($path) | |
/** | ||
* Adds a Translation | ||
* | ||
* @param \Datamints\DatamintsLocallangBuilder\Domain\Model\Translation $translation | ||
* @param Translation $translation | ||
* @return void | ||
*/ | ||
public function addTranslation(\Datamints\DatamintsLocallangBuilder\Domain\Model\Translation $translation) | ||
public function addTranslation(Translation $translation) | ||
{ | ||
$this->translations->attach($translation); | ||
} | ||
|
||
/** | ||
* Removes a Translation | ||
* | ||
* @param \Datamints\DatamintsLocallangBuilder\Domain\Model\Translation $translationToRemove The Translation to be removed | ||
* @param Translation $translationToRemove The Translation to be removed | ||
* @return void | ||
*/ | ||
public function removeTranslation(\Datamints\DatamintsLocallangBuilder\Domain\Model\Translation $translationToRemove) | ||
public function removeTranslation(Translation $translationToRemove) | ||
{ | ||
$this->translations->detach($translationToRemove); | ||
} | ||
|
@@ -181,7 +183,7 @@ public function setFilename($filename) | |
/** | ||
* Returns the translations | ||
* | ||
* @return \TYPO3\CMS\Extbase\Persistence\ObjectStorage<\Datamints\DatamintsLocallangBuilder\Domain\Model\Translation> translations | ||
* @return ObjectStorage<Translation> translations | ||
*/ | ||
public function getTranslations() | ||
{ | ||
|
@@ -191,18 +193,18 @@ public function getTranslations() | |
/** | ||
* Sets the translations | ||
* | ||
* @param \TYPO3\CMS\Extbase\Persistence\ObjectStorage<\Datamints\DatamintsLocallangBuilder\Domain\Model\Translation>|null $translations | ||
* @param ObjectStorage<Translation>|null $translations | ||
* @return void | ||
*/ | ||
public function setTranslations(?\TYPO3\CMS\Extbase\Persistence\ObjectStorage $translations) | ||
public function setTranslations(?ObjectStorage $translations) | ||
{ | ||
$this->translations = $translations; | ||
} | ||
|
||
/** | ||
* Returns the relatedExtension | ||
* | ||
* @return \Datamints\DatamintsLocallangBuilder\Domain\Model\Extension $relatedExtension | ||
* @return Extension $relatedExtension | ||
*/ | ||
public function getRelatedExtension() | ||
{ | ||
|
@@ -212,10 +214,10 @@ public function getRelatedExtension() | |
/** | ||
* Sets the relatedExtension | ||
* | ||
* @param \Datamints\DatamintsLocallangBuilder\Domain\Model\Extension $relatedExtension | ||
* @param Extension $relatedExtension | ||
* @return void | ||
*/ | ||
public function setRelatedExtension(\Datamints\DatamintsLocallangBuilder\Domain\Model\Extension $relatedExtension) | ||
public function setRelatedExtension(Extension $relatedExtension) | ||
{ | ||
$this->relatedExtension = $relatedExtension; | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
<?php | ||
|
||
/** | ||
* Copyright (c) 2021. Mark Weisgerber ([email protected] / [email protected]) | ||
*/ | ||
|
||
namespace Datamints\DatamintsLocallangBuilder\Service; | ||
|
||
use Datamints\DatamintsLocallangBuilder\Domain\Model\Locallang; | ||
use Datamints\DatamintsLocallangBuilder\Domain\Model\Runtime\LocallangExport; | ||
use Datamints\DatamintsLocallangBuilder\Exporter\XmlExporter; | ||
use Datamints\DatamintsLocallangBuilder\Service\Traits\ConfigurationServiceTrait; | ||
use Datamints\DatamintsLocallangBuilder\Service\Traits\LocallangServiceTrait; | ||
use Datamints\DatamintsLocallangBuilder\Service\Traits\XmlServiceTrait; | ||
use Datamints\DatamintsLocallangBuilder\Utility\LanguageUtility; | ||
use TYPO3\CMS\Core\Exception; | ||
use TYPO3\CMS\Core\Utility\GeneralUtility; | ||
|
||
class CustomTranslationsOverlayService extends AbstractService | ||
{ | ||
/** | ||
* Overwrites the path for custom translations that have been overwritten by an extension. | ||
* See: https://docs.typo3.org/m/typo3/reference-coreapi/12.4/en-us/ApiOverview/Localization/ManagingTranslations.html?highlight=locallangxmloverride#custom-translations | ||
* | ||
* Beware!! currently we only accept ONE override. When multiple values are given we'll choose the first in the list! | ||
* @param string $path | ||
* @return string | ||
*/ | ||
public function setOverlay(string $path): string | ||
{ | ||
foreach ($GLOBALS['TYPO3_CONF_VARS']['SYS']['locallangXMLOverride'] as $locallangXMLOverridePath => $locallangXMLOverrides){ | ||
if($locallangXMLOverridePath === $path){ | ||
return $locallangXMLOverrides[0]; | ||
} | ||
|
||
} | ||
// passthrough the original given value if no override matches | ||
return $path; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.