Bug #33882
XliffParser does not allow id-less translation
Status: | Rejected | Start date: | 2012-02-13 | |
---|---|---|---|---|
Priority: | Should have | Due date: | ||
Assigned To: | Karsten Dambekalns | % Done: | 0% |
|
Category: | I18n | |||
Target version: | - | |||
PHP Version: | Complexity: | |||
Has patch: | No | Affected Flow version: | Git master |
Description
If I want to translate completely without IDs I’m still forced to add IDs in the translation .xlf, because the id-less translation entries are overwritten at the following code (line 47 TYPO3.FLOW3/Classes/I18n/Xliff/XliffParser.php):
$parsedData['translationUnits'][(string)$translationElement['id']][0] = array( 'source' => (string)$translationElement->source, 'target' => (string)$translationElement->target, );
This is fixed by replacing the previous code with the following:
$translationElementId = (string)$translationElement['id']; if ($translationElementId === '') { $translationElementId = uniqid(); } $parsedData['translationUnits'][$translationElementId][0] = array( 'source' => (string)$translationElement->source, 'target' => (string)$translationElement->target, );
History
#1 Updated by Kira Backes over 3 years ago
- Project changed from TYPO3 Flow Base Distribution to TYPO3.Flow
#2 Updated by Karsten Dambekalns over 3 years ago
- Category set to I18n
- Status changed from New to Rejected
- Assigned To set to Karsten Dambekalns
- Has patch set to No
This will never change, as XLIFF requires id attributes to be present. Plus, id-based translation is recommended as it is more reliable and distinctive.
#3 Updated by Kira Backes over 3 years ago
Okay, but then you should throw an exception in case of a missing id attribute?
#4 Updated by Karsten Dambekalns over 3 years ago
Kira Backes wrote:
Okay, but then you should throw an exception in case of a missing id attribute?
Good point, I created #33971 for that.