Repository navigation
fix(i18n): handle legacy message ids in ICUs - #33318
Closed
petebacondarwin wants to merge 7 commits into
Closed
petebacondarwin wants to merge 7 commits into
petebacondarwin wants to merge 7 commits into
Conversation
petebacondarwin
force-pushed
the
icu-message-ids
branch
from
October 22, 2019 13:00
42bc40d to
8450d37
Compare
This commit cleans up the I18MetaVisitor code by moving all the state of the visitor into a `context` object that gets passed along as the nodes are being visited. This is in keeping with how visitors are designed but also makes it easy to remove the [definite assignment assertions](https://mariusschulz.com/blog/strict-property-initialization-in-typescript#solution-4-definite-assignment-assertion) from the class properties. Also, a `I18nMessageFactory` named type is exported to make it clearer to consumers of the `createI18nMessageFactory()` function.
Previously the parameter was `id` which is ambigous because it could be a computed value rather than a developer specified custom value.
This better reflects what this type represents and what it is used for.
The code will now fail if the `i18n` property is of the wrong type.
This abstract class will be useful for identifying nodes that can hold i18n data.
When computing i18n messages for templates there are two passes. This is because messages must be computed before any whitespace is removed. Then on a second pass, the messages must be recreated but reusing the message ids from the first pass. Previously ICUs were losing their legacy ids that had been computed via the first pass. This commit fixes that by keeping track of the message from the first pass (`previousMessage`) for ICU placeholder nodes. // FW-1637
petebacondarwin
force-pushed
the
icu-message-ids
branch
from
October 22, 2019 14:06
8450d37 to
dbe7e1e
Compare
AndrewKushnir
approved these changes
Oct 22, 2019
AndrewKushnir
left a comment
Contributor
There was a problem hiding this comment.
LGTM, thanks for additional refactoring @petebacondarwin 👍
One comment (we can fix in the next PRs) - we now have 2 I18nMeta types: one represents i18n message (including AST), the second one represents metadata collected from i18n attributes. We probably need to find different names to disambiguate that in the code.
Contributor
matsko
pushed a commit
that referenced
this pull request
Oct 22, 2019
matsko
pushed a commit
that referenced
this pull request
Oct 22, 2019
The code will now fail if the `i18n` property is of the wrong type. PR Close #33318
matsko
pushed a commit
that referenced
this pull request
Oct 22, 2019
When computing i18n messages for templates there are two passes. This is because messages must be computed before any whitespace is removed. Then on a second pass, the messages must be recreated but reusing the message ids from the first pass. Previously ICUs were losing their legacy ids that had been computed via the first pass. This commit fixes that by keeping track of the message from the first pass (`previousMessage`) for ICU placeholder nodes. // FW-1637 PR Close #33318
|
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. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
All but the last commit are just refactorings that made it easier for me to understand what is going on. The bug fix is in the last commit.
See FW-1637