Project

General

Profile

Actions

Bug #35093

closed

Localization in Typoscript via XLIFF

Added by Chris Müller about 12 years ago. Updated about 9 years ago.

Status:
Closed
Priority:
Should have
Assignee:
-
Category:
TypoScript
Target version:
-
Start date:
2012-03-21
Due date:
% Done:

0%

Estimated time:
TYPO3 Version:
4.7
PHP Version:
5.3
Tags:
Complexity:
Is Regression:
No
Sprint Focus:

Description

In Typoscript you can use the following snippet to localize a string:

10 = TEXT
10 {
value = {LLL:fileadmin/your_path/locallang.xml:your_label}
insertData = 1
}

This works since ages.

But if you want to use XLIFF it doesn't work:

10 = TEXT
10 {
value = {LLL:fileadmin/your_path/locallang.xlf:your_label}
insertData = 1
}

Only the default language is shown. The language in config.language is correct set. I have the two files "locallang.xlf" and "de.locallang.xlf" in this directory.

I recognized it in TYPO3 4.7beta2 but I think it will be also in TYPO3 4.6.


Related issues 1 (0 open1 closed)

Has duplicate TYPO3 Core - Bug #65273: Using XLIFF translation files located in non-extension folders does not workClosedMarkus Klein2015-02-24

Actions
Actions #1

Updated by Viktor Livakivskyi about 12 years ago

Confirm this - XLIFF localization broken in 4.6 as well.
Added related issue, which happens in fluid translate viewhelper.

Actions #2

Updated by Stefan Galinski almost 12 years ago

  • Status changed from New to Accepted

Confirmed!

Actions #3

Updated by Gerrit Code Review about 11 years ago

  • Status changed from Accepted to Under Review

Patch set 2 for branch master has been pushed to the review server.
It is available at https://review.typo3.org/20133

Actions #4

Updated by Stefan Froemken about 11 years ago

I have just added a patch for this, but in sourcecode you can read: "Absolute file reference to locallang-XML file. Must be inside system/global/local extension". So the idea of this method is to NOT have locallang files in fileadmin. My patch breaks this idea and makes it possible.
It's up to the core to decide if fileadmin can be a valid locallang directory. For all others who need this functionality: Have fun with this patch or still wait for a better solution by a core member.

Stefan

Actions #5

Updated by Michael Bakonyi almost 11 years ago

3 related bug-reports + 7 votes on fixing it - would be nice if someone could review the patch from Stefan. :)

Actions #6

Updated by Markus Klein almost 11 years ago

Please read my comment(s) in https://review.typo3.org/9535

Actions #7

Updated by Nikolas Hagelstein over 9 years ago

Any news on that?

Actions #8

Updated by Gerrit Code Review over 9 years ago

Patch set 1 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at http://review.typo3.org/34285

Actions #9

Updated by Markus Klein over 9 years ago

  • Is Regression set to No

Detailed analysis

The thing is fairly complex.

First we have two different file types: xlf and xml
xml allows to have translations in the same file as the original, xlf does not allow this.
Translations from Pootle are always shipped in separate files per language.

For retrieving a translation the system has to check in this order:
  • typo3conf/l10n/<lang>/
  • <lang>.filename.xlf/xml in the same directory as the original file
  • the original file itself (only with xml file type)

The current code is implemented like this

The LocallangXmlParser calls the llXmlAutoFileName() method only once (with $sameFile = FALSE) to cover the first check from above. If the file does not exist it falls back to check 3.
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 problems remaining are therefore:
  • For XML files the second check is missing
  • llXmlAutoFileName() with $sameFile = TRUE allows the split translation files only within some specific directories. This kills any translation requested from fileadmin.
  • The first check is only necessary if the file is really coming from an extension, otherwise there is no translation in this folder
Actions #10

Updated by Gerrit Code Review over 9 years ago

Patch set 2 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at http://review.typo3.org/34285

Actions #11

Updated by Gerrit Code Review over 9 years ago

Patch set 3 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at http://review.typo3.org/34285

Actions #12

Updated by Gerrit Code Review over 9 years ago

Patch set 4 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at http://review.typo3.org/34285

Actions #13

Updated by Gerrit Code Review over 9 years ago

Patch set 5 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at http://review.typo3.org/34285

Actions #14

Updated by Gerrit Code Review about 9 years ago

Patch set 6 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at http://review.typo3.org/34285

Actions #15

Updated by Markus Klein about 9 years ago

Patch was reverted and will be repushed.

Actions #16

Updated by Gerrit Code Review about 9 years ago

Patch set 1 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at http://review.typo3.org/37167

Actions #17

Updated by Mathias Schreiber about 9 years ago

  • Status changed from Under Review to Resolved
  • % Done changed from 0 to 100
Actions #18

Updated by Markus Klein about 9 years ago

  • Status changed from Resolved to Under Review
Actions #19

Updated by Markus Klein about 9 years ago

  • Status changed from Under Review to Closed
  • % Done changed from 100 to 0

Closing this as duplicate/related to #65273.
Please continue any discussion there.

Actions

Also available in: Atom PDF