Bug #33882

XliffParser does not allow id-less translation

Added by Kira Backes over 9 years ago. Updated over 9 years ago.

Status:
Rejected
Priority:
Should have
Category:
I18n
Target version:
-
Start date:
2012-02-13
Due date:
% Done:

0%

Estimated time:
PHP Version:
Has patch:
No
Complexity:

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,
                );
#1

Updated by Kira Backes over 9 years ago

  • Project changed from TYPO3 Flow Base Distribution to TYPO3.Flow
#2

Updated by Karsten Dambekalns over 9 years ago

  • Category set to I18n
  • Status changed from New to Rejected
  • Assignee 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 9 years ago

Okay, but then you should throw an exception in case of a missing id attribute?

#4

Updated by Karsten Dambekalns over 9 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.

Also available in: Atom PDF