-
Notifications
You must be signed in to change notification settings - Fork 25.2k
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): support i18n interpolated only attribute bindings #43815
fix(compiler): support i18n interpolated only attribute bindings #43815
Conversation
c2a00d3
to
999e342
Compare
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.
Looks great, thanks Pete 👍
Just left a couple comments + it might be great to add an acceptance test as well (packages/core/test/acceptance/i18n_spec.ts).
...st/compliance/test_cases/r3_view_compiler_i18n/element_attributes/interpolated_attributes.ts
Outdated
Show resolved
Hide resolved
999e342
to
1b10246
Compare
@AndrewKushnir - I added the tests and comments - PTAL - and can you run a presubmit? |
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.
@petebacondarwin FYI I've left a couple comments and started a presubmit (I'd also need to verify extraction mechanisms separately).
...st/compliance/test_cases/r3_view_compiler_i18n/element_attributes/interpolated_attributes.ts
Show resolved
Hide resolved
While fully dynamic bound properties (and attributes) cannot be marked for localization, properties that only contain interpolation can. This commit ensure that attribute bindings that only contain interpolation can also be marked for localization. Closes angular#43260
1b10246
to
61a3efa
Compare
@petebacondarwin FYI presubmits went well and extra testing was also successful, so this PR is in a good-to-go state from g3 perspective. Thank you. |
This PR was merged into the repository by commit bba0a87. |
…ngs (angular#43815)" This reverts commit bba0a87. The reason for rollback: this change is breaking some targets in Google's codebase when there is no attribute value is displayed (attr.aria-label) when translated.
Reopened due to the rollback, see #43882. |
Next steps: @AndrewKushnir to investigate in g3 further and come up with a test case that we can use to avoid regressions. |
@petebacondarwin I've performed the necessary investigation and found the origin of the problem. The template that can be used for repro:
It's important to have an attribute that doesn't directly translate to a property. The underlying problem is that the angular/packages/core/src/render3/i18n/i18n_apply.ts Lines 279 to 296 in a91fe6d
We end up calling
But for attributes like It looks like the mentioned code in the |
FYI we also have a code that maps attribute names that don't correspond to their element property names: So we can potentially consider expanding the logic in the |
…ular#43815) While fully dynamic bound properties (and attributes) cannot be marked for localization, properties that only contain interpolation can. This commit ensure that attribute bindings that only contain interpolation can also be marked for localization. Closes angular#43260 PR Close angular#43815
…ngs (angular#43815)" (angular#43882) This reverts commit bba0a87. The reason for rollback: this change is breaking some targets in Google's codebase when there is no attribute value is displayed (attr.aria-label) when translated. PR Close angular#43882
Should we reopen the original issue then (#43260)? |
Thanks for the comment @amakhrov, I've reopened the mentioned issue. |
This issue has been automatically locked due to inactivity. Read more about our automatic conversation locking policy. This action has been performed automatically by a bot. |
While fully dynamic bound properties (and attributes) cannot be marked for localization, properties that only contain interpolation can.
This commit ensure that attribute bindings that only contain interpolation can also be marked for localization.
Closes #43260