Skip to content

[Translation] XLIFF 2.0 read support #12853

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 5 commits into from

Conversation

xphere
Copy link
Contributor

@xphere xphere commented Dec 4, 2014

Q A
Bug fix? yes
New feature? no
BC breaks? no
Deprecations? no
Tests pass? yes
Fixed tickets #11853
License MIT
  • added XLIFF v2.0 support in XliffFileLoader.
  • detects XLIFF version automatically from version or xmlns attributes.
  • throw exception if XLIFF version does not exist.

Matches XLIFF 1.2 support, except that notes are not loaded now.
This is because they're not tied to a single translation (segment) anymore, but to a group of them (unit) or a whole file.

*/
private function getVersion(\DOMDocument $dom)
{
$versionNumber = $this->getVersionNumber($dom);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You don't handle an UnexpectedValueException that might be thrown in getVersionNumber() neither here or in the load() method.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure, my bad!
This should throw a InvalidArgumentException so we can catch on load method for better message readability.
Easy fix. Thank you!

@xphere xphere force-pushed the xliff-2.0-support branch 3 times, most recently from bf7023b to a8d0d81 Compare December 5, 2014 12:34
@@ -11,6 +11,8 @@

namespace Symfony\Component\Translation\Loader;

use DOMDocument;
use InvalidArgumentException;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These use statements should be removed.

@xphere xphere force-pushed the xliff-2.0-support branch from a8d0d81 to 9fc1da6 Compare December 8, 2014 19:19
@xphere
Copy link
Contributor Author

xphere commented Dec 8, 2014

All comments by @xabbuh fixed, thanks for pointing out!
I'm concerned if the design is correct and if this provides the desired functionality.

@stof
Copy link
Member

stof commented Jan 3, 2015

I don't like the current architecture using version classes:

  • these classes are named Version, but they are not versions at all. They are extractors
  • I don't think it is worth introducing new classes for that. We could simply have extractXliff1 and extractXliff2 in the XliffFileLoader

And can you rebase your work on top of the current 2.7 branch ? It conflicts with the current codebase (which also means that tests will not run when updating your branch with new changes if conflicts are not fixed)

@xphere xphere force-pushed the xliff-2.0-support branch from a1e5ac8 to 0971c65 Compare January 9, 2015 09:12
@stof
Copy link
Member

stof commented Jan 18, 2015

@xphere it is a good idea to comment when you update the PR, because we are not notified when new commits are added in a PR. Otherwise, there is a high chance that we won't review the PR again, just because we don't know there is a need for that.

@stof
Copy link
Member

stof commented Jan 18, 2015

and can you rework your implementation based on my previous review ?

@xphere
Copy link
Contributor Author

xphere commented Jan 18, 2015

@stof sure, sorry, I did rebase on 2.7 branch, but still need to relocate versions into extractor methods. Will do as soon as I've some spare time.

@aitboudad
Copy link
Contributor

@xphere any progress 😄 ?

@aitboudad
Copy link
Contributor

@xphere interested in updating this PR? If not I could try work on it.

@aitboudad
Copy link
Contributor

closed in favor of #15717

@aitboudad aitboudad closed this Sep 7, 2015
aitboudad added a commit that referenced this pull request Sep 16, 2015
… aitboudad)

This PR was merged into the 2.8 branch.

Discussion
----------

[Translator][Loader] added XLIFF 2.0 support.

| Q             | A
| ------------- | ---
| Bug fix?      | no
| New feature?  | yes
| BC breaks?    | no
| Deprecations? | no
| Fixed tickets  | #11853, #12853
| Tests pass?   | yes
| License       | MIT

Commits
-------

0c24d55 [Translation][Dumper] added XLIFF 2.0 support.
7af4fc7 [XLIFF 2.0] added support for target attributes.
ace6042 apply some fixes.
ce540ae update changelog.
ff5d6a3 [Translation][Loader] added XLIFF 2.0 support.
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.

5 participants