Closed
Bug 1154088
Opened 10 years ago
Closed 10 years ago
Show last synced time in Synced Tabs panel using relative time string
Categories
(Firefox for iOS :: Home screen, defect)
Tracking
()
RESOLVED
FIXED
Tracking | Status | |
---|---|---|
fennec | + | --- |
People
(Reporter: nalexander, Assigned: sachin.irukula, Mentored)
References
(Blocks 1 open bug)
Details
Attachments
(2 files)
We want to show nice relative time strings (just now, a day ago, three weeks ago) for last synced timestamps in the Synced Tabs home panel. We'll probably want something similar in the Reading List home panel as well.
There are a couple of parts to this ticket:
1) land a helper function into for converting timestamps (milliseconds since the epoch) into relative time strings. Pay attention to localization! I think the code at [1] is a good place to start, if the license is aggreeable.
2) use the helper function when updating the table view in RemoteTabsPanel.
3) (bonus points) update the table view strings every minute, so the timestamps are fresh.
4) (bonus points) work with stefan to update the table view in the Reading List home panel.
[1] https://github.com/melvitax/AFDateHelper/blob/master/AF%2BDate%2BHelper/AF%2BDate%2BExtension.swift#L410
Assignee | ||
Updated•10 years ago
|
Assignee: nobody → sachin.irukula
Assignee | ||
Comment 1•10 years ago
|
||
Updated•10 years ago
|
Status: NEW → ASSIGNED
Updated•10 years ago
|
Attachment #8595013 -
Flags: review?(sarentz)
Attachment #8595013 -
Flags: review?(nalexander)
Reporter | ||
Comment 2•10 years ago
|
||
Comment on attachment 8595013 [details] [review]
Pull Request
@sachin004: looks good. One change requested, then fold everything into one commit and I'll land it. Thanks!
Attachment #8595013 -
Flags: review?(sarentz)
Attachment #8595013 -
Flags: review?(nalexander)
Attachment #8595013 -
Flags: review+
Assignee | ||
Updated•10 years ago
|
Attachment #8595013 -
Flags: review+ → review?(nalexander)
Reporter | ||
Comment 3•10 years ago
|
||
Status: ASSIGNED → RESOLVED
Closed: 10 years ago
Resolution: --- → FIXED
Reporter | ||
Comment 4•10 years ago
|
||
Comment on attachment 8595013 [details] [review]
Pull Request
Landed! sachin, I noticed that this shows, for example, "37 seconds ago". Can we make that less precise, like "less than a minute ago" or something?
Attachment #8595013 -
Flags: review?(nalexander) → review+
Comment 5•10 years ago
|
||
I think we have a big problem. Locales with complex plural form will never be able to localize strings like
%@ years ago
because "years" changes based on the number. Does iOS support proper plural forms?
Assignee | ||
Comment 6•10 years ago
|
||
If year is 1 then the output is "1 year ago" and if it's more than 1 then it's "%@ years ago"
Comment 7•10 years ago
|
||
(In reply to Sachin Irukula from comment #6)
> If year is 1 then the output is "1 year ago" and if it's more than 1 then
> it's "%@ years ago"
Are you aware of the complexity of plural forms required by some languages? That's not 1 vs more than 1.
https://developer.mozilla.org/en-US/docs/Mozilla/Localization/Localization_and_Plurals#List_of_Plural_Rules
IMO this should be backed out and a proper fix landed, unless iOS is unable to deal with plural forms (and it would be surprising).
Comment 8•10 years ago
|
||
"Handling Noun Plurals and Units of Measurement"
https://developer.apple.com/library/ios/documentation/MacOSX/Conceptual/BPInternational/LocalizingYourApp/LocalizingYourApp.html
No idea how that would look when exported in a XLIFF file.
Comment 9•10 years ago
|
||
Status: RESOLVED → REOPENED
Resolution: FIXED → ---
Comment 10•10 years ago
|
||
An alternative to this is to use concepts like "just now", "this morning", "yesterday", "last week", which avoids the need to handle plural forms altogether.
Assignee | ||
Comment 11•10 years ago
|
||
Ok, but how do we handle if its more than 1 day/week/month/year like 2 or 3.
Comment 12•10 years ago
|
||
(In reply to Sachin Irukula from comment #11)
> Ok, but how do we handle if its more than 1 day/week/month/year like 2 or 3.
Very carefully. For example, you might say:
Just now
This morning
Yesterday
This week
Last week
This month
More than a month ago
… and get l10n review before you commit!
But if we do try to do real relative timestamps, you'll need plural forms.
The link flod kindly posted explains how plural forms are supposed to work on iOS: a stringsdict file is used to 'dispatch' to a range of strings identified by CLDR identifier[1].
If everyday localization is "string X in locale Y", plural localization is "string X in locale Y for plural count Z".
The reason I suggest the option of simpler non-numeric forms like "today" and "yesterday" (which still aren't necessarily universal!) is that I don't know if Pootle (which IIRC is what we use) and our import/export pipelines correctly handle the use of stringsdicts.
If they don't, then in the short term we simply must avoid the use of plural forms everywhere.
[1] http://www.unicode.org/cldr/charts/latest/supplemental/language_plural_rules.html
Comment 13•10 years ago
|
||
(In reply to Richard Newman [:rnewman] from comment #12)
> The reason I suggest the option of simpler non-numeric forms like "today"
> and "yesterday" (which still aren't necessarily universal!) is that I don't
> know if Pootle (which IIRC is what we use) and our import/export pipelines
> correctly handle the use of stringsdicts.
Same here. I think we're late in the cycle to introduce a change of this scope: we'd need to see how the XLIFF looks with plural forms with a test app, then check if Pootle supports the format (teams not using Pootle are mostly using text editors) and update the current dashboard to parse these strings correctly.
I wonder if we need so much granularity though. For example:
Just now
Today
Yesterday
This week
This month
This year
More than a year ago
We could expose the real timestamp with the last ones, as long as we format it correctly with iOS internationalization settings.
Reporter | ||
Comment 14•10 years ago
|
||
Folks, I don't think this needs to be re-opened, because what we're discussing is strictly an improvement to the existing behaviour. Not coincidentally, the existing behaviour is exactly what we do on Android in similar situations.
sachin and I carefully handled separately the cases 0 (which doesn't appear), 1 (day, week), and more than 1 (days, weeks). We can add or refine the cases for languages that translate more than one differently in a follow-up. This is just like on Android, where we make a decent effort to hit more than just the English cases, giving a nod to 0/1/2+, and generally haven't killed ourselves to handle the nuances of 2+.
Comment 15•10 years ago
|
||
(In reply to Nick Alexander :nalexander from comment #14)
> This is just like on Android, where we make a decent effort to
> hit more than just the English cases, giving a nod to 0/1/2+, and generally
> haven't killed ourselves to handle the nuances of 2+.
Android doesn't support plural forms (bug 753859), iOS does.
And they're not "nuances". How good would you feel with English saying "10 tab open" instead of "10 tabs open"?
Reporter | ||
Comment 16•10 years ago
|
||
(In reply to Francesco Lodolo [:flod] (UTC+2) from comment #15)
> (In reply to Nick Alexander :nalexander from comment #14)
> > This is just like on Android, where we make a decent effort to
> > hit more than just the English cases, giving a nod to 0/1/2+, and generally
> > haven't killed ourselves to handle the nuances of 2+.
>
> Android doesn't support plural forms (bug 753859), iOS does.
Sort of. iOS does, but not using the system we use, and we don't even know if the /upstream/ system (Pootle?) can handle this.
> And they're not "nuances". How good would you feel with English saying "10
> tab open" instead of "10 tabs open"?
I would say file a follow-up! This ticket makes the issue better: it's enough for en-US, which might be all we ship. I'm all for getting this right, but I'm not going to block v1 on "37 second ago" instead "37 seconds ago". Also, I'm not going to spend a large amount of my time and a contributor's time getting this right for v1. Follow-up, triage, move on.
Reporter | ||
Comment 17•10 years ago
|
||
After heated discussion, let's go with a base NSLocalizedDateString and some progressive improvements on top, like: "Just now", "Today", "Yesterday". I feel like this kinda-sorta hits the most important use case, which is "I just refreshed, is this actually fresh?"
sachin, do you want to update? (I can understand if you're done with this ticket.)
Flags: needinfo?(sachin.irukula)
Assignee | ||
Comment 18•10 years ago
|
||
Yes, I will make the necessary changes.
The following strings will be used for relative dates:
Just Now,
Today,
Yesterday,
This Week,
Last Week,
This Month,
Last Month,
This Year,
Last Year,
More than an year.
Flags: needinfo?(sachin.irukula)
Assignee | ||
Comment 19•10 years ago
|
||
Not sure what to use after Last year, let me know if you guys have any suggestions.
Reporter | ||
Comment 20•10 years ago
|
||
(In reply to Sachin Irukula from comment #19)
> Not sure what to use after Last year, let me know if you guys have any
> suggestions.
Let's not worry about. It's just old: use NSLocalizedDateString and just show the date.
Comment 21•10 years ago
|
||
(In reply to Sachin Irukula from comment #18)
> Yes, I will make the necessary changes.
> The following strings will be used for relative dates:
Let's use sentence case and simplify these a little:
Just now
Today at 12:34pm // Use the date formatter
Yesterday
This week
More than a week ago
More than a month ago // Any more than that and we don't care.
Assignee | ||
Updated•10 years ago
|
Attachment #8595013 -
Flags: review+ → review?(nalexander)
Reporter | ||
Comment 22•10 years ago
|
||
Comment on attachment 8595013 [details] [review]
Pull Request
Comments on GH. Good start, and thanks for digging back in to this!
Attachment #8595013 -
Flags: review?(nalexander) → feedback+
Assignee | ||
Comment 23•10 years ago
|
||
Attachment #8599021 -
Flags: review?(nalexander)
Comment 25•10 years ago
|
||
FWIW, "nice relative time strings" actually depends on language, too. Different languages have different amount of days and weeks back and forth, for which they have "nice strings".
I wonder, is there something like ICU on iOS?
Comment 26•10 years ago
|
||
Updated•10 years ago
|
tracking-fennec: --- → +
Reporter | ||
Comment 27•10 years ago
|
||
Comment on attachment 8599021 [details] [review]
Link to Github pull-request: https://github.com/mozilla/firefox-ios/pull/396
rnewman, you've been following this, and I'm not. Can you drive it across the line?
Attachment #8599021 -
Flags: review?(nalexander) → review?(rnewman)
Comment 28•10 years ago
|
||
I merged this with some cleanup and rebased. 465c4e4.
Notably, I changed to lowercase: "today at" not "Today at", because we're labeling this string, and
Last synced: More than a week ago
looks bad.
Bug 1171186 covers doing better.
Updated•10 years ago
|
Status: REOPENED → RESOLVED
Closed: 10 years ago → 10 years ago
Resolution: --- → FIXED
Comment 29•10 years ago
|
||
Follow-up to update the test:
8ec5ebb
Updated•10 years ago
|
Attachment #8599021 -
Flags: review?(rnewman) → review+
You need to log in
before you can comment on or make changes to this bug.
Description
•