[BUGFIX] Externally-referenced ll-XML files are not parsed
authorXavier Perseguers <xavier@typo3.org>
Mon, 29 Aug 2011 07:41:24 +0000 (09:41 +0200)
committerXavier Perseguers <xavier@typo3.org>
Tue, 30 Aug 2011 08:34:45 +0000 (10:34 +0200)
It is not possible to load an externally-referenced localization file
as explained in the documentation:

<languageKey index="fr">EXT:yourext/path/to/fr.locallang.xml</languageKey>

Change-Id: I2461a77c98779165bf6a39b0d73fdda4984a1399
Fixes: #29313
Releases: 4.6
Reviewed-on: http://review.typo3.org/4651
Reviewed-by: Dominique Feyer
Tested-by: Dominique Feyer
Reviewed-by: Xavier Perseguers
Tested-by: Xavier Perseguers
t3lib/l10n/parser/class.t3lib_l10n_parser_llxml.php

index e86d70a..9c7a53a 100644 (file)
@@ -104,6 +104,14 @@ class t3lib_l10n_parser_Llxml extends t3lib_l10n_parser_AbstractXml {
        protected function _getParsedData(SimpleXMLElement $bodyOfFileTag, $element) {
                $parsedData = array();
 
+               if (count($bodyOfFileTag->children()) == 0) {
+                               // Check for externally-referenced resource:
+                               // <languageKey index="fr">EXT:yourext/path/to/localized/locallang.xml</languageKey>
+                       $reference = sprintf('%s', $bodyOfFileTag);
+                       if (substr($reference, -4) === '.xml') {
+                               return $this->getParsedTargetData(t3lib_div::getFileAbsFileName($reference));
+                       }
+               }
                foreach ($bodyOfFileTag->children() as $translationElement) {
                        if ($translationElement->getName() === 'label') {
                                        // If restype would be set, it could be metadata from Gettext to XLIFF conversion (and we don't need this data)