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

Unified Diff: base/i18n/time_formatting.h

Issue 1951493002: Fix i18n number formats in tray power displays (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Switch unit test from Bengali to Persian for Android (and merge) Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ash/system/chromeos/power/power_status_view.cc ('k') | base/i18n/time_formatting.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/i18n/time_formatting.h
diff --git a/base/i18n/time_formatting.h b/base/i18n/time_formatting.h
index df91f41beddd215764f5d0e054a0b8bab777d5bd..761dd98a5d427e8441b7b17405be2dcb39933a6b 100644
--- a/base/i18n/time_formatting.h
+++ b/base/i18n/time_formatting.h
@@ -14,6 +14,7 @@
namespace base {
class Time;
+class TimeDelta;
// Argument type used to specify the hour clock type.
enum HourClockType {
@@ -27,6 +28,15 @@ enum AmPmClockType {
kKeepAmPm, // Keeps AM/PM sign. e.g., "3:07 PM"
};
+// Should match UMeasureFormatWidth in measfmt.h; replicated here to avoid
+// requiring third_party/icu dependencies with this file.
+enum DurationFormatWidth {
+ DURATION_WIDTH_WIDE, // "3 hours, 7 minutes"
+ DURATION_WIDTH_SHORT, // "3 hr, 7 min"
+ DURATION_WIDTH_NARROW, // "3h 7m"
+ DURATION_WIDTH_NUMERIC // "3:07"
+};
+
// Returns the time of day, e.g., "3:07 PM".
BASE_I18N_EXPORT string16 TimeFormatTimeOfDay(const Time& time);
@@ -65,6 +75,11 @@ BASE_I18N_EXPORT string16 TimeFormatFriendlyDateAndTime(const Time& time);
// "Monday, March 6, 2008".
BASE_I18N_EXPORT string16 TimeFormatFriendlyDate(const Time& time);
+// Formats a time duration of hours and minutes into various formats, e.g.,
+// "3:07" or "3 hours, 7 minutes". See DurationFormatWidth for details.
+BASE_I18N_EXPORT string16 TimeDurationFormat(const TimeDelta& time,
+ const DurationFormatWidth width);
+
// Gets the hour clock type of the current locale. e.g.
// k12HourClock (en-US).
// k24HourClock (en-GB).
« no previous file with comments | « ash/system/chromeos/power/power_status_view.cc ('k') | base/i18n/time_formatting.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698