-
Notifications
You must be signed in to change notification settings - Fork 299
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
add user locale field to mobile app user settings table + change going on call push notification text #2131
add user locale field to mobile app user settings table + change going on call push notification text #2131
Conversation
|
||
assert ( | ||
multiple_day_shift_title | ||
== f"You're going on call in {humanized_time_until_going_oncall} for schedule {schedule_name}, 2023-07-08 09 h 00 - 2023-07-12 17 h 00" |
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.
09 h 00
looks a bit weird IMO, maybe it should be 09:00
or at least 09h00
?
I'm not an expert in locales, but I can't see anything similar to this format in the reference for fr-CA.
) | ||
assert ( | ||
multiple_day_shift_no_locale_title | ||
== f"You're going on call in {humanized_time_until_going_oncall} for schedule {schedule_name}, 7/8/23, 9:00\u202fAM - 7/12/23, 5:00\u202fPM" |
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.
why use code \u20
instead of regular " " spaces?
@vadimkerr good questions 👍 I agree with your points. I'll need to see if I can configure the |
table + change going on call push notification text
4bc09d6
to
ea0ac2c
Compare
@vadimkerr these two points you raised seem to be coming from the
Odd spacing in time formatting w/ It appears like this is the default formatting behaviour for >>> babel.dates.format_time(now, format="short", locale="fr_CA")
'15 h 27'
>>> babel.dates.format_time(now, format="short", locale="fr")
'15:27'
>>> babel.dates.format_time(now, format="short", locale="en")
'3:27\u202fPM' I don't think overriding the datetime formatting pattern syntax would be useful here, because that would default the purpose of localizing the datetimes in the first place 😕 |
@vadimkerr these formatting decisions seem to be the default coming from Unicode CLDR. I suggest for now we stick with these and refine them over time if need be. Overriding them to handle different formats/locales, to suit our liking, seems like a lot of work. Regarding the |
What this PR does
PATCH
requests to this endpointf"You're going on call in {time_until_going_oncall} for schedule {schedule.name}, {formatted_shift}"
time_until_going_oncall
is a "human-readable" format of the time until the start)schedule.name
is self-explanatoryformatted_shift
this depends on the shift. If the shift starts and ends on the same day, the format will be "HH:mm - HH:mm". Otherwise, if the shift starts and ends on different days, the format will be "YYYY-MM-DD HH:mm - YYYY-MM-DD HH:mm". Note that all datetime related formatting will use the newlocale
field that we are now storing in the mobile app user settings table. If no locale is yet present we will fallback to "en"Which issue(s) this PR fixes
closes #2024
https://github.com/grafana/oncall-mobile-app/issues/187
Checklist
pr:no public docs
PR label added if not required)CHANGELOG.md
updated (orpr:no changelog
PR label added if not required)