Skip to content
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

fix(compiler): i18n - ignore alt-trans tags in XLIFF 1.2 #33450

Closed

Conversation

petebacondarwin
Copy link
Member

The parser was accidentally reading the target tag
below the alt-trans target and overriding the correct
target tag.

(This already worked in $localize but a test has been
added to confirm.)

Fixes #33161


This needs to be merged to patch as well, but I don't think will go cleanly because of the $localize test.
So I will create a new PR for patch once this has been approved.

@petebacondarwin petebacondarwin added action: review The PR is still awaiting reviews from at least one requested reviewer area: i18n target: major This PR is targeted for the next major release area: compiler Issues related to `ngc`, Angular's template compiler labels Oct 28, 2019
@petebacondarwin petebacondarwin requested review from a team as code owners October 28, 2019 20:22
@ngbot ngbot bot modified the milestone: needsTriage Oct 28, 2019
Copy link
Contributor

@AndrewKushnir AndrewKushnir left a comment

Choose a reason for hiding this comment

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

LGTM 👍

@AndrewKushnir AndrewKushnir removed the action: review The PR is still awaiting reviews from at least one requested reviewer label Oct 28, 2019
@ocombe
Copy link
Contributor

ocombe commented Oct 29, 2019

I don't think the right approach is to ignore alt-trans, it should be to ignore any target tag that isn't a direct descendant of "trans-unit" (if it is in fact always a direct descendant? that's to confirm)

@petebacondarwin
Copy link
Member Author

petebacondarwin commented Oct 29, 2019

@ocombe - I agree that the best way is to only consider trans-unit's target tags. This is how the new $localize XLIFF 1.2 translation loader does it, and is why the test added here works already.

But for the old Xliff parser, there was already an approach of ignoring certain tags, e.g. source and seg-source. Given that these parsers will be deprecated at some point I don't see the benefit in a big rewrite of those to follow a different approach when this simple fix suffices.

It is the case that the target tags that we are interested in must always be direct child (not even an indirect descendant) of trans-unit.

The parser was accidentally reading the `target` tag
below the `alt-trans` target and overriding the correct
`target` tag.

(This already worked in `$localize` but a test has been
added to confirm.)

Fixes angular#33161
@AndrewKushnir
Copy link
Contributor

VE Presubmit

@AndrewKushnir AndrewKushnir added action: presubmit The PR is in need of a google3 presubmit and removed action: presubmit The PR is in need of a google3 presubmit labels Oct 29, 2019
matsko pushed a commit to matsko/angular that referenced this pull request Oct 30, 2019
…3450)

The parser was accidentally reading the `target` tag
below the `alt-trans` target and overriding the correct
`target` tag.

(This already worked in `$localize` but a test has been
added to confirm.)

Fixes angular#33161

PR Close angular#33450
@petebacondarwin petebacondarwin deleted the i18n-alt-trans branch October 30, 2019 21:28
mohaxspb pushed a commit to mohaxspb/angular that referenced this pull request Nov 7, 2019
…3450)

The parser was accidentally reading the `target` tag
below the `alt-trans` target and overriding the correct
`target` tag.

(This already worked in `$localize` but a test has been
added to confirm.)

Fixes angular#33161

PR Close angular#33450
mohaxspb pushed a commit to mohaxspb/angular that referenced this pull request Nov 7, 2019
…3450)

The parser was accidentally reading the `target` tag
below the `alt-trans` target and overriding the correct
`target` tag.

(This already worked in `$localize` but a test has been
added to confirm.)

Fixes angular#33161

PR Close angular#33450
@angular-automatic-lock-bot
Copy link

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.

@angular-automatic-lock-bot angular-automatic-lock-bot bot locked and limited conversation to collaborators Nov 30, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
action: merge The PR is ready for merge by the caretaker area: compiler Issues related to `ngc`, Angular's template compiler area: i18n cla: yes target: major This PR is targeted for the next major release
Projects
None yet
Development

Successfully merging this pull request may close these issues.

i18n xlf alt-trans tag is used instead of target
4 participants