Bug #65273

Updated by Markus Klein about 5 years ago

This is a summary ticket of multiple bug reports.

h1. The problem

h2. Setup

Consider a those files in /fileadmin:
* locallang.xlf
* de.locallang.xlf
* locallangSplit.xml
* de.locallangSplit.xml
* locallangCombined.xml

Both contain a label named "myLabel".

Consider this TypoScript:
config.language = de
page = PAGE
page.100 = TEXT
page.100.data = LLL:fileadmin/locallang.xlf:myLabel
page.100.wrap = <p>|</p>
page.200 = TEXT
page.200.data = LLL:fileadmin/locallangSplit.xml:myLabel
page.200.wrap = <p>|</p>
page.210 = TEXT
page.210.data = LLL:fileadmin/locallangCombined.xml:myLabel
page.210.wrap = <p>|</p>

h2. Current result

In FE the English label value will be displayed for XLIFF files.

h2. Expected result

In FE the German label value shall be visible.

h1. Analysis

Version 6.2+ are confirmed to be affected.

h2. Background

The problem does not occur if the file is placed in any of these folders:
* typo3/sysext/
* typo3/ext/
* typo3conf/ext/
* typo3conf/l10n/
* tests/

(This restriction stems from \TYPO3\CMS\Core\Utility\GeneralUtility::llXmlAutoFileName())

h2. XML works

Using XML instead of XLIFF files solves the problem. Both types of XML files work:
* All languages in one file
* Separate files for each language (when proper references are placed in the default language file: @<languageKey index="de">fileadmin/de.locallangSplit.xml</languageKey>@)

This is due to the fact that searching for the split-files happens implicitly in the xml-parser, which is not the case in the xlf-parser.

The XliffParser uses the default implementation in AbstractXmlParser which calls the llXmlAutoFileName() method twice. First with $sameFile = FALSE and then $sameFile = TRUE, so it covers all cases properly.

The only problem remaining therefore is:
llXmlAutoFileName() with $sameFile = TRUE allows the split translation files only within some specific directories. This kills any translation requested from fileadmin.

(Keep in mind to clear the SYSTEM cache whenever you change language files.)