Opened 3 years ago

Closed 3 years ago

#13686 closed enhancement (fixed)

Web+: Use BDurationFormat to format time remaining in Downloads.

Reported by: akshay Owned by: pulkomandy
Priority: normal Milestone: Unscheduled
Component: Applications/WebPositive Version: R1/Development
Keywords: Cc:
Blocked By: Blocking:
Platform: All


Currently I am using BDurationFormat instead of BRelativeDateTimeFormat because it will give more precise duration left. For e.g in case the time remaining is '1hr 50 mins', BDurationFormat will result in '1 hr, 50 min' whereas BRelativeDateTimeFormat will result in 'in 1 hour'. In my opinion having a more precise time(for a download time) would be better. But for longer duration probably using BRelativeDateTime format would be better. Others can give a better idea on this.

Currently if say the system time is 11:05 A.M and time remaining for download is '1 hr 50mins' it shows the status as (Finish: 12:55 - Over 1 hours left).

With the changes it will show the status as (Time Left: 1 hours 50 minutes)

Translation for 'Time left' would have to be added in the catkeys files.

Attachments (4)

0001-Web-Use-BDurationFormat-to-format-time-remaining-in-.patch (3.5 KB ) - added by akshay 3 years ago.
0001-Use-formatters-from-locale-kit-to-format-time-remain.patch (4.7 KB ) - added by akshay 3 years ago.
0001-Use-formatters-from-locale-kit-to-format-time-remain.2.patch (4.7 KB ) - added by akshay 3 years ago.
webplus.png (21.0 KB ) - added by akshay 3 years ago.
download progress window screenshot

Download all attachments as: .zip

Change History (11)

comment:1 by akshay, 3 years ago

patch: 01

comment:2 by pulkomandy, 3 years ago

This should be avoided:

BString buffer1(B_TRANSLATE("Time Left"));
buffer1 << ": ";

For example, in French, typography rules require a (non-breakable) space before the ":" character. Hence, the character should be part of the translated string:

BString buffer1(B_TRANSLATE("Time Left: "));

In fact, even better, so the translators can see what they are dealing with, would be something like this:

BString remainingTime(B_TRANSLATE("(Time Left: %timeLeft%)"));
remainingTime.ReplaceAll("%timeleft%", buffer2);

This gives the translator full control on how the text should look. Maybe some languages doesn't use the same character for parentheses?

I would rename the variables, as buffer1 and buffer2 aren't very descriptive names (I know, it was already this way, but while we are changing that code, it's a good idea to update this).

I preferred the previous format of exact end date + approximate duration. For example, it sometimes happens that I download something at an airport or train station over the provided wi-fi. There, I need the exact end date so I know wether the download will finish before I have to board my train/plane. In other cases, something like "more than 2 hours left" would be great, but I don't know if we can get ICU to word it this way.

comment:3 by akshay, 3 years ago

Thanks for explaining that. :)

ICU::RelativeDateTimeFormatter doesn't support wording it that way. it only supports ('in' 2 hours). Not sure if it can be done any way else using ICU.

Probably then the way it's implemented in tracker status window is the best for this. It also shows exact end date + approx duration and makes use of appropriate time formatters.

comment:4 by akshay, 3 years ago

The traslation would need to be added for the changes in the catkeys files.

comment:5 by pulkomandy, 3 years ago

Translations are not a problem, for Haiku sources this is largely automated at, which is automatically synced with Haiku sourcecode.

Patch looks ok, except I would use %date and %duration instead of %time and %finishtime to make it clearer what they are.

I will build and test it to check how it looks in the download window before merging.

in reply to:  5 comment:6 by humdinger, 3 years ago

Replying to pulkomandy:

Translations are not a problem, for Haiku sources this is largely automated at, which is automatically synced with Haiku sourcecode.

Which unfortunately has been broken for a while, see #13576. Just in case you wait for the changes to pop up on pootle...

by akshay, 3 years ago

Attachment: webplus.png added

download progress window screenshot

comment:7 by pulkomandy, 3 years ago

Resolution: fixed
Status: newclosed

Applied in hrev51396.

Note: See TracTickets for help on using tickets.