-
Notifications
You must be signed in to change notification settings - Fork 28.6k
Allow add_format() in flutter gen-l10n DateTime format #156297
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
Allow add_format() in flutter gen-l10n DateTime format #156297
Conversation
19d6e64
to
d84221d
Compare
d84221d
to
0b39b57
Compare
CC @andrewkolos, that's ready for Code Review now. The implementation turned out to be extremely simple. As for the tests, I added a case for the setup that already existed for the |
0b39b57
to
0e35032
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.
Thanks for the PR!
The approach looks good, and the code is delightfully simple. That being said, I think we should have test(s) that define the behavior around odd formats that could be made with this new syntax. For example, consider the format "yMd+jms+"
, which has a dangling +
. What should the user see here? An error message? Would the last +
be implicitly removed?
@Albert221 do you have plans to pick this back up? |
@bkonyi I plan to return back to this PR in a week or two, yes; unless you'd like to add the remaining things, then tell me and fell free :) |
@andrewkolos tests added! Code ready for re-review. I'm not sure what's the issue with some of the unrelated tests failing though, should I merge from upstream everytime I get that? EDIT: Merged latest main into PR. Now |
This Pull Request extends the functionality of the
flutter gen-l10n
command (and its behavior during hot restart/reload) related toDateFormat
type placeholders and theirformat
. Until now, it was impossible to take advantage ofintl
'sDateFormat.something().add_somethingElse()
. The.add_x()
part was impossible to achieve. This PR adds the ability to take advantage of these methods overDateFormat
, by adding theadd_
formats after the+
character in theformat
in placeholder configuration. You can even have multiple added format parts if needed. All within a single placeholder.Resolves #155817.
Next steps
After this PR is merged, an update to i18n | Flutter > Messages with dates (source) shall be made to include a mention of this new addition.
Pre-launch Checklist
///
).