Bug #35093

Localization in Typoscript via XLIFF

Added by Chris Müller almost 8 years ago. Updated almost 5 years ago.

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

0%

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

Duplicated by TYPO3 Core - Bug #65273: Using XLIFF translation files located in non-extension folders does not work Closed 2015-02-24

Associated revisions

Revision 81ec05a3 (diff)
Added by Mathias Schreiber almost 5 years ago

[BUGFIX] Properly handle 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, test etc.) if the call is made with $sameFile = TRUE.

This allows placing language files in storages like fileadmin.

Resolves: #35093
Resolves: #34728
Releases: master, 6.2
Change-Id: Ic5901c3fa98233978abf26db377666dade16f8e6
Reviewed-on: http://review.typo3.org/34285
Reviewed-by: Gernot Ploiner <>
Tested-by: Gernot Ploiner <>
Reviewed-by: Markus Klein <>
Tested-by: Markus Klein <>

History

#1 Updated by Viktor Livakivskyi almost 8 years ago

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

#2 Updated by Stefan Galinski over 7 years ago

  • Status changed from New to Accepted

Confirmed!

#3 Updated by Gerrit Code Review almost 7 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

#4 Updated by Stefan Froemken almost 7 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

#5 Updated by Michael Bakonyi over 6 years ago

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

#6 Updated by Markus Klein over 6 years ago

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

#7 Updated by Nikolas Hagelstein over 5 years ago

Any news on that?

#8 Updated by Gerrit Code Review over 5 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

#9 Updated by Markus Klein over 5 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

#10 Updated by Gerrit Code Review over 5 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

#11 Updated by Gerrit Code Review over 5 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

#12 Updated by Gerrit Code Review over 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/34285

#13 Updated by Gerrit Code Review about 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/34285

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

#15 Updated by Markus Klein almost 5 years ago

Patch was reverted and will be repushed.

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

#17 Updated by Mathias Schreiber almost 5 years ago

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

#18 Updated by Markus Klein almost 5 years ago

  • Status changed from Resolved to Under Review

#19 Updated by Markus Klein almost 5 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.

Also available in: Atom PDF