-
Notifications
You must be signed in to change notification settings - Fork 319
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
Update TimeFormatter to include localized Strings #1106
Conversation
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.
Some minor comments. Other than that this looks 💯
Thanks @danesfeder 🙏
@@ -492,6 +491,11 @@ private void sendFeedbackEvent(FeedbackEvent feedbackEvent) { | |||
feedbackEvent.getFeedbackType(), feedbackEvent.getScreenshot(), feedbackEvent.getFeedbackSource()); | |||
} | |||
|
|||
private long dateDiff(Date date1, Date date2, TimeUnit timeUnit) { |
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.
Could we rename date1
and date2
into something more semantic?
return dateDiff(new Date(lastCheckedLocation.getTime()), new Date(location.getTime()), TimeUnit.SECONDS); | ||
} | ||
|
||
private long dateDiff(Date date1, Date date2, TimeUnit timeUnit) { |
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.
Same here ☝️
@@ -8,4 +8,12 @@ | |||
<string name="miles">mi</string> | |||
<string name="feet">ft</string> | |||
<string name="eta_format">%s ETA</string> | |||
|
|||
<!-- Time formatting --> | |||
<string name="day">day</string> |
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.
Should we use quantity string (plurals) instead of having multiple "day" strings?
745bbd5
to
4e47c24
Compare
@Guardiola31337 this is updated and ready for another round of 👀 - do you mind checking my usage of |
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.
do you mind checking my usage of plurals?
Looks 💯 to me.
Minor comment not blocking the PR.
Thanks for dealing with this one 🙏
if (days != 0) { | ||
String dayFormat = days > 1 ? DAYS : DAY; | ||
String dayString = String.format(" %s ", resources.getQuantityString(R.plurals.numberOfDays, (int) days)); |
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.
Could we extract " %s "
magic number?
4e47c24
to
fb20342
Compare
@danesfeder do we need to update/do something in Transifex for supporting latest changes (especially |
@Guardiola31337 yeah we should push the update strings.xml to Transifex - I'm wondering if the plurals usage will throw off Transifex, but we will have to see |
Closes #1097
We are currently using hard-coded constants for arrival time formatting. This PR replaces them with
String
resources, which have also already been pushed to Transifex.Noting that this PR does not actually add the necessary translations but it does set up the code to be ready for them once we pull them from Transifex.