#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:
Has a Patch: yes Platform: All

Description

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 21 months ago.
0001-Use-formatters-from-locale-kit-to-format-time-remain.patch (4.7 KB) - added by akshay 21 months ago.
0001-Use-formatters-from-locale-kit-to-format-time-remain.2.patch (4.7 KB) - added by akshay 21 months ago.
webplus.png (21.0 KB) - added by akshay 21 months ago.
download progress window screenshot

Download all attachments as: .zip

Change History (11)

comment:1 Changed 21 months ago by akshay

Has a Patch: set

comment:2 Changed 21 months ago by pulkomandy

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 Changed 21 months ago by akshay

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 Changed 21 months ago by akshay

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

comment:5 Changed 21 months ago by pulkomandy

Translations are not a problem, for Haiku sources this is largely automated at https://i18n.haiku-os.org/pootle/, 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.

comment:6 in reply to:  5 Changed 21 months ago by humdinger

Replying to pulkomandy:

Translations are not a problem, for Haiku sources this is largely automated at https://i18n.haiku-os.org/pootle/, 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...

Changed 21 months ago by akshay

Attachment: webplus.png added

download progress window screenshot

comment:7 Changed 21 months ago by pulkomandy

Resolution: fixed
Status: newclosed

Applied in hrev51396.

Note: See TracTickets for help on using tickets.