Fix bug 621840 - the month name displayed in calendar is in an incorrect form. r=Decathlon

--HG--
extra : rebase_source : aa4d14310984ba1bba3b56d3a5974778938fd50a
This commit is contained in:
Philipp Kewisch 2011-02-05 16:55:24 +01:00
Родитель 927b555cbc
Коммит 9e2a7dde95
5 изменённых файлов: 95 добавлений и 16 удалений

Просмотреть файл

@ -242,7 +242,8 @@
</method>
<method name="getRangeDescription">
<body><![CDATA[
let monthName = calGetString("dateFormat", "month." + (this.rangeStartDate.month + 1) + ".name");
let monthName = cal.formatMonth(this.rangeStartDate.month + 1,
"calendar", "monthInYear");
return calGetString("calendar", "monthInYear", [monthName, this.rangeStartDate.year]);
]]></body>
</method>

Просмотреть файл

@ -378,6 +378,24 @@ let cal = {
return aStringArray;
},
/**
* Gets the month name string in the right form depending on a base string.
*
* @param aMonthNum The month numer to get, 1-based.
* @param aBundleName The Bundle to get the string from
* @param aStringBase The base string name, .monthFormat will be appended
*/
formatMonth: function formatMonth(aMonthNum, aBundleName, aStringBase) {
let monthForm = cal.calGetString(aBundleName, aStringBase + ".monthFormat") || "nominative";
if (monthForm == "nominative") {
// Fall back to the default name format
monthForm = "name";
}
return cal.calGetString("dateFormat", "month." + aMonthNum + "." + monthForm);
},
/**
* moves an item to another startDate
*

Просмотреть файл

@ -214,17 +214,20 @@ calDateTimeFormatter.prototype = {
if (sameDay) {
return this.formatDateLong(aStartDate);
} else {
let startMonthName = this.monthName(aStartDate.month);
let startDay = aStartDate.day;
let startYear = aStartDate.year;
let endMonthName = this.monthName(endDate.month);
let endDay = endDate.day;
let endYear = endDate.year;
if (aStartDate.year != endDate.year) {
let startMonthName = cal.formatMonth(aStartDate.month + 1, "calendar", "dayIntervalBetweenYears");
let endMonthName = cal.formatMonth(aEndDate.month + 1, "calendar", "dayIntervalBetweenYears");
return calGetString("calendar", "dayIntervalBetweenYears", [startMonthName, startDay, startYear, endMonthName, endDay, endYear]);
} else if (aStartDate.month != endDate.month) {
let startMonthName = cal.formatMonth(aStartDate.month + 1, "calendar", "dayIntervalBetweenMonths");
let endMonthName = cal.formatMonth(aEndDate.month + 1, "calendar", "dayIntervalBetweenMonths");
return calGetString("calendar", "dayIntervalBetweenMonths", [startMonthName, startDay, endMonthName, endDay, endYear]);
} else {
let startMonthName = cal.formatMonth(aStartDate.month + 1, "calendar", "dayIntervalInMonth");
return calGetString("calendar", "dayIntervalInMonth", [startMonthName, startDay, endDay, endYear]);
}
}
@ -283,7 +286,7 @@ calDateTimeFormatter.prototype = {
return this.mDateStringBundle.GetStringFromName("month." + oneBasedMonthIndex + ".Mmm" );
},
dayName: function monthName(aDayIndex) {
dayName: function dayName(aDayIndex) {
let oneBasedDayIndex = aDayIndex + 1;
return this.mDateStringBundle.GetStringFromName("day." + oneBasedDayIndex + ".name" );
},

Просмотреть файл

@ -521,6 +521,12 @@ dueInLessThanOneHour=< 1 hour
# %2$S will be replaced with the year
monthInYear=%1$S %2$S
# LOCALIZATION NOTE (monthInYear.monthFormat):
# If your language requires a different declension, change this to
# one of the values specified in dateFormat.properties.
# In any case, DO NOT TRANSLATE.
monthInYear.monthFormat=nominative
# LOCALIZATION NOTE (dayIntervalInMonth):
# used for display of intervals in the form of 'March 3 - 9, 2008'
# %1$S will be replaced with name of the month of the start date
@ -529,6 +535,12 @@ monthInYear=%1$S %2$S
# %4$S will be replaced with the common year of both dates
dayIntervalInMonth=%1$S %2$S – %3$S, %4$S
# LOCALIZATION NOTE (dayIntervalInMonth.monthFormat):
# If your language requires a different declension, change this to
# one of the values specified in dateFormat.properties.
# In any case, DO NOT TRANSLATE.
dayIntervalInMonth.monthFormat=nominative
# LOCALIZATION NOTE (dayIntervalBetweenMonths):
# used for display of intervals in the form 'September 29 - October 5, 2008'
# %1$S will be replaced with name of the month of the start date
@ -538,6 +550,12 @@ dayIntervalInMonth=%1$S %2$S – %3$S, %4$S
# %5$S will be replaced with the commmon year of both dates
dayIntervalBetweenMonths=%1$S %2$S – %3$S %4$S, %5$S
# LOCALIZATION NOTE (dayIntervalBetweenMonths.monthFormat):
# If your language requires a different declension, change this to
# one of the values specified in dateFormat.properties.
# In any case, DO NOT TRANSLATE.
dayIntervalBetweenMonths.monthFormat=nominative
# LOCALIZATION NOTE (dayIntervalBetweenYears):
# used for display of intervals in the form 'December 29, 2008 - January 4, 2009'
# %1$S will be replaced with name of the month of the start date
@ -548,6 +566,12 @@ dayIntervalBetweenMonths=%1$S %2$S – %3$S %4$S, %5$S
# %6$S will be replaced with the year of the end date
dayIntervalBetweenYears=%1$S %2$S, %3$S – %4$S %5$S, %6$S
# LOCALIZATION NOTE (dayIntervalBetweenYears.monthFormat):
# If your language requires a different declension, change this to
# one of the values specified in dateFormat.properties.
# In any case, DO NOT TRANSLATE.
dayIntervalBetweenYears.monthFormat=nominative
# LOCALIZATION NOTE (datetimeIntervalOnSameDateTime):
# used for intervals where end is equals to start
# displayed form is '5 Jan 2006 13:00'

Просмотреть файл

@ -36,19 +36,21 @@
#
# ***** END LICENSE BLOCK *****
month.1.Mmm=Jan
month.2.Mmm=Feb
month.3.Mmm=Mar
month.4.Mmm=Apr
month.5.Mmm=May
month.6.Mmm=Jun
month.7.Mmm=Jul
month.8.Mmm=Aug
month.9.Mmm=Sep
month.10.Mmm=Oct
month.11.Mmm=Nov
month.12.Mmm=Dec
# In case you are looking for the note about different declensions on date
# formats, here it is. If your language doesn't use different declensions of
# month names, you shouldn't have much work. Just leave the *.monthFormat
# string on "nominative" and the string month.*.name will be filled in.
#
# If you need a different form for a string, you can change the
# *.monthFormat to a different value. Supported values are currently:
# nominative (default), genitive
# The modified month name form will then be filled in accordingly. If this
# system does not suit your needs, please file a bug!
# LOCALIZATION NOTE (month.*.name):
# Some languages require different declensions of month names.
# These values will be used if *.monthFormat is set to "nominative" or in places
# where using a different declension is not yet supported.
month.1.name=January
month.2.name=February
month.3.name=March
@ -62,6 +64,37 @@ month.10.name=October
month.11.name=November
month.12.name=December
# LOCALIZATION NOTE (month.*.genitive):
# Some languages require different declensions of month names.
# These values will be used if *.monthFormat is set to "genitive"
# If your language doesn't use different declensions, just set the same
# values as for month.*.name.
month.1.genitive=January
month.2.genitive=February
month.3.genitive=March
month.4.genitive=April
month.5.genitive=May
month.6.genitive=June
month.7.genitive=July
month.8.genitive=August
month.9.genitive=September
month.10.genitive=October
month.11.genitive=November
month.12.genitive=December
month.1.Mmm=Jan
month.2.Mmm=Feb
month.3.Mmm=Mar
month.4.Mmm=Apr
month.5.Mmm=May
month.6.Mmm=Jun
month.7.Mmm=Jul
month.8.Mmm=Aug
month.9.Mmm=Sep
month.10.Mmm=Oct
month.11.Mmm=Nov
month.12.Mmm=Dec
day.1.name=Sunday
day.2.name=Monday
day.3.name=Tuesday