Commit 5ec4dcfa authored by Damjan's avatar Damjan
Browse files

[BUGFIX] Using XML as override files.

Typo3 can read XML override non-default translations.
parent 0bb683fb
......@@ -30,7 +30,7 @@ use SGalinski\Lfeditor\Exceptions\LFException;
use SGalinski\Lfeditor\Utility\SgLib;
use SGalinski\Lfeditor\Utility\Typo3Lib;
class FileOverrideService extends FileBaseXLFService {
class FileOverrideService extends FileBaseXMLService {
/**
* Object which represents original (overridden) language file.
*
......@@ -57,7 +57,7 @@ class FileOverrideService extends FileBaseXLFService {
if (!is_file($overrideFileAbsolutePath)) {
$extRelativeFilePath = SgLib::trimPath('EXT:', $typo3ExtRelativeFilePath);
$extRelativeFilePath = substr($extRelativeFilePath, 0, strrpos($extRelativeFilePath, '.')) . '.xlf';
$extRelativeFilePath = substr($extRelativeFilePath, 0, strrpos($extRelativeFilePath, '.')) . '.xml';
/** @var ConfigurationService $configurationService */
$configurationService = $this->objectManager->get('SGalinski\Lfeditor\Service\ConfigurationService');
......@@ -77,7 +77,7 @@ class FileOverrideService extends FileBaseXLFService {
*/
public function readFile() {
if (is_file($this->absFile)) {
$this->readXlfFile();
parent::readFile();
if (!Typo3Lib::isTypo3BackendInUtf8Mode()) {
$this->localLang = Typo3Lib::utf8($this->localLang, FALSE, ['default']);
}
......@@ -143,14 +143,12 @@ class FileOverrideService extends FileBaseXLFService {
}
parent::writeFile();
// TODO: Delete override file and additional configuration line if there is no content in file?
// Set only new values in GlobalConfiguration if something changed
$typo3ExtRelativeFilePath = Typo3Lib::transTypo3File($this->originalFileObject->getAbsFile(), FALSE);
$relativeOverrideFilePath = SgLib::trimPath(PATH_site, $this->absFile);
//TODO: this can support more than 1 override files?
if ($GLOBALS['TYPO3_CONF_VARS']['SYS']['locallangXMLOverride'][$typo3ExtRelativeFilePath][0]
=== $relativeOverrideFilePath
) {
$locallangXMLOverride = &$GLOBALS['TYPO3_CONF_VARS']['SYS']['locallangXMLOverride'];
if ($locallangXMLOverride[$typo3ExtRelativeFilePath][0] === $relativeOverrideFilePath) {
return;
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment