[BUGFIX] locallangXMLOverride is broken since the switch to XLIFF
authorLars Patrick Heß <larshess@gmail.com>
Thu, 15 Dec 2011 10:22:46 +0000 (11:22 +0100)
committerXavier Perseguers <xavier@typo3.org>
Wed, 21 Dec 2011 15:02:15 +0000 (16:02 +0100)
locallangXMLOverride mechanism does not work anymore since
target language is mixed with the default language.

Change-Id: I435e79d01fcdbd993e0ae47ab15eee745ae39752
Fixes: #32573
Releases: 4.7, 4.6
Reviewed-on: http://review.typo3.org/7467
Reviewed-by: Xavier Perseguers
Tested-by: Xavier Perseguers
t3lib/class.t3lib_div.php
t3lib/l10n/class.t3lib_l10n_factory.php
t3lib/l10n/parser/class.t3lib_l10n_parser_llxml.php
tests/t3lib/l10n/parser/class.t3lib_l10n_parser_llxmlTest.php [new file with mode: 0644]
tests/t3lib/l10n/parser/class.t3lib_l10n_parser_xliffTest.php [new file with mode: 0644]
tests/t3lib/l10n/parser/fixtures/fr.locallang.xlf [new file with mode: 0644]
tests/t3lib/l10n/parser/fixtures/fr.locallang_override.xlf [new file with mode: 0644]
tests/t3lib/l10n/parser/fixtures/locallang.xlf [new file with mode: 0644]
tests/t3lib/l10n/parser/fixtures/locallang.xml [new file with mode: 0644]
tests/t3lib/l10n/parser/fixtures/locallang_override.xlf [new file with mode: 0644]
tests/t3lib/l10n/parser/fixtures/locallang_override.xml [new file with mode: 0644]

index aa2d477..2d927d5 100644 (file)
@@ -4531,6 +4531,9 @@ final class t3lib_div {
                        $validatedPrefix = PATH_typo3 . 'ext/';
                } elseif (self::isFirstPartOfStr($fileRef, PATH_typo3conf . 'ext/')) { // Is local:
                        $validatedPrefix = PATH_typo3conf . 'ext/';
+               } elseif (self::isFirstPartOfStr($fileRef, PATH_site . 'typo3_src/tests/')) { // Is test:
+                       $validatedPrefix = PATH_site . 'typo3_src/tests/';
+                       $location = $validatedPrefix;
                } else {
                        $validatedPrefix = '';
                }
@@ -4545,6 +4548,11 @@ final class t3lib_div {
                        } // Add empty first-entry if not there.
                        list($file_extPath, $file_fileName) = $temp;
 
+                               // If $fileRef is already prefix with "[language key]" then we should return it as this
+                       if (substr($file_fileName, 0, strlen($language) + 1) === $language . '.') {
+                               return $fileRef;
+                       }
+
                                // The filename is prefixed with "[language key]." because it prevents the llxmltranslate tool from detecting it.
                        return $location .
                                        $file_extKey . '/' .
index 9bf7fe6..b1a94e1 100644 (file)
@@ -77,10 +77,11 @@ class t3lib_l10n_Factory implements t3lib_Singleton {
         * @param string $fileReference Input is a file-reference (see t3lib_div::getFileAbsFileName). That file is expected to be a supported locallang file format
         * @param string $languageKey Language key
         * @param string $charset Character set (option); if not set, determined by the language key
-        * @param int $errorMode Error mode (when file could not be found): 0 - syslog entry, 1 - do nothing, 2 - throw an exception
+        * @param int $errorMode Error mode (when file could not be found): 0 - syslog entry, 1 - do nothing, 2 - throw an exception$
+        * @param bool $isLocalizationOverride TRUE if $fileReference is a localization override
         * @return array|bool
         */
-       public function getParsedData($fileReference, $languageKey, $charset, $errorMode) {
+       public function getParsedData($fileReference, $languageKey, $charset, $errorMode, $isLocalizationOverride = FALSE) {
                try {
                        $hash = md5($fileReference . $languageKey . $charset);
                        $this->errorMode = $errorMode;
@@ -119,7 +120,7 @@ class t3lib_l10n_Factory implements t3lib_Singleton {
                        );
 
                                // Override localization
-                       if (isset($GLOBALS['TYPO3_CONF_VARS']['SYS']['locallangXMLOverride'])) {
+                       if (!$isLocalizationOverride && isset($GLOBALS['TYPO3_CONF_VARS']['SYS']['locallangXMLOverride'])) {
                                $this->localizationOverride($fileReference, $languageKey, $charset, $errorMode, $LOCAL_LANG);
                        }
 
@@ -170,7 +171,7 @@ class t3lib_l10n_Factory implements t3lib_Singleton {
                                $languageOverrideFileName = t3lib_div::getFileAbsFileName($overrideFile);
                                $LOCAL_LANG = t3lib_div::array_merge_recursive_overrule(
                                        $LOCAL_LANG,
-                                       $this->getParsedData($languageOverrideFileName, $languageKey, $charset, $errorMode)
+                                       $this->getParsedData($languageOverrideFileName, $languageKey, $charset, $errorMode, TRUE)
                                );
                        }
                }
index b273722..d3e7de0 100644 (file)
@@ -83,12 +83,22 @@ class t3lib_l10n_parser_Llxml extends t3lib_l10n_parser_AbstractXml {
        protected function doParsingFromRootForElement(SimpleXMLElement $root, $element) {
                $bodyOfFileTag = $root->data->languageKey;
 
-               $parsedData = $this->getParsedDataForElement($bodyOfFileTag, $element);
-
                        // Check if the source llxml file contains localized records
                $localizedBodyOfFileTag = $root->data->xpath("languageKey[@index='" . $this->languageKey . "']");
+               if ($element === 'target' && empty($localizedBodyOfFileTag)) {
+                       return array();
+               }
+
+               $parsedData = $this->getParsedDataForElement($bodyOfFileTag, $element);
                if ($element === 'target' && isset($localizedBodyOfFileTag[0]) && $localizedBodyOfFileTag[0] instanceof SimpleXMLElement) {
-                       $parsedData = array_merge($parsedData, $this->getParsedDataForElement($localizedBodyOfFileTag[0], $element));
+                       $parsedDataTarget = $this->getParsedDataForElement($localizedBodyOfFileTag[0], $element);
+                       $mergedData = array_merge($parsedData, $parsedDataTarget);
+
+                       if ($this->languageKey === 'default') {
+                               $parsedData = array_intersect_key($mergedData, $parsedData, $parsedDataTarget);
+                       } else {
+                               $parsedData = array_intersect_key($mergedData, $parsedDataTarget);
+                       }
                }
 
                return $parsedData;
diff --git a/tests/t3lib/l10n/parser/class.t3lib_l10n_parser_llxmlTest.php b/tests/t3lib/l10n/parser/class.t3lib_l10n_parser_llxmlTest.php
new file mode 100644 (file)
index 0000000..d21af21
--- /dev/null
@@ -0,0 +1,159 @@
+<?php
+/***************************************************************
+ *  Copyright notice
+ *
+ *  (c) 2011 Xavier Perseguers <xavier@typo3.org>
+ *  All rights reserved
+ *
+ *  This script is part of the TYPO3 project. The TYPO3 project is
+ *  free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  The GNU General Public License can be found at
+ *  http://www.gnu.org/copyleft/gpl.html.
+ *
+ *  This script is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  This copyright notice MUST APPEAR in all copies of the script!
+ ***************************************************************/
+
+/**
+ * Testcase for class t3lib_l10n_parser_llxml.
+ *
+ * @author Xavier Perseguers <xavier@typo3.org>
+ * @package TYPO3
+ */
+class t3lib_l10n_parser_llxmlTest extends tx_phpunit_testcase {
+
+       /**
+        * @var t3lib_l10n_parser_llxml
+        */
+       protected $parser;
+
+       /**
+        * @var array
+        */
+       protected $locallangXMLOverride;
+
+       /**
+        * @var string
+        */
+       protected $l10nPriority;
+
+       /**
+        * @var array
+        */
+       protected $llxmlFileNames;
+
+       /**
+        * Prepares the environment before running a test.
+        */
+       public function setUp() {
+                       // Backup locallangXMLOverride and localization format priority
+               $this->locallangXMLOverride = $GLOBALS['TYPO3_CONF_VARS']['SYS']['locallangXMLOverride'];
+               $this->l10nPriority = $GLOBALS['TYPO3_CONF_VARS']['SYS']['lang']['format']['priority'];
+
+               $this->parser = t3lib_div::makeInstance('t3lib_l10n_parser_llxml');
+               $this->llxmlFileNames = array(
+                       'locallang' => PATH_site . 'typo3_src/tests/t3lib/l10n/parser/fixtures/locallang.xml',
+                       'locallang_override' => PATH_site . 'typo3_src/tests/t3lib/l10n/parser/fixtures/locallang_override.xml',
+               );
+               $GLOBALS['TYPO3_CONF_VARS']['SYS']['lang']['format']['priority'] = 'xml';
+               t3lib_div::makeInstance('t3lib_l10n_Store')->initialize();
+
+                       // Clear localization cache
+               $GLOBALS['typo3CacheManager']->getCache('t3lib_l10n')->flush();
+       }
+
+       /**
+        * Cleans up the environment after running a test.
+        */
+       public function tearDown() {
+               unset($this->parser);
+
+                       // Restore locallangXMLOverride and localization format priority
+               $GLOBALS['TYPO3_CONF_VARS']['SYS']['locallangXMLOverride'] = $this->locallangXMLOverride;
+               $GLOBALS['TYPO3_CONF_VARS']['SYS']['lang']['format']['priority'] = $this->l10nPriority;
+               t3lib_div::makeInstance('t3lib_l10n_Store')->initialize();
+       }
+
+       /**
+        * @test
+        */
+       public function canParseLlxmlInEnglish() {
+               $LOCAL_LANG = $this->parser->getParsedData($this->llxmlFileNames['locallang'], 'default');
+
+               $this->assertArrayHasKey('default', $LOCAL_LANG, 'default key not found in $LOCAL_LANG');
+
+               $expectedLabels = array(
+                       'label1' => 'This is label #1',
+                       'label2' => 'This is label #2',
+                       'label3' => 'This is label #3',
+               );
+
+               foreach ($expectedLabels as $key => $expectedLabel) {
+                       $this->assertEquals($expectedLabel, $LOCAL_LANG['default'][$key][0]['target']);
+               }
+       }
+
+       /**
+        * @test
+        */
+       public function canParseLlxmlInFrench() {
+               $LOCAL_LANG = $this->parser->getParsedData($this->llxmlFileNames['locallang'], 'fr');
+
+               $this->assertArrayHasKey('fr', $LOCAL_LANG, 'fr key not found in $LOCAL_LANG');
+
+               $expectedLabels = array(
+                       'label1' => 'Ceci est le libellé no. 1',
+                       'label2' => 'Ceci est le libellé no. 2',
+                       'label3' => 'Ceci est le libellé no. 3',
+               );
+
+               foreach ($expectedLabels as $key => $expectedLabel) {
+                       $this->assertEquals($expectedLabel, $LOCAL_LANG['fr'][$key][0]['target']);
+               }
+       }
+
+       /**
+        * @test
+        */
+       public function canOverrideLlxml() {
+               $GLOBALS['TYPO3_CONF_VARS']['SYS']['locallangXMLOverride'][$this->llxmlFileNames['locallang']][] = $this->llxmlFileNames['locallang_override'];
+
+               $LOCAL_LANG = array_merge(
+                       t3lib_div::readLLfile($this->llxmlFileNames['locallang'], 'default'),
+                       t3lib_div::readLLfile($this->llxmlFileNames['locallang'], 'fr')
+               );
+
+               $this->assertArrayHasKey('default', $LOCAL_LANG, 'default key not found in $LOCAL_LANG');
+               $this->assertArrayHasKey('fr', $LOCAL_LANG, 'fr key not found in $LOCAL_LANG');
+
+               $expectedLabels = array(
+                       'default' => array(
+                               'label1' => 'This is my 1st label',
+                               'label2' => 'This is my 2nd label',
+                               'label3' => 'This is label #3',
+                       ),
+                       'fr' => array(
+                               'label1' => 'Ceci est mon 1er libellé',
+                               'label2' => 'Ceci est le libellé no. 2',
+                               'label3' => 'Ceci est mon 3e libellé',
+                       )
+               );
+
+               foreach ($expectedLabels as $languageKey => $expectedLanguageLabels) {
+                       foreach ($expectedLanguageLabels as $key => $expectedLabel) {
+                               $this->assertEquals($expectedLabel, $LOCAL_LANG[$languageKey][$key][0]['target']);
+                       }
+               }
+       }
+
+}
+
+?>
\ No newline at end of file
diff --git a/tests/t3lib/l10n/parser/class.t3lib_l10n_parser_xliffTest.php b/tests/t3lib/l10n/parser/class.t3lib_l10n_parser_xliffTest.php
new file mode 100644 (file)
index 0000000..ac6f4f6
--- /dev/null
@@ -0,0 +1,185 @@
+<?php
+/***************************************************************
+ *  Copyright notice
+ *
+ *  (c) 2011 Xavier Perseguers <xavier@typo3.org>
+ *  All rights reserved
+ *
+ *  This script is part of the TYPO3 project. The TYPO3 project is
+ *  free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  The GNU General Public License can be found at
+ *  http://www.gnu.org/copyleft/gpl.html.
+ *
+ *  This script is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  This copyright notice MUST APPEAR in all copies of the script!
+ ***************************************************************/
+
+/**
+ * Testcase for class t3lib_l10n_parser_xliff.
+ *
+ * @author Xavier Perseguers <xavier@typo3.org>
+ * @package TYPO3
+ */
+class t3lib_l10n_parser_xliffTest extends tx_phpunit_testcase {
+
+       /**
+        * @var t3lib_l10n_parser_xliff
+        */
+       protected $parser;
+
+       /**
+        * @var array
+        */
+       protected $locallangXMLOverride;
+
+       /**
+        * @var string
+        */
+       protected $l10nPriority;
+
+       /**
+        * @var array
+        */
+       protected $xliffFileNames;
+
+       /**
+        * Prepares the environment before running a test.
+        */
+       public function setUp() {
+                       // Backup locallangXMLOverride and localization format priority
+               $this->locallangXMLOverride = $GLOBALS['TYPO3_CONF_VARS']['SYS']['locallangXMLOverride'];
+               $this->l10nPriority = $GLOBALS['TYPO3_CONF_VARS']['SYS']['lang']['format']['priority'];
+
+               $this->parser = t3lib_div::makeInstance('t3lib_l10n_parser_xliff');
+               $this->xliffFileNames = array(
+                       'locallang' => PATH_site . 'typo3_src/tests/t3lib/l10n/parser/fixtures/locallang.xlf',
+                       'locallang_override' => PATH_site . 'typo3_src/tests/t3lib/l10n/parser/fixtures/locallang_override.xlf',
+                       'locallang_override_fr' => PATH_site . 'typo3_src/tests/t3lib/l10n/parser/fixtures/fr.locallang_override.xlf',
+               );
+               $GLOBALS['TYPO3_CONF_VARS']['SYS']['lang']['format']['priority'] = 'xlf';
+               t3lib_div::makeInstance('t3lib_l10n_Store')->initialize();
+
+                       // Clear localization cache
+               $GLOBALS['typo3CacheManager']->getCache('t3lib_l10n')->flush();
+       }
+
+       /**
+        * Cleans up the environment after running a test.
+        */
+       public function tearDown() {
+               unset($this->parser);
+
+                       // Restore locallangXMLOverride and localization format priority
+               $GLOBALS['TYPO3_CONF_VARS']['SYS']['locallangXMLOverride'] = $this->locallangXMLOverride;
+               $GLOBALS['TYPO3_CONF_VARS']['SYS']['lang']['format']['priority'] = $this->l10nPriority;
+               t3lib_div::makeInstance('t3lib_l10n_Store')->initialize();
+       }
+
+       /**
+        * @test
+        */
+       public function canParseXliffInEnglish() {
+               $LOCAL_LANG = $this->parser->getParsedData($this->xliffFileNames['locallang'], 'default');
+
+               $this->assertArrayHasKey('default', $LOCAL_LANG, 'default key not found in $LOCAL_LANG');
+
+               $expectedLabels = array(
+                       'label1' => 'This is label #1',
+                       'label2' => 'This is label #2',
+                       'label3' => 'This is label #3',
+               );
+
+               foreach ($expectedLabels as $key => $expectedLabel) {
+                       $this->assertEquals($expectedLabel, $LOCAL_LANG['default'][$key][0]['target']);
+               }
+       }
+
+       /**
+        * @test
+        */
+       public function canParseXliffInFrench() {
+               $LOCAL_LANG = $this->parser->getParsedData($this->xliffFileNames['locallang'], 'fr');
+
+               $this->assertArrayHasKey('fr', $LOCAL_LANG, 'fr key not found in $LOCAL_LANG');
+
+               $expectedLabels = array(
+                       'label1' => 'Ceci est le libellé no. 1',
+                       'label2' => 'Ceci est le libellé no. 2',
+                       'label3' => 'Ceci est le libellé no. 3',
+               );
+
+               foreach ($expectedLabels as $key => $expectedLabel) {
+                       $this->assertEquals($expectedLabel, $LOCAL_LANG['fr'][$key][0]['target']);
+               }
+       }
+
+       /**
+        * @test
+        */
+       public function canOverrideXliff() {
+               $GLOBALS['TYPO3_CONF_VARS']['SYS']['locallangXMLOverride'][$this->xliffFileNames['locallang']][] = $this->xliffFileNames['locallang_override'];
+               $GLOBALS['TYPO3_CONF_VARS']['SYS']['locallangXMLOverride']['fr'][$this->xliffFileNames['locallang']][] = $this->xliffFileNames['locallang_override_fr'];
+
+               $LOCAL_LANG = array_merge(
+                       t3lib_div::readLLfile($this->xliffFileNames['locallang'], 'default'),
+                       t3lib_div::readLLfile($this->xliffFileNames['locallang'], 'fr')
+               );
+
+               $this->assertArrayHasKey('default', $LOCAL_LANG, 'default key not found in $LOCAL_LANG');
+               $this->assertArrayHasKey('fr', $LOCAL_LANG, 'fr key not found in $LOCAL_LANG');
+
+               $expectedLabels = array(
+                       'default' => array(
+                               'label1' => 'This is my 1st label',
+                               'label2' => 'This is my 2nd label',
+                               'label3' => 'This is label #3',
+                       ),
+                       'fr' => array(
+                               'label1' => 'Ceci est mon 1er libellé',
+                               'label2' => 'Ceci est le libellé no. 2',
+                               'label3' => 'Ceci est mon 3e libellé',
+                       )
+               );
+
+               foreach ($expectedLabels as $languageKey => $expectedLanguageLabels) {
+                       foreach ($expectedLanguageLabels as $key => $expectedLabel) {
+                               $this->assertEquals($expectedLabel, $LOCAL_LANG[$languageKey][$key][0]['target']);
+                       }
+               }
+       }
+
+       /**
+        * This test will make sure method t3lib_div::llXmlAutoFileName() will not prefix twice the
+        * language key to the localization file.
+        *
+        * @test
+        */
+       public function canOverrideXliffWithFrenchOnly() {
+               $GLOBALS['TYPO3_CONF_VARS']['SYS']['locallangXMLOverride']['fr'][$this->xliffFileNames['locallang']][] = $this->xliffFileNames['locallang_override_fr'];
+
+               $LOCAL_LANG = t3lib_div::readLLfile($this->xliffFileNames['locallang'], 'fr');
+
+               $this->assertArrayHasKey('fr', $LOCAL_LANG, 'fr key not found in $LOCAL_LANG');
+
+               $expectedLabels = array(
+                       'label1' => 'Ceci est mon 1er libellé',
+                       'label2' => 'Ceci est le libellé no. 2',
+                       'label3' => 'Ceci est mon 3e libellé',
+               );
+
+               foreach ($expectedLabels as $key => $expectedLabel) {
+                       $this->assertEquals($expectedLabel, $LOCAL_LANG['fr'][$key][0]['target']);
+               }
+       }
+
+}
+
+?>
\ No newline at end of file
diff --git a/tests/t3lib/l10n/parser/fixtures/fr.locallang.xlf b/tests/t3lib/l10n/parser/fixtures/fr.locallang.xlf
new file mode 100644 (file)
index 0000000..0401714
--- /dev/null
@@ -0,0 +1,20 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<xliff version="1.0">
+       <file source-language="en" datatype="plaintext" original="messages" date="2011-12-21T11:57:33Z" product-name="tests" target-language="fr">
+               <header/>
+               <body>
+                       <trans-unit id="label1" xml:space="preserve">
+                               <source>This is label #1</source>
+                               <target>Ceci est le libellé no. 1</target>
+                       </trans-unit>
+                       <trans-unit id="label2" xml:space="preserve">
+                               <source>This is label #2</source>
+                               <target>Ceci est le libellé no. 2</target>
+                       </trans-unit>
+                       <trans-unit id="label3" xml:space="preserve">
+                               <source>This is label #3</source>
+                               <target>Ceci est le libellé no. 3</target>
+                       </trans-unit>
+               </body>
+       </file>
+</xliff>
\ No newline at end of file
diff --git a/tests/t3lib/l10n/parser/fixtures/fr.locallang_override.xlf b/tests/t3lib/l10n/parser/fixtures/fr.locallang_override.xlf
new file mode 100644 (file)
index 0000000..ccf1920
--- /dev/null
@@ -0,0 +1,16 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<xliff version="1.0">
+       <file source-language="en" datatype="plaintext" original="messages" date="2011-12-21T11:57:33Z" product-name="tests" target-language="fr">
+               <header/>
+               <body>
+                       <trans-unit id="label1" xml:space="preserve">
+                               <source>This is label #1</source>
+                               <target>Ceci est mon 1er libellé</target>
+                       </trans-unit>
+                       <trans-unit id="label3" xml:space="preserve">
+                               <source>This is label #3</source>
+                               <target>Ceci est mon 3e libellé</target>
+                       </trans-unit>
+               </body>
+       </file>
+</xliff>
\ No newline at end of file
diff --git a/tests/t3lib/l10n/parser/fixtures/locallang.xlf b/tests/t3lib/l10n/parser/fixtures/locallang.xlf
new file mode 100644 (file)
index 0000000..06c5639
--- /dev/null
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<xliff version="1.0">
+       <file source-language="en" datatype="plaintext" original="messages" date="2011-12-21T11:57:33Z" product-name="tests">
+               <header/>
+               <body>
+                       <trans-unit id="label1" xml:space="preserve">
+                               <source>This is label #1</source>
+                       </trans-unit>
+                       <trans-unit id="label2" xml:space="preserve">
+                               <source>This is label #2</source>
+                       </trans-unit>
+                       <trans-unit id="label3" xml:space="preserve">
+                               <source>This is label #3</source>
+                       </trans-unit>
+               </body>
+       </file>
+</xliff>
\ No newline at end of file
diff --git a/tests/t3lib/l10n/parser/fixtures/locallang.xml b/tests/t3lib/l10n/parser/fixtures/locallang.xml
new file mode 100644 (file)
index 0000000..a5d7543
--- /dev/null
@@ -0,0 +1,20 @@
+<?xml version="1.0" encoding="utf-8" standalone="yes" ?>
+<T3locallang>
+       <meta type="array">
+               <description>Fixture labels for unit tests.</description>
+               <type>module</type>
+       </meta>
+       <data type="array">
+               <languageKey index="default" type="array">
+                       <label index="label1">This is label #1</label>
+                       <label index="label2">This is label #2</label>
+                       <label index="label3">This is label #3</label>
+               </languageKey>
+
+               <languageKey index="fr" type="array">
+                       <label index="label1">Ceci est le libellé no. 1</label>
+                       <label index="label2">Ceci est le libellé no. 2</label>
+                       <label index="label3">Ceci est le libellé no. 3</label>
+               </languageKey>
+       </data>
+</T3locallang>
\ No newline at end of file
diff --git a/tests/t3lib/l10n/parser/fixtures/locallang_override.xlf b/tests/t3lib/l10n/parser/fixtures/locallang_override.xlf
new file mode 100644 (file)
index 0000000..568de52
--- /dev/null
@@ -0,0 +1,14 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<xliff version="1.0">
+       <file source-language="en" datatype="plaintext" original="messages" date="2011-12-21T11:57:33Z" product-name="tests">
+               <header/>
+               <body>
+                       <trans-unit id="label1" xml:space="preserve">
+                               <source>This is my 1st label</source>
+                       </trans-unit>
+                       <trans-unit id="label2" xml:space="preserve">
+                               <source>This is my 2nd label</source>
+                       </trans-unit>
+               </body>
+       </file>
+</xliff>
\ No newline at end of file
diff --git a/tests/t3lib/l10n/parser/fixtures/locallang_override.xml b/tests/t3lib/l10n/parser/fixtures/locallang_override.xml
new file mode 100644 (file)
index 0000000..d719f38
--- /dev/null
@@ -0,0 +1,18 @@
+<?xml version="1.0" encoding="utf-8" standalone="yes" ?>
+<T3locallang>
+       <meta type="array">
+               <description>Fixture labels for unit tests.</description>
+               <type>module</type>
+       </meta>
+       <data type="array">
+               <languageKey index="default" type="array">
+                       <label index="label1">This is my 1st label</label>
+                       <label index="label2">This is my 2nd label</label>
+               </languageKey>
+
+               <languageKey index="fr" type="array">
+                       <label index="label1">Ceci est mon 1er libellé</label>
+                       <label index="label3">Ceci est mon 3e libellé</label>
+               </languageKey>
+       </data>
+</T3locallang>
\ No newline at end of file