diff options
author | Eike Rathke <erack@redhat.com> | 2011-11-22 14:29:35 +0100 |
---|---|---|
committer | Eike Rathke <erack@redhat.com> | 2011-11-22 14:52:41 +0100 |
commit | 3b5ee26d2c27b9fb8d3836c470832fc81cda721f (patch) | |
tree | fae2e2fce03aaf000a18ae253493d50b68f377de /i18npool/source/calendar | |
parent | 734bfe16bdfe7c80fa8c0c71d680746353686961 (diff) |
added partitive case month names
* Locale data:
* nominative (nouns) month names always given in <MonthsOfYear>
element
* optional genitive case month names in <GenitiveMonths> element,
following the <MonthsOfYear> element; if not given take nominative
names
* optional partitive case month names in <PartitiveMonths> element,
following the <GenitiveMonths> element, or following the
<MonthsOfYear> element if the <GenitiveMonths> element is not
present; if not given take genitive case names, or nominative if
genitive names aren't defined
* currently known partitive case matters in Finnish locales
* Rules for use of nominative / genitive / partitive case month names in
number formatter:
* no day of month (D or DD) present in format code => MMM or MMMM
display nominative month name (noun)
* day of month (D or DD) after MMM or MMMM => genitive name
* no genitive names defined => nominative names
* day of month (D or DD) before MMM or MMMM => partitive name
* no partitive names defined => genitive names
* no genitive names defined => nominative names
Diffstat (limited to 'i18npool/source/calendar')
-rw-r--r-- | i18npool/source/calendar/calendarImpl.cxx | 10 | ||||
-rw-r--r-- | i18npool/source/calendar/calendar_gregorian.cxx | 23 |
2 files changed, 33 insertions, 0 deletions
diff --git a/i18npool/source/calendar/calendarImpl.cxx b/i18npool/source/calendar/calendarImpl.cxx index aebc1d5accdc..3c6d10c56260 100644 --- a/i18npool/source/calendar/calendarImpl.cxx +++ b/i18npool/source/calendar/calendarImpl.cxx @@ -322,6 +322,16 @@ CalendarImpl::getGenitiveMonths2() throw(RuntimeException) } +Sequence< CalendarItem2 > SAL_CALL +CalendarImpl::getPartitiveMonths2() throw(RuntimeException) +{ + if (xCalendar.is()) + return xCalendar->getPartitiveMonths2(); + else + throw ERROR ; +} + + sal_Bool SAL_CALL CalendarImpl::isValid() throw(RuntimeException) { diff --git a/i18npool/source/calendar/calendar_gregorian.cxx b/i18npool/source/calendar/calendar_gregorian.cxx index 23e95220b25b..703c847866f6 100644 --- a/i18npool/source/calendar/calendar_gregorian.cxx +++ b/i18npool/source/calendar/calendar_gregorian.cxx @@ -850,6 +850,9 @@ static sal_Int32 SAL_CALL DisplayCode2FieldIndex(sal_Int32 nCalendarDisplayCode) case CalendarDisplayCode::SHORT_GENITIVE_MONTH_NAME: case CalendarDisplayCode::LONG_GENITIVE_MONTH_NAME: case CalendarDisplayCode::NARROW_GENITIVE_MONTH_NAME: + case CalendarDisplayCode::SHORT_PARTITIVE_MONTH_NAME: + case CalendarDisplayCode::LONG_PARTITIVE_MONTH_NAME: + case CalendarDisplayCode::NARROW_PARTITIVE_MONTH_NAME: return CalendarFieldIndex::MONTH; case CalendarDisplayCode::SHORT_YEAR: case CalendarDisplayCode::LONG_YEAR: @@ -945,6 +948,13 @@ Calendar_gregorian::getGenitiveMonths2() throw(RuntimeException) } +Sequence< CalendarItem2 > SAL_CALL +Calendar_gregorian::getPartitiveMonths2() throw(RuntimeException) +{ + return aCalendar.PartitiveMonths; +} + + OUString SAL_CALL Calendar_gregorian::getDisplayName( sal_Int16 displayIndex, sal_Int16 idx, sal_Int16 nameType ) throw(RuntimeException) { @@ -977,6 +987,13 @@ Calendar_gregorian::getDisplayName( sal_Int16 displayIndex, sal_Int16 idx, sal_I else if (nameType == 2) aStr = aCalendar.GenitiveMonths[idx].NarrowName; else throw ERROR; break; + case CalendarDisplayIndex::PARTITIVE_MONTH: + if( idx >= aCalendar.PartitiveMonths.getLength() ) throw ERROR; + if (nameType == 0) aStr = aCalendar.PartitiveMonths[idx].AbbrevName; + else if (nameType == 1) aStr = aCalendar.PartitiveMonths[idx].FullName; + else if (nameType == 2) aStr = aCalendar.PartitiveMonths[idx].NarrowName; + else throw ERROR; + break; case CalendarDisplayIndex::ERA: if( idx >= aCalendar.Eras.getLength() ) throw ERROR; if (nameType == 0) aStr = aCalendar.Eras[idx].AbbrevName; @@ -1069,6 +1086,12 @@ Calendar_gregorian::getDisplayString( sal_Int32 nCalendarDisplayCode, sal_Int16 return getDisplayName(CalendarDisplayIndex::GENITIVE_MONTH, value, 1); case CalendarDisplayCode::NARROW_GENITIVE_MONTH_NAME: return getDisplayName(CalendarDisplayIndex::GENITIVE_MONTH, value, 2); + case CalendarDisplayCode::SHORT_PARTITIVE_MONTH_NAME: + return getDisplayName(CalendarDisplayIndex::PARTITIVE_MONTH, value, 0); + case CalendarDisplayCode::LONG_PARTITIVE_MONTH_NAME: + return getDisplayName(CalendarDisplayIndex::PARTITIVE_MONTH, value, 1); + case CalendarDisplayCode::NARROW_PARTITIVE_MONTH_NAME: + return getDisplayName(CalendarDisplayIndex::PARTITIVE_MONTH, value, 2); case CalendarDisplayCode::SHORT_ERA: return getDisplayName(CalendarDisplayIndex::ERA, value, 0); case CalendarDisplayCode::LONG_ERA: |