-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
[Translation] Process multiple segments within a single unit. #26247
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Xliff 2.0 supports multiple segments within a single unit, but the loader was only processing the first segment. The loader will now correctly process all segments within a unit.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Status: Needs work.
$resource = __DIR__.'/../fixtures/resources-2.0-multi-segment-unit.xlf'; | ||
$catalog = $loader->load($resource, 'en', 'domain1'); | ||
|
||
$this->assertEquals('en', $catalog->getLocale()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please, whenever possible, use assertSame()
instead.
When performing tests, prefer using assertSame() over assertEquals() where possible.
For 3.4, best reviewed ignoring whitespace. Status: needs review |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
According to specification you may have one or more segments in a unit
. The implementation looks good.
|
||
$this->assertSame('en', $catalog->getLocale()); | ||
$this->assertEquals(array(new FileResource($resource)), $catalog->getResources()); | ||
$this->assertSame(array(), libxml_get_errors()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
IMO, $this->assertFalse(libxml_get_last_error());
would be better.
Instead of checking libxml_get_errors() for an empty array, we should check libxml_get_last_error() for false to make the intent of the assertion more clear.
Thank you @timewasted. |
…it. (timewasted) This PR was submitted for the master branch but it was squashed and merged into the 3.4 branch instead (closes #26247). Discussion ---------- [Translation] Process multiple segments within a single unit. | Q | A | ------------- | --- | Branch? | 3.4 | Bug fix? | yes | New feature? | no | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | | License | MIT | Doc PR | Xliff 2.0 supports multiple segments within a single unit, but the loader was only processing the first segment. The loader will now correctly process all segments within a unit. Commits ------- ac5d01f [Translation] Process multiple segments within a single unit.
Xliff 2.0 supports multiple segments within a single unit, but the
loader was only processing the first segment. The loader will now
correctly process all segments within a unit.