Project

General

Profile

Actions

Bug #78095

closed

Inconsistent behavior loading language labels when using Fluid VS Typoscript

Added by Klaus Hörmann-Engl about 8 years ago. Updated over 7 years ago.

Status:
Closed
Priority:
Should have
Assignee:
-
Category:
Localization
Target version:
-
Start date:
2016-09-28
Due date:
% Done:

0%

Estimated time:
TYPO3 Version:
7
PHP Version:
5.6
Tags:
Complexity:
Is Regression:
No
Sprint Focus:

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.


Related issues 1 (0 open1 closed)

Related to TYPO3 Core - Bug #74380: TypoScript interpret XLF wrong for Default-Language (german) and englishClosed2016-03-06

Actions
Actions #1

Updated by Mathias Brodala about 8 years ago

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.

This is not possible since TYPO3 will always assume English as default language.

Actions #2

Updated by Klaus Hörmann-Engl about 8 years ago

But using FLUID it works. Only using Typoscript it does not.
Is there no way around it?

Why would I want to have this?
Most of the time (about 99%) we develop websites for german users. This means, that the default language is german. When the customer is about to enter some translation, I would like to hand him a "en.locallang.xlf" or a "sk.locallang.xlf" for translation, where the <source> tags contain the german original text.
Would I have english as default language, german would be a translation (de.locallang.xlf). But as a not native speaker I am not capable of knowing all the right translations in english, so that I could possibly get my "locallang.xlf" basic language file complete.

IMHO this should be possible. FLUID can make it happen.

Actions #3

Updated by Mathias Brodala about 8 years ago

I understand where you are coming from and would agree for content created by editors (e.g. in the TYPO3 backend) but for resource-based translations usually created by developers having English as default is perfectly fine IMO.

In any case I cannot decide whether this is a bug or missing feature in TypoScript/TYPO3.

Actions #4

Updated by Klaus Hörmann-Engl about 8 years ago

I agree with your statement, that deciding whether its a Bug or a Feature is not clear. Could be either one.

About the content thing, I have a other opinion. The translations files are created by a developer, that is correct. But the translations for the elements are coming from the client/editor. I am only bilingual, and not capable of any other language than german or english. So how would you suggest to fill for example a French translation file (fr.locallang.xlf) without speaking french, or even without knowing the exact english translations for the german terms.

Again I think this is a client/editor content. Not in a page/content element kind of way, but it is something the client must provide.

Actions #5

Updated by Nicole Cordes about 8 years ago

  • Status changed from New to Needs Feedback

Hi Klaus,

Can you please try to rename your xlf files according to the TYPO3 standard -> use locallang.xlf for English labels an de.locallang.xlf for the German ones. Please tell the result of your TypoScript and Fluid output.

Actions #6

Updated by Klaus Hörmann-Engl about 8 years ago

The setup you (Nicole Cordes) describe ist the one I had before changing the default language to "German". Therefore it worked in Fluid and TypoScript.
But my point is, that Fluid also works when you change the default language to "German". But Typoscript does not.
So I suggest to have a consistency here when looking at Fluid and Typoscript.

Actions #7

Updated by Alexander Opitz almost 8 years ago

  • Status changed from Needs Feedback to New
Actions #8

Updated by Riccardo De Contardi over 7 years ago

  • Status changed from New to Closed

Hello Klaus, I am really sorry but I close your issue.

As I wrote here https://forge.typo3.org/issues/74380#note-6 the official documentation
https://docs.typo3.org/typo3cms/CoreApiReference/Internationalization/Introduction/Index.html confirms that the "default" locallang.xlf file must always be in english; en.locallang.xlf is not allowed.

And even if you make the modifications reported in the comments of that issue to make "de" your "default" language, you might find inconsitencies later.

If you think that this is the wrong decision please reopen this issue or open a new issue with a reference to this one. Thank you.

Actions

Also available in: Atom PDF