Bug #65273

Using XLIFF translation files located in non-extension folders does not work

Added by Markus Klein almost 5 years ago. Updated over 1 year ago.

Status:
Closed
Priority:
Must have
Assignee:
Category:
Localization
Target version:
Start date:
2015-02-24
Due date:
% Done:

100%

TYPO3 Version:
6.2
PHP Version:
Tags:
Complexity:
medium
Is Regression:
Yes
Sprint Focus:

Description

This is a summary ticket of multiple bug reports.

The problem

Setup

Consider a those files in /fileadmin:
  • locallang.xlf
  • de.locallang.xlf
  • locallangSplit.xml
  • de.locallangSplit.xml
  • locallangCombined.xml

Both contain a label named "myLabel".

Consider this TypoScript:

config.language = de
page = PAGE
page.100 = TEXT
page.100.data = LLL:fileadmin/locallang.xlf:myLabel
page.100.wrap = <p>|</p>
page.200 = TEXT
page.200.data = LLL:fileadmin/locallangSplit.xml:myLabel
page.200.wrap = <p>|</p>
page.210 = TEXT
page.210.data = LLL:fileadmin/locallangCombined.xml:myLabel
page.210.wrap = <p>|</p>

Current result

In FE the English label value will be displayed for XLIFF files.

Expected result

In FE the German label value shall be visible.

Analysis

Version 6.2+ are confirmed to be affected.

Background

The problem does not occur if the file is placed in any of these folders:
  • typo3/sysext/
  • typo3/ext/
  • typo3conf/ext/
  • typo3conf/l10n/
  • tests/

(This restriction stems from \TYPO3\CMS\Core\Utility\GeneralUtility::llXmlAutoFileName())

XML works

Using XML instead of XLIFF files solves the problem. Both types of XML files work:
  • All languages in one file
  • Separate files for each language (when proper references are placed in the default language file: <languageKey index="de">fileadmin/de.locallangSplit.xml</languageKey>)

This is due to the fact that searching for the split-files happens implicitly in the xml-parser, which is not the case in the xlf-parser.

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 only problem remaining therefore is:
llXmlAutoFileName() with $sameFile = TRUE allows the split translation files only within some specific directories. This kills any translation requested from fileadmin.

(Keep in mind to clear the SYSTEM cache whenever you change language files.)

locallang.tgz - Example locallang files (733 Bytes) Markus Klein, 2015-02-24 16:36


Related issues

Duplicates TYPO3 Core - Bug #34728: llXmlAutoFilename will never find localized files in l10n path Closed 2012-03-10
Duplicates TYPO3 Core - Bug #35093: Localization in Typoscript via XLIFF Closed 2012-03-21
Duplicates TYPO3 Core - Feature #47172: Permit custom locations for localization files (XLIFF file handling in llXmlAutoFileName) Closed 2013-04-12

Associated revisions

Revision 7fdfdff8 (diff)
Added by Markus Klein almost 5 years ago

[BUGFIX] Properly handle XLF translation file detection

The GeneralUtility::llXmlAutoFileName() method will now also correctly
handle paths to files that are not placed within a known directory
(ext, sysext, etc.) if the call is made with $sameFile = TRUE.
This allows placing language files in arbitrary storage.

This change finally re-enables the usage of locallang files in TypoScript
or f:translate-ViewHelpers which use the XLIFF format and are not placed
within an extension.
This has always been working with files in the XML format.

Resolves: #65273
Releases: master, 6.2
Change-Id: Ibb647cea32a9fc04e9dfdf707a5e8690ad399d5c
Reviewed-on: http://review.typo3.org/37167
Reviewed-by: Oliver Hader <>
Tested-by: Oliver Hader <>
Reviewed-by: Helmut Hummel <>
Tested-by: Helmut Hummel <>

Revision 64cf5ee5 (diff)
Added by Markus Klein almost 5 years ago

[BUGFIX] Properly handle XLF translation file detection

The GeneralUtility::llXmlAutoFileName() method will now also correctly
handle paths to files that are not placed within a known directory
(ext, sysext, etc.) if the call is made with $sameFile = TRUE.
This allows placing language files in arbitrary storage.

This change finally re-enables the usage of locallang files in TypoScript
or f:translate-ViewHelpers which use the XLIFF format and are not placed
within an extension.
This has always been working with files in the XML format.

Resolves: #65273
Releases: master, 6.2
Change-Id: Ibb647cea32a9fc04e9dfdf707a5e8690ad399d5c
Reviewed-on: http://review.typo3.org/37475
Reviewed-by: Markus Klein <>
Tested-by: Markus Klein <>

History

#1 Updated by Markus Klein almost 5 years ago

  • Status changed from Accepted to Closed

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

#2 Updated by Peter Kraume almost 5 years ago

I think there went something wrong. You just closed #65273 as well ;)

#3 Updated by Markus Klein almost 5 years ago

  • Category changed from Backend API to Localization
  • Status changed from Closed to Accepted
  • Complexity changed from hard to medium

Indeed... ;-)

#4 Updated by Gerrit Code Review almost 5 years ago

  • Status changed from Accepted to Under Review

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/37167

#5 Updated by Markus Klein almost 5 years ago

  • Description updated (diff)

#6 Updated by Gerrit Code Review almost 5 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/37167

#7 Updated by Gerrit Code Review almost 5 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/37167

#8 Updated by Markus Klein almost 5 years ago

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

#9 Updated by Gerrit Code Review almost 5 years ago

  • Status changed from Resolved to Under Review

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

#10 Updated by Gerrit Code Review almost 5 years ago

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

#11 Updated by Markus Klein almost 5 years ago

  • Status changed from Under Review to Resolved

#12 Updated by Benni Mack over 1 year ago

  • Status changed from Resolved to Closed

Also available in: Atom PDF