#78095Inconsistent behavior loading language labels when using Fluid VS Typoscript
Description
Inconsistent behavior loading language labels when using Fluid VS Typoscript
I encountered an inconsistent behavior when loading a language label from a xlf language file using TypoScript VS Fluid.
Presetting:
I use a language file “locallang.xlf” which has the “source-language” set to “de”. Which means that I want to use German as default language. Furthermore I have an english translation file named “en.locallang.xlf”, which has also set the “source-language” to “de”. The “target-language” is set to “en”.
locallang.xlf:
<?xml version="1.0" encoding="utf-8"?>
<xliff version="1.0">
<file source-language="de" datatype="plaintext" original="messages" date="2013-12-24T09:57:19Z" product-name="test_extension">
<header/>
<body>
<trans-unit id="website.test">
<source>Hallo Welt</source>
</trans-unit>
</body>
</file>
</xliff>
en.locallang.xlf:
<?xml version="1.0" encoding="utf-8"?>
<xliff version="1.0">
<file source-language="de" target-language="en" datatype="plaintext" original="messages" date="2013-12-24T09:57:19Z" product-name="test_extension">
<header/>
<body>
<trans-unit id="website.test">
<source>Hallo Welt</source>
<target>Hello world</target>
</trans-unit>
</body>
</file>
</xliff>
Fluid:
In my Layout “Default.html” I use following code:
<f:translate key="website.test" />
Typoscript:
In my Typoscript file “libs.ts” I use this code:
lib.test = TEXT
lib.test {
value.data = LLL:EXT:test_extension:/Resources/Private/Language/locallang.xlf:website.test
}
Frontend output:
Here I try to explain the various combinations in frontend output for the selected language as well as the used method (Fluid, TypoScript).
1. test:
Language: German
*Method:* Fluid
*Expected output:* Hallo Welt
*Rendered output:* Hallo Welt
*Result:* OK
2. test:
Language: German
*Method:* Typoscript
*Expected output:* Hallo Welt
*Rendered output:* Hallo Welt
*Result:* Seems OK, but Typoscript actually displays the fallback. There is no “de.locallang.xlf” therefore it falls back to “locallang.xlf” which is in this case German. So it seems OK, but actually it isn’t.
3. test:
Language: English
*Method:* Fluid
*Expected output:* Hello world
*Rendered output:* Hello world
*Result:* OK
4. test:
Language: English
*Method:* Typoscript
*Expected output:* Hello world
*Rendered output:* Hallo Welt
*Result:* NOT OK, Typoscript just uses the “locallang.xlf” file, which contains “Hallo Welt”, and does not render the text from “en.locallang.xlf”
Conclusion:
There is a inconsistent behavior when reading a language label using Typoscript VS Fluid. I would like to have Typoscript behave the same as FLUID, because I do not want to have my basic language file “locallang.xlf” in english, but rather in german.
Reviews 0
No change resolves or names this issue in its commit message, and no comment links one.