From 60e6c849cc943fa60ed599709d26051347b5abe6 Mon Sep 17 00:00:00 2001 From: "kinaba@google.com" Date: Mon, 30 May 2011 11:45:43 +0000 Subject: Fix ChromeOS clock menu so that it can show 12-hour clock in all locales. BUG=chromium-os:15183 TEST=Set "OS Language" to "Japanese" and open "System" setting. Click the check box of "Use 24-hour clock". Verify the top-right menu clock toggles (12 <--> 24). The cause of the issue was that, the 12/24h setting is not referred at all when time strings are formatted with AM/PM sign dropped. Review URL: http://codereview.chromium.org/7054032 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@87229 0039d316-1c4b-4281-b951-d872f2087c98 --- base/i18n/time_formatting.h | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) (limited to 'base/i18n/time_formatting.h') diff --git a/base/i18n/time_formatting.h b/base/i18n/time_formatting.h index 99d1911..85c0169 100644 --- a/base/i18n/time_formatting.h +++ b/base/i18n/time_formatting.h @@ -21,14 +21,22 @@ enum HourClockType { k24HourClock, // Uses 0-23. e.g., "15:07" }; +// Argument type used to specify whether or not to include AM/PM sign. +enum AmPmClockType { + kDropAmPm, // Drops AM/PM sign. e.g., "3:07" + kKeepAmPm, // Keeps AM/PM sign. e.g., "3:07 PM" +}; + // Returns the time of day, e.g., "3:07 PM". string16 TimeFormatTimeOfDay(const Time& time); // Returns the time of day in the specified hour clock type. e.g. -// "3:07 PM" (type == k12HourClock). +// "3:07 PM" (type == k12HourClock, ampm == kKeepAmPm). +// "3:07" (type == k12HourClock, ampm == kDropAmPm). // "15:07" (type == k24HourClock). string16 TimeFormatTimeOfDayWithHourClockType(const Time& time, - HourClockType type); + HourClockType type, + AmPmClockType ampm); // Returns a shortened date, e.g. "Nov 7, 2007" string16 TimeFormatShortDate(const Time& time); @@ -36,8 +44,7 @@ string16 TimeFormatShortDate(const Time& time); // Returns a numeric date such as 12/13/52. string16 TimeFormatShortDateNumeric(const Time& time); -// Formats a time in a friendly sentence format, e.g. -// "Monday, March 6, 2008 2:44:30 PM". +// Returns a numeric date and time such as "12/13/52 2:44:30 PM". string16 TimeFormatShortDateAndTime(const Time& time); // Formats a time in a friendly sentence format, e.g. -- cgit v1.1