Bug #35093
closed
Localization in Typoscript via XLIFF
Added by Chris Müller about 12 years ago.
Updated about 9 years ago.
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.
Confirm this - XLIFF localization broken in 4.6 as well.
Added related issue, which happens in fluid translate viewhelper.
- Status changed from New to Accepted
- Status changed from Accepted to Under Review
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
3 related bug-reports + 7 votes on fixing it - would be nice if someone could review the patch from Stefan. :)
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
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
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
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
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
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
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
Patch was reverted and will be repushed.
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
- Status changed from Under Review to Resolved
- % Done changed from 0 to 100
- Status changed from Resolved to Under Review
- 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