summaryrefslogtreecommitdiffstats
path: root/chrome/common/time_format.cc
diff options
context:
space:
mode:
authorjshin@chromium.org <jshin@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-07-31 14:30:59 +0000
committerjshin@chromium.org <jshin@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-07-31 14:30:59 +0000
commitc98b28ebd90a0352c453627063fa5f0c6a8c5584 (patch)
tree0ae96327a639b7dbd90db926b39e8bd75802b32f /chrome/common/time_format.cc
parentf7eabd7813bf2b95b758beb96907e2dec1d05b1a (diff)
downloadchromium_src-c98b28ebd90a0352c453627063fa5f0c6a8c5584.zip
chromium_src-c98b28ebd90a0352c453627063fa5f0c6a8c5584.tar.gz
chromium_src-c98b28ebd90a0352c453627063fa5f0c6a8c5584.tar.bz2
Plural string changes.
1. ADD IDS_TIME_{MIN,HOUR,DAY}S_ZERO because for Romanian, it's not just for 0 but also for some other numbers. Even though 0 mins/hours/days (ago,left) will not be used, We have to get this translated for Romanian (because it's not just for zero). 2. Of 8 Indian languages added, Kannada has a plural rule different from others that needs to be taken care of. 3. With #1, time_format.cc should not skip 'ZERO' for mins/hours/days. 4. Make the description a bit clearer per the feedback from linguists. The ICU-side of changes will be picked up when I complete the upgrade to ICU 4.2.1. (even w/o that, it's harmless). Original review: http://codereview.chromium.org/160432 Note that strings are added and ui tests in buildbot may need one extra cycle to turn green. BUG=14651 TEST=NONE git-svn-id: svn://svn.chromium.org/chrome/trunk/src@22152 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/common/time_format.cc')
-rw-r--r--chrome/common/time_format.cc21
1 files changed, 9 insertions, 12 deletions
diff --git a/chrome/common/time_format.cc b/chrome/common/time_format.cc
index c4bd179..80fe242b 100644
--- a/chrome/common/time_format.cc
+++ b/chrome/common/time_format.cc
@@ -30,8 +30,6 @@ static const char kFallbackFormatSuffixShort[] = "}";
static const char kFallbackFormatSuffixLeft[] = " left}";
static const char kFallbackFormatSuffixAgo[] = " ago}";
-static const int kInvalidMsgId = -1;
-
// Contains message IDs for various time units and pluralities.
struct MessageIDs {
// There are 4 different time units and 6 different pluralities.
@@ -45,15 +43,15 @@ static const MessageIDs kTimeShortMessageIDs = { {
IDS_TIME_SECS_TWO, IDS_TIME_SECS_FEW, IDS_TIME_SECS_MANY
},
{
- IDS_TIME_MINS_DEFAULT, IDS_TIME_MIN_SINGULAR, kInvalidMsgId,
+ IDS_TIME_MINS_DEFAULT, IDS_TIME_MIN_SINGULAR, IDS_TIME_MINS_ZERO,
IDS_TIME_MINS_TWO, IDS_TIME_MINS_FEW, IDS_TIME_MINS_MANY
},
{
- IDS_TIME_HOURS_DEFAULT, IDS_TIME_HOUR_SINGULAR, kInvalidMsgId,
+ IDS_TIME_HOURS_DEFAULT, IDS_TIME_HOUR_SINGULAR, IDS_TIME_HOURS_ZERO,
IDS_TIME_HOURS_TWO, IDS_TIME_HOURS_FEW, IDS_TIME_HOURS_MANY
},
{
- IDS_TIME_DAYS_DEFAULT, IDS_TIME_DAY_SINGULAR, kInvalidMsgId,
+ IDS_TIME_DAYS_DEFAULT, IDS_TIME_DAY_SINGULAR, IDS_TIME_DAYS_ZERO,
IDS_TIME_DAYS_TWO, IDS_TIME_DAYS_FEW, IDS_TIME_DAYS_MANY
}
} };
@@ -66,17 +64,17 @@ static const MessageIDs kTimeRemainingMessageIDs = { {
},
{
IDS_TIME_REMAINING_MINS_DEFAULT, IDS_TIME_REMAINING_MIN_SINGULAR,
- kInvalidMsgId, IDS_TIME_REMAINING_MINS_TWO,
+ IDS_TIME_REMAINING_MINS_ZERO, IDS_TIME_REMAINING_MINS_TWO,
IDS_TIME_REMAINING_MINS_FEW, IDS_TIME_REMAINING_MINS_MANY
},
{
IDS_TIME_REMAINING_HOURS_DEFAULT, IDS_TIME_REMAINING_HOUR_SINGULAR,
- kInvalidMsgId, IDS_TIME_REMAINING_HOURS_TWO,
+ IDS_TIME_REMAINING_HOURS_ZERO, IDS_TIME_REMAINING_HOURS_TWO,
IDS_TIME_REMAINING_HOURS_FEW, IDS_TIME_REMAINING_HOURS_MANY
},
{
IDS_TIME_REMAINING_DAYS_DEFAULT, IDS_TIME_REMAINING_DAY_SINGULAR,
- kInvalidMsgId, IDS_TIME_REMAINING_DAYS_TWO,
+ IDS_TIME_REMAINING_DAYS_ZERO, IDS_TIME_REMAINING_DAYS_TWO,
IDS_TIME_REMAINING_DAYS_FEW, IDS_TIME_REMAINING_DAYS_MANY
}
} };
@@ -89,17 +87,17 @@ static const MessageIDs kTimeElapsedMessageIDs = { {
},
{
IDS_TIME_ELAPSED_MINS_DEFAULT, IDS_TIME_ELAPSED_MIN_SINGULAR,
- kInvalidMsgId, IDS_TIME_ELAPSED_MINS_TWO,
+ IDS_TIME_ELAPSED_MINS_ZERO, IDS_TIME_ELAPSED_MINS_TWO,
IDS_TIME_ELAPSED_MINS_FEW, IDS_TIME_ELAPSED_MINS_MANY
},
{
IDS_TIME_ELAPSED_HOURS_DEFAULT, IDS_TIME_ELAPSED_HOUR_SINGULAR,
- kInvalidMsgId, IDS_TIME_ELAPSED_HOURS_TWO,
+ IDS_TIME_ELAPSED_HOURS_ZERO, IDS_TIME_ELAPSED_HOURS_TWO,
IDS_TIME_ELAPSED_HOURS_FEW, IDS_TIME_ELAPSED_HOURS_MANY
},
{
IDS_TIME_ELAPSED_DAYS_DEFAULT, IDS_TIME_ELAPSED_DAY_SINGULAR,
- kInvalidMsgId, IDS_TIME_ELAPSED_DAYS_TWO,
+ IDS_TIME_ELAPSED_DAYS_ZERO, IDS_TIME_ELAPSED_DAYS_TWO,
IDS_TIME_ELAPSED_DAYS_FEW, IDS_TIME_ELAPSED_DAYS_MANY
}
} };
@@ -208,7 +206,6 @@ void TimeFormatter::BuildFormats(FormatType format_type,
UnicodeString pattern;
for (size_t j = 0; j < arraysize(kKeywords); ++j) {
int msg_id = message_ids.ids[i][j];
- if (msg_id == kInvalidMsgId) continue;
std::string sub_pattern = WideToUTF8(l10n_util::GetString(msg_id));
// NA means this keyword is not used in the current locale.
// Even if a translator translated for this keyword, we do not