-
Notifications
You must be signed in to change notification settings - Fork 30
Rebase the migration tools from python-l20n #9
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
Conversation
|
I'll port the first two commits to fluent.js when this lands. |
|
|
||
| # All section headers will be merged. | ||
| if isinstance(entry, FTL.Section): | ||
| return entry |
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.
This unconditionally merges all Sections into the final result. Note that this mean only the section header, not the messages below it. We might consider only merging a section if at least one message under it is also being merged.
| return LITERAL(source)(ctx) | ||
|
|
||
|
|
||
| class EXTERNAL(Transform): |
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.
I'm considering a number of renames for the transforms, which I'll propose in a follow-up PR. Originally, all transforms except for SOURCE return a Pattern which makes them suitable for using as values of messages. Also CONCAT is implemented such that it can unwrap the expression from the Pattern and fold more than one transform into a single Pattern.
With a simple change to CONCAT it should be possible to do the same conditionally: i.e. unwrap Patterns when needed while keeping normal expressions unchanged. I think we'll end up with EXTERNAL_EXPR for selectors and replacements and LITERAL_PATTERN, PLURAL_PATTERN and CONCAT_PATTERNS for dealing with patterns.
Pike
left a comment
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.
I didn't find a chance to actually spend time on this, submitting my one comment that I had so far
| if timestamp < changeset['first_commit']: | ||
| changeset['first_commit'] = timestamp | ||
|
|
||
| return sorted(changesets, key=by_first_commit) |
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.
Unless we want to call this in more places, I'd just inline this as a lambda function.
If you'd like to keep the method, please adjust that the doc string to denote it as a thing used by sort, not sorting itself?
This is a rebase of l20n/python-l20n#5 and its follow-ups (l20n/python-l20n#10, l20n/python-l20n#11 as well as changes in @Pike's branch, adjusted to the changes in the Fluent syntax and AST:
ExternalArgumenttakes anIdentifierinstanceMemberis gone, replaced byVariantorAttribute.Keywordis gone, replace bySymbol.Since it already got an r+ back in the day, I'm mostly interested in the review of the first two commits.
My next steps are: