ICU-4327 Add long era names, narrow month/day, standalone month/day

X-SVN-Rev: 18119
This commit is contained in:
John Emmons 2005-07-01 17:30:36 +00:00
parent 7793910072
commit e6f8f10213
2 changed files with 66 additions and 6 deletions

View File

@ -1,6 +1,6 @@
/*
**********************************************************************
* Copyright (c) 2003-2004, International Business Machines
* Copyright (c) 2003-2005, International Business Machines
* Corporation and others. All Rights Reserved.
**********************************************************************
* Author: Alan Liu
@ -297,6 +297,20 @@ public:
*/
UResourceBundle* getByKey2(const char *key, const char *subKey, UErrorCode& status);
/**
* Load data for calendar. Note, this object owns the resources, do NOT call ures_close()!
* data is located in: "calendar/key/contextKey/subKey"
* for example, calendar/dayNames/standalone/narrow
* The ResourceBundle C++ API should NOT be used because it is too slow for a low level API.
*
* @param key Resource key to data
* @param contextKey Resource key to data
* @param subKey Resource key to data
* @param status Error Status
* @internal
*/
UResourceBundle* getByKey3(const char *key, const char *contextKey, const char *subKey, UErrorCode& status);
~CalendarData();
private:

View File

@ -612,8 +612,12 @@ SimpleDateFormat::subFormat(UnicodeString &appendTo,
switch (patternCharIndex) {
// for any "G" symbol, write out the appropriate era string
// "GGGG" is wide era name, anything else is abbreviated name
case UDAT_ERA_FIELD:
_appendSymbol(appendTo, value, fSymbols->fEras, fSymbols->fErasCount);
if (count >= 4)
_appendSymbol(appendTo, value, fSymbols->fEraNames, fSymbols->fEraNamesCount);
else
_appendSymbol(appendTo, value, fSymbols->fEras, fSymbols->fErasCount);
break;
// for "yyyy", write out the whole year; for "yy", write out the last 2 digits
@ -630,8 +634,12 @@ SimpleDateFormat::subFormat(UnicodeString &appendTo,
// for "MMMM", write out the whole month name, for "MMM", write out the month
// abbreviation, for "M" or "MM", write out the month as a number with the
// appropriate number of digits
// for "MMMMM", use the narrow form
case UDAT_MONTH_FIELD:
if (count >= 4)
if (count == 5)
_appendSymbol(appendTo, value, fSymbols->fNarrowMonths,
fSymbols->fNarrowMonthsCount);
else if (count == 4)
_appendSymbol(appendTo, value, fSymbols->fMonths,
fSymbols->fMonthsCount);
else if (count == 3)
@ -641,6 +649,24 @@ SimpleDateFormat::subFormat(UnicodeString &appendTo,
zeroPaddingNumber(appendTo, value + 1, count, maxIntCount);
break;
// for "LLLL", write out the whole month name, for "LLL", write out the month
// abbreviation, for "L" or "LL", write out the month as a number with the
// appropriate number of digits
// for "LLLLL", use the narrow form
case UDAT_STANDALONE_MONTH_FIELD:
if (count == 5)
_appendSymbol(appendTo, value, fSymbols->fStandaloneNarrowMonths,
fSymbols->fStandaloneNarrowMonthsCount);
else if (count == 4)
_appendSymbol(appendTo, value, fSymbols->fStandaloneMonths,
fSymbols->fStandaloneMonthsCount);
else if (count == 3)
_appendSymbol(appendTo, value, fSymbols->fStandaloneShortMonths,
fSymbols->fStandaloneShortMonthsCount);
else
zeroPaddingNumber(appendTo, value + 1, count, maxIntCount);
break;
// for "k" and "kk", write out the hour, adjusting midnight to appear as "24"
case UDAT_HOUR_OF_DAY1_FIELD:
if (value == 0)
@ -668,16 +694,36 @@ SimpleDateFormat::subFormat(UnicodeString &appendTo,
}
break;
// for "EEEE", write out the day-of-the-week name; otherwise, use the abbreviation
// for "EEE", write out the abbreviated day-of-the-week name
// for "EEEE", write out the wide day-of-the-week name
// for "EEEEE", use the narrow day-of-the-week name
case UDAT_DAY_OF_WEEK_FIELD:
if (count >= 4)
if (count == 5)
_appendSymbol(appendTo, value, fSymbols->fNarrowWeekdays,
fSymbols->fNarrowWeekdaysCount);
else if (count == 4)
_appendSymbol(appendTo, value, fSymbols->fWeekdays,
fSymbols->fWeekdaysCount);
else
else if (count == 3)
_appendSymbol(appendTo, value, fSymbols->fShortWeekdays,
fSymbols->fShortWeekdaysCount);
break;
// for "ccc", write out the abbreviated day-of-the-week name
// for "cccc", write out the wide day-of-the-week name
// for "ccccc", use the narrow day-of-the-week name
case UDAT_STANDALONE_DAY_FIELD:
if (count == 5)
_appendSymbol(appendTo, value, fSymbols->fStandaloneNarrowWeekdays,
fSymbols->fStandaloneNarrowWeekdaysCount);
else if (count == 4)
_appendSymbol(appendTo, value, fSymbols->fStandaloneWeekdays,
fSymbols->fStandaloneWeekdaysCount);
else if (count == 3)
_appendSymbol(appendTo, value, fSymbols->fStandaloneShortWeekdays,
fSymbols->fStandaloneShortWeekdaysCount);
break;
// for and "a" symbol, write out the whole AM/PM string
case UDAT_AM_PM_FIELD:
_appendSymbol(appendTo, value, fSymbols->fAmPms,