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

Unified Diff: ui/base/l10n/formatter.cc

Issue 2747253004: Implement (FORMAT_ELAPSED, LENGTH_LONG) in time_format (Closed)
Patch Set: Created 3 years, 9 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 | « no previous file | ui/base/l10n/time_format.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/base/l10n/formatter.cc
diff --git a/ui/base/l10n/formatter.cc b/ui/base/l10n/formatter.cc
index e15be773ceb6221387c8183e90c880590e8c700a..2764907cc4712a28f4d1da916210ba96ddb9ae0e 100644
--- a/ui/base/l10n/formatter.cc
+++ b/ui/base/l10n/formatter.cc
@@ -30,11 +30,19 @@ static const Pluralities IDS_ELAPSED_SHORT_SEC = {
"one{# sec ago}",
" other{# secs ago}"
};
+
+static const Pluralities IDS_ELAPSED_LONG_SEC = {
+ IDS_TIME_ELAPSED_LONG_SECS, "one{# second ago}", " other{# seconds ago}"};
+
static const Pluralities IDS_ELAPSED_SHORT_MIN = {
IDS_TIME_ELAPSED_MINS,
"one{# min ago}",
" other{# mins ago}"
};
+
+static const Pluralities IDS_ELAPSED_LONG_MIN = {
+ IDS_TIME_ELAPSED_LONG_MINS, "one{# minute ago}", " other{# minutes ago}"};
+
static const Pluralities IDS_ELAPSED_HOUR = {
IDS_TIME_ELAPSED_HOURS,
"one{# hour ago}",
@@ -265,8 +273,6 @@ std::unique_ptr<icu::MessageFormat> Formatter::InitFormat(
const Formatter* FormatterContainer::Get(TimeFormat::Format format,
TimeFormat::Length length) const {
- DCHECK(formatter_[format][length])
- << "Combination of FORMAT_ELAPSED and LENGTH_LONG is not implemented!";
return formatter_[format][length].get();
}
@@ -283,7 +289,9 @@ void FormatterContainer::Initialize() {
IDS_ELAPSED_SHORT_MIN,
IDS_ELAPSED_HOUR,
IDS_ELAPSED_DAY));
- formatter_[TimeFormat::FORMAT_ELAPSED][TimeFormat::LENGTH_LONG].reset();
+ formatter_[TimeFormat::FORMAT_ELAPSED][TimeFormat::LENGTH_LONG].reset(
+ new Formatter(IDS_ELAPSED_LONG_SEC, IDS_ELAPSED_LONG_MIN,
+ IDS_ELAPSED_HOUR, IDS_ELAPSED_DAY));
formatter_[TimeFormat::FORMAT_REMAINING][TimeFormat::LENGTH_SHORT].reset(
new Formatter(IDS_REMAINING_SHORT_SEC,
IDS_REMAINING_SHORT_MIN,
« no previous file with comments | « no previous file | ui/base/l10n/time_format.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698