Allow add_format() in flutter gen-l10n DateTime format#156297
Allow add_format() in flutter gen-l10n DateTime format#156297auto-submit[bot] merged 17 commits intoflutter:masterfrom
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
andrewkolos
left a comment
There was a problem hiding this comment.
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-l10ncommand (and its behavior during hot restart/reload) related toDateFormattype 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 theformatin placeholder configuration. You can even have multiple added format parts if needed. All within a single placeholder.{ "bookingsPage_camo_dataLoaded": "CAMO data from {date} {time}.", "@bookingsPage_camo_dataLoaded": { "placeholders": { "date": { "type": "DateTime", "format": "yMMMd" }, "time": { "type": "DateTime", "format": "jm" } } }, }{ "bookingsPage_camo_dataLoaded": "CAMO data from {date}.", "@bookingsPage_camo_dataLoaded": { "placeholders": { "date": { "type": "DateTime", "format": "yMMMd+jm" } } }, }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
///).