Kaydet (Commit) 74ec7686 authored tarafından Eike Rathke's avatar Eike Rathke

implement possessive genitive case month names locale data

New optional element GenitiveMonths within the Calendar element, after
MonthsOfYear. If not specified, the MonthsOfYear elements are taken.
üst 8eb050cb
...@@ -254,7 +254,7 @@ ...@@ -254,7 +254,7 @@
<!-- At least one Calendar element must be given if the RefLocale mechanism is not used! --> <!-- At least one Calendar element must be given if the RefLocale mechanism is not used! -->
<!ATTLIST LC_CALENDAR %RefLocale;> <!ATTLIST LC_CALENDAR %RefLocale;>
<!ELEMENT Calendar (DaysOfWeek, MonthsOfYear, Eras, StartDayOfWeek, MinimalDaysInFirstWeek) > <!ELEMENT Calendar (DaysOfWeek, MonthsOfYear, GenitiveMonths*, Eras, StartDayOfWeek, MinimalDaysInFirstWeek) >
<!ATTLIST Calendar %UNOModule;> <!ATTLIST Calendar %UNOModule;>
<!-- The unoid of a gregorian calendar MUST be lower case "gregorian", <!-- The unoid of a gregorian calendar MUST be lower case "gregorian",
calendars MUST match the names defined in the OASIS OpenDocument Format calendars MUST match the names defined in the OASIS OpenDocument Format
...@@ -283,6 +283,17 @@ ...@@ -283,6 +283,17 @@
<!-- Sequence of months is important, MUST start with the first month of a <!-- Sequence of months is important, MUST start with the first month of a
year, e.g. January in a Gregorian calendar. year, e.g. January in a Gregorian calendar.
--> -->
<!ELEMENT GenitiveMonths (Month*)>
<!-- Possessive genitive case month names, for example in Slavic locales. The
element is optional, but if present all Month elements of a Calendar must
be given if the RefLocale mechanism is not used! If not present,
MonthsOfYear names will be used. -->
<!ATTLIST GenitiveMonths %RefLocale;>
<!-- Sequence of months is important, MUST start with the first month of a
year, e.g. January in a Gregorian calendar.
-->
<!ELEMENT Month (MonthID, DefaultAbbrvName, DefaultFullName)> <!ELEMENT Month (MonthID, DefaultAbbrvName, DefaultFullName)>
<!ELEMENT MonthID (#PCDATA)> <!ELEMENT MonthID (#PCDATA)>
<!-- Preferably the lower case abbreviated English name like jan for January. --> <!-- Preferably the lower case abbreviated English name like jan for January. -->
......
...@@ -459,9 +459,13 @@ oslGenericFunction SAL_CALL lcl_LookupTableHelper::getFunctionSymbolByName( ...@@ -459,9 +459,13 @@ oslGenericFunction SAL_CALL lcl_LookupTableHelper::getFunctionSymbolByName(
} // anonymous namespace } // anonymous namespace
#define REF_DAYS 0
#define REF_MONTHS 1 // REF values equal offsets of counts within getAllCalendars() data structure!
#define REF_ERAS 2 #define REF_DAYS 0
#define REF_MONTHS 1
#define REF_GMONTHS 2
#define REF_ERAS 3
#define REF_OFFSET_COUNT 4
Sequence< CalendarItem > &LocaleData::getCalendarItemByName(const OUString& name, Sequence< CalendarItem > &LocaleData::getCalendarItemByName(const OUString& name,
const Locale& rLocale, const Sequence< Calendar >& calendarsSeq, sal_Int16 item) const Locale& rLocale, const Sequence< Calendar >& calendarsSeq, sal_Int16 item)
...@@ -485,7 +489,7 @@ Sequence< CalendarItem > &LocaleData::getCalendarItemByName(const OUString& name ...@@ -485,7 +489,7 @@ Sequence< CalendarItem > &LocaleData::getCalendarItemByName(const OUString& name
break; break;
} }
} }
// Refered locale does not found, return name for en_US locale. // Referred locale not found, return name for en_US locale.
if (index == cals.getLength()) { if (index == cals.getLength()) {
cals = getAllCalendars( cals = getAllCalendars(
Locale(OUString(RTL_CONSTASCII_USTRINGPARAM("en")), OUString(RTL_CONSTASCII_USTRINGPARAM("US")), OUString())); Locale(OUString(RTL_CONSTASCII_USTRINGPARAM("en")), OUString(RTL_CONSTASCII_USTRINGPARAM("US")), OUString()));
...@@ -513,12 +517,13 @@ LocaleData::getAllCalendars( const Locale& rLocale ) throw(RuntimeException) ...@@ -513,12 +517,13 @@ LocaleData::getAllCalendars( const Locale& rLocale ) throw(RuntimeException)
allCalendars = func(calendarsCount); allCalendars = func(calendarsCount);
Sequence< Calendar > calendarsSeq(calendarsCount); Sequence< Calendar > calendarsSeq(calendarsCount);
sal_Int16 offset = 3; sal_Int16 offset = REF_OFFSET_COUNT;
sal_Int16 i, j; sal_Int16 i, j;
for(i = 0; i < calendarsCount; i++) { for(i = 0; i < calendarsCount; i++) {
Sequence< CalendarItem > days(allCalendars[0][i]); Sequence< CalendarItem > days(allCalendars[REF_DAYS][i]);
Sequence< CalendarItem > months(allCalendars[1][i]); Sequence< CalendarItem > months(allCalendars[REF_MONTHS][i]);
Sequence< CalendarItem > eras(allCalendars[2][i]); //prep Sequence< CalendarItem > gmonths(allCalendars[REF_GMONTHS][i]);
Sequence< CalendarItem > eras(allCalendars[REF_ERAS][i]);
OUString calendarID(allCalendars[offset]); OUString calendarID(allCalendars[offset]);
offset++; offset++;
sal_Bool defaultCalendar = sal::static_int_cast<sal_Bool>( allCalendars[offset][0] ); sal_Bool defaultCalendar = sal::static_int_cast<sal_Bool>( allCalendars[offset][0] );
...@@ -527,7 +532,7 @@ LocaleData::getAllCalendars( const Locale& rLocale ) throw(RuntimeException) ...@@ -527,7 +532,7 @@ LocaleData::getAllCalendars( const Locale& rLocale ) throw(RuntimeException)
days = getCalendarItemByName(OUString(allCalendars[offset+1]), rLocale, calendarsSeq, REF_DAYS); days = getCalendarItemByName(OUString(allCalendars[offset+1]), rLocale, calendarsSeq, REF_DAYS);
offset += 2; offset += 2;
} else { } else {
for(j = 0; j < allCalendars[0][i]; j++) { for(j = 0; j < allCalendars[REF_DAYS][i]; j++) {
CalendarItem day(allCalendars[offset], CalendarItem day(allCalendars[offset],
allCalendars[offset+1], allCalendars[offset+2]); allCalendars[offset+1], allCalendars[offset+2]);
days[j] = day; days[j] = day;
...@@ -538,7 +543,7 @@ LocaleData::getAllCalendars( const Locale& rLocale ) throw(RuntimeException) ...@@ -538,7 +543,7 @@ LocaleData::getAllCalendars( const Locale& rLocale ) throw(RuntimeException)
months = getCalendarItemByName(OUString(allCalendars[offset+1]), rLocale, calendarsSeq, REF_MONTHS); months = getCalendarItemByName(OUString(allCalendars[offset+1]), rLocale, calendarsSeq, REF_MONTHS);
offset += 2; offset += 2;
} else { } else {
for(j = 0; j < allCalendars[1][i]; j++) { for(j = 0; j < allCalendars[REF_MONTHS][i]; j++) {
CalendarItem month(allCalendars[offset], CalendarItem month(allCalendars[offset],
allCalendars[offset+1], allCalendars[offset+2]); allCalendars[offset+1], allCalendars[offset+2]);
months[j] = month; months[j] = month;
...@@ -546,10 +551,21 @@ LocaleData::getAllCalendars( const Locale& rLocale ) throw(RuntimeException) ...@@ -546,10 +551,21 @@ LocaleData::getAllCalendars( const Locale& rLocale ) throw(RuntimeException)
} }
} }
if (OUString(allCalendars[offset]).equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("ref"))) { if (OUString(allCalendars[offset]).equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("ref"))) {
//prep gmonths = getCalendarItemByName(OUString(allCalendars[offset+1]), rLocale, calendarsSeq, REF_GMONTHS);
offset += 2;
} else {
for(j = 0; j < allCalendars[REF_GMONTHS][i]; j++) {
//prep CalendarItem gmonth(allCalendars[offset],
//prep allCalendars[offset+1], allCalendars[offset+2]);
//prep gmonths[j] = gmonth;
offset += 3;
}
}
if (OUString(allCalendars[offset]).equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("ref"))) {
eras = getCalendarItemByName(OUString(allCalendars[offset+1]), rLocale, calendarsSeq, REF_ERAS); eras = getCalendarItemByName(OUString(allCalendars[offset+1]), rLocale, calendarsSeq, REF_ERAS);
offset += 2; offset += 2;
} else { } else {
for(j = 0; j < allCalendars[2][i]; j++) { for(j = 0; j < allCalendars[REF_ERAS][i]; j++) {
CalendarItem era(allCalendars[offset], CalendarItem era(allCalendars[offset],
allCalendars[offset+1], allCalendars[offset+2]); allCalendars[offset+1], allCalendars[offset+2]);
eras[j] = era; eras[j] = era;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment