Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(43)

Issue 147443007: Add support for localized time strings with two units, eg. "2 hours 17 minutes" (Closed)

Created:
6 years, 10 months ago by Thiemo Nagel
Modified:
6 years, 9 months ago
Reviewers:
bartfab (slow), tony
CC:
chromium-reviews, jshin+watch_chromium.org
Base URL:
https://chromium.googlesource.com/chromium/src.git@master
Visibility:
Public.

Description

Add support for localized time strings with two units, eg. "2 hours 17 minutes" At that occasion, replace five existing formatting functions for one-unit time strings by a single consistent interface with the aim to make time formatting functions easier to use by highlighting the availability of different formatting options. Also at that occasion, rename IDS_TIME_DURATION_LONG* to IDS_TIME_LONG* to be more consistent with other IDS_TIME* ids. BUG=339835 TEST=full unit test coverage TBR=oshima@chromium.org (for resolution_notification_controller.cc) TBR=jennyz@chromium.org (for ash/system) TBR=asanka@chromium.org (for download_item_model.cc) TBR=tim@chromium.org (for profile_sync_service.cc) TBR=xiyuan@chromium.org (for imageburner_ui.cc) TBR=estade@chromium.org (for foreign_session_handler.cc, policy_ui.cc) Committed: https://src.chromium.org/viewvc/chrome?view=rev&revision=253830

Patch Set 1 : First working prototype #

Patch Set 2 : Implementation finished, cleanup pending #

Patch Set 3 : Update grit_whitelist.txt #

Patch Set 4 : Rebase #

Patch Set 5 : Cleanup and compilation fixes #

Patch Set 6 : More cleanup and documentation #

Total comments: 178

Patch Set 7 : Address Bartosz' comments #

Total comments: 20

Patch Set 8 : Address Bartosz' 2nd round of comments #

Total comments: 4

Patch Set 9 : Address Bartosz' 3rd round of comments #

Total comments: 13

Patch Set 10 : Address Tony's comments #

Unified diffs Side-by-side diffs Delta from patch set Stats (+1603 lines, -644 lines) Patch
M ash/display/resolution_notification_controller.cc View 1 2 3 4 5 6 7 1 chunk +2 lines, -1 line 0 comments Download
M ash/system/chromeos/power/power_status.cc View 1 2 3 4 5 6 7 1 chunk +12 lines, -4 lines 0 comments Download
M ash/system/chromeos/power/power_status_view.cc View 1 2 3 4 5 6 7 1 chunk +2 lines, -1 line 0 comments Download
M ash/system/logout_button/logout_confirmation_dialog_view.cc View 1 2 3 4 5 6 7 1 chunk +3 lines, -2 lines 0 comments Download
M ash/system/session_length_limit/tray_session_length_limit.cc View 1 2 3 4 5 6 7 1 chunk +3 lines, -1 line 0 comments Download
M build/ios/grit_whitelist.txt View 1 2 3 2 chunks +48 lines, -12 lines 0 comments Download
M chrome/browser/download/download_item_model.cc View 1 2 3 4 5 6 2 chunks +10 lines, -5 lines 0 comments Download
M chrome/browser/sync/profile_sync_service.cc View 1 2 3 4 5 6 7 1 chunk +2 lines, -1 line 0 comments Download
M chrome/browser/ui/webui/chromeos/imageburner/imageburner_ui.cc View 1 2 3 4 5 6 7 1 chunk +2 lines, -1 line 0 comments Download
M chrome/browser/ui/webui/ntp/foreign_session_handler.cc View 1 2 3 4 5 6 2 chunks +5 lines, -3 lines 0 comments Download
M chrome/browser/ui/webui/policy_ui.cc View 1 2 3 4 5 6 1 chunk +7 lines, -3 lines 0 comments Download
M chrome/common/time_format_browsertest.cc View 1 2 3 4 5 6 1 chunk +3 lines, -1 line 0 comments Download
A ui/base/l10n/formatter.h View 1 2 3 4 5 6 7 8 9 1 chunk +114 lines, -0 lines 0 comments Download
A ui/base/l10n/formatter.cc View 1 2 3 4 5 6 7 8 9 1 chunk +327 lines, -0 lines 0 comments Download
M ui/base/l10n/l10n_util_android.cc View 1 2 3 4 5 6 7 8 1 chunk +2 lines, -1 line 0 comments Download
M ui/base/l10n/time_format.h View 1 2 3 4 5 6 7 1 chunk +50 lines, -14 lines 0 comments Download
M ui/base/l10n/time_format.cc View 1 2 3 4 5 6 7 8 1 chunk +67 lines, -319 lines 0 comments Download
M ui/base/l10n/time_format_unittest.cc View 1 2 3 4 5 6 7 8 9 4 chunks +301 lines, -63 lines 0 comments Download
M ui/base/strings/ui_strings.grd View 1 2 3 4 5 6 7 8 9 25 chunks +641 lines, -212 lines 0 comments Download
M ui/ui.gyp View 1 2 3 4 5 6 7 1 chunk +2 lines, -0 lines 0 comments Download

Messages

Total messages: 17 (0 generated)
Thiemo Nagel
Hi Bartosz, may I ask you to take a look at this CL? It grew ...
6 years, 10 months ago (2014-02-17 16:30:24 UTC) #1
bartfab (slow)
On 2014/02/17 16:30:24, Thiemo Nagel wrote: > Hi Bartosz, > > may I ask you ...
6 years, 10 months ago (2014-02-17 18:10:44 UTC) #2
Thiemo Nagel
> A quick nit before I start the actual review: TBR= lines should also not ...
6 years, 10 months ago (2014-02-17 19:46:07 UTC) #3
Thiemo Nagel
Another thing: What would you think of moving Type and Length out of TimeFormat to ...
6 years, 10 months ago (2014-02-17 22:06:50 UTC) #4
bartfab (slow)
https://codereview.chromium.org/147443007/diff/760002/chrome/browser/download/download_item_model.cc File chrome/browser/download/download_item_model.cc (right): https://codereview.chromium.org/147443007/diff/760002/chrome/browser/download/download_item_model.cc#newcode340 chrome/browser/download/download_item_model.cc:340: time_remaining = ui::TimeFormat::Simple(ui::TimeFormat::kRemaining, Nit: The else branch now spans ...
6 years, 10 months ago (2014-02-18 12:04:04 UTC) #5
Thiemo Nagel
Hi Bartosz, thanks a lot for your many and detailed comments -- the code has ...
6 years, 10 months ago (2014-02-19 17:08:43 UTC) #6
bartfab (slow)
https://codereview.chromium.org/147443007/diff/760002/ui/base/l10n/formatter.cc File ui/base/l10n/formatter.cc (right): https://codereview.chromium.org/147443007/diff/760002/ui/base/l10n/formatter.cc#newcode239 ui/base/l10n/formatter.cc:239: if (rules.isKeyword(UNICODE_STRING_SIMPLE("one"))) { On 2014/02/19 17:08:44, Thiemo Nagel wrote: ...
6 years, 10 months ago (2014-02-20 16:31:22 UTC) #7
Thiemo Nagel
Hi Bartosz, thanks again for your comments which I've dutifully worked through. May I ask ...
6 years, 10 months ago (2014-02-22 21:44:09 UTC) #8
bartfab (slow)
lgtm https://codereview.chromium.org/147443007/diff/1580001/ui/base/l10n/formatter.h File ui/base/l10n/formatter.h (right): https://codereview.chromium.org/147443007/diff/1580001/ui/base/l10n/formatter.h#newcode91 ui/base/l10n/formatter.h:91: static void SetFallbackForTesting(bool val) { force_fallback_ = val; ...
6 years, 9 months ago (2014-02-26 12:45:20 UTC) #9
Thiemo Nagel
Hi Tony, this time, a more substantial CL: Could you please take a look at ...
6 years, 9 months ago (2014-02-26 13:45:37 UTC) #10
tony
ui/base/l10n LGTM. Some style nits below. https://codereview.chromium.org/147443007/diff/1690001/ui/base/l10n/formatter.cc File ui/base/l10n/formatter.cc (right): https://codereview.chromium.org/147443007/diff/1690001/ui/base/l10n/formatter.cc#newcode21 ui/base/l10n/formatter.cc:21: int Ids[kNumberPluralities]; Nit: ...
6 years, 9 months ago (2014-02-26 20:29:19 UTC) #11
Thiemo Nagel
Hi Tony, thanks a lot for your review! Would you prefer to include the mentioning ...
6 years, 9 months ago (2014-02-26 21:13:33 UTC) #12
tony
On 2014/02/26 21:13:33, Thiemo Nagel wrote: > Hi Tony, > > thanks a lot for ...
6 years, 9 months ago (2014-02-26 21:17:58 UTC) #13
Thiemo Nagel
The CQ bit was checked by tnagel@chromium.org
6 years, 9 months ago (2014-02-27 12:27:19 UTC) #14
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-status.appspot.com/cq/tnagel@chromium.org/147443007/1740001
6 years, 9 months ago (2014-02-27 12:28:04 UTC) #15
commit-bot: I haz the power
Change committed as 253830
6 years, 9 months ago (2014-02-27 15:32:25 UTC) #16
bartfab (slow)
6 years, 9 months ago (2014-02-27 17:14:50 UTC) #17
Message was sent while issue was closed.
https://codereview.chromium.org/147443007/diff/1690001/ui/base/l10n/formatter.h
File ui/base/l10n/formatter.h (right):

https://codereview.chromium.org/147443007/diff/1690001/ui/base/l10n/formatter...
ui/base/l10n/formatter.h:90: static bool GetFallback() { return force_fallback_;
}
On 2014/02/26 21:13:34, Thiemo Nagel wrote:
> On 2014/02/26 20:29:20, tony wrote:
> > Nit: get_force_fallback()
> > 
> > Or you could just move the bool to be a file static in formatter.cc.  Then
you
> > don't need a getter.  Alternately, this method should be private.
> 
> I can't make it private because it's used by Formatter, not FormatterContainer
> in formatter.cc -- but to move the bool outside of any class seems like a good
> idea.

Note that the style guide gives you a choice getween CamelCaps and hacker_style
for simple getters and setters.

Powered by Google App Engine
This is Rietveld 408576698