8000 [Translation] Process multiple segments within a single unit. by timewasted · Pull Request #26247 · symfony/symfony · GitHub
[go: up one dir, main page]

Skip to content

[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

Closed
wants to merge 3 commits into from

Conversation

timewasted
Copy link
Contributor
@timewasted timewasted commented Feb 20, 2018
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.

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.
Copy link
Contributor
@phansys phansys left a 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());
Copy link
Contributor

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.
@nicolas-grekas
Copy link
Member
nicolas-grekas commented Feb 21, 2018

For 3.4, best reviewed ignoring whitespace.
@Nyholm OK for you?

Status: needs review

Copy link
Member
@Nyholm Nyholm left a 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());
Copy link
Contributor

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.
@fabpot
Copy link
Member
fabpot commented Feb 22, 2018

Thank you @timewasted.

fabpot added a commit that referenced this pull request Feb 22, 2018
…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.
@fabpot fabpot closed this Feb 22, 2018
This was referenced Mar 1, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants
0