Fix bug 502435 - Recurrence summary shows only the first weekday of a monthly rule with BYDAY tag and more weekdays. r=philipp

--HG--
extra : rebase_source : 3fcaa9f49bfc68bef207444e4bd75cc8ffb3099f
This commit is contained in:
Decathlon 2010-03-31 14:23:00 +02:00
Родитель 6891c4c198
Коммит 9e81817150
3 изменённых файлов: 96 добавлений и 61 удалений

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

@ -151,29 +151,51 @@ function recurrenceRule2String(recurrenceInfo, startDate, endDate, allDay) {
}
} else if (rule.type == 'MONTHLY') {
if (checkRecurrenceRule(rule, ['BYDAY'])) {
let weekdaysString_every = "";
let weekdaysString_position = "";
let byday = rule.getComponent("BYDAY", {});
if (day_position(byday[0]) == 0) {
// i.e every MONDAY of every N months
let monthlyString = "monthlyEveryOfEvery";
let dayString = "repeatDetailsDay" + day_of_week(byday[0]);
let day = getRString(pluralWeekday(dayString));
monthlyString = nounClass(dayString, monthlyString);
monthlyString = getRString(monthlyString, [day]);
ruleString = PluralForm.get(rule.interval, monthlyString)
.replace("#2", rule.interval);
} else {
// i.e the FIRST MONDAY of every N months
let monthlyString = "monthlyNthOfEvery";
let ordinalString = "repeatOrdinal" + day_position(byday[0]);
let dayString = "repeatDetailsDay" + day_of_week(byday[0]);
monthlyString = nounClass(dayString, monthlyString);
ordinalString = nounClass(dayString, ordinalString);
let day = getRString(dayString);
let ordinal = getRString(ordinalString);
monthlyString = getRString(monthlyString, [ordinal, day]);
ruleString = PluralForm.get(rule.interval, monthlyString)
.replace("#3", rule.interval);
let firstDay = byday[0];
// build two strings for weekdays with and without
// "position" prefix, then join these strings
for (let i = 0 ; i < byday.length; i++) {
if (day_position(byday[i]) == 0) {
if (!weekdaysString_every) {
firstDay = byday[i];
}
weekdaysString_every += getRString(pluralWeekday("repeatDetailsDay" + byday[i])) + ", ";
} else {
if (day_position(byday[i]) < -1 || day_position(byday[i]) > 5) {
// we support only weekdays with -1 as negative
// position ('THE LAST ...')
return getRString("ruleTooComplex");
}
if (byday.some(function(element) {
return (day_position(element) == 0 &&
day_of_week(byday[i]) == day_of_week(element));
})) {
// prevent to build strings such as for example:
// "every Monday and the second Monday..."
continue;
}
let ordinalString = "repeatOrdinal" + day_position(byday[i]);
let dayString = "repeatDetailsDay" + day_of_week(byday[i]);
ordinalString = nounClass(dayString, ordinalString);
ordinalString = getRString(ordinalString);
dayString = getRString(dayString);
let stringOrdinalWeekday = getRString("ordinalWeekdayOrder",
[ordinalString, dayString]);
weekdaysString_position += stringOrdinalWeekday + ", ";
}
}
let weekdaysString = weekdaysString_every + weekdaysString_position;
weekdaysString = weekdaysString.slice(0,-2).
replace(/,(?= [^,]*$)/, ' ' + getRString("repeatDetailsAnd"));
let monthlyString = weekdaysString_every ? "monthlyEveryOfEvery" : "monthlyRuleNthOfEvery";
monthlyString = nounClass("repeatDetailsDay" + day_of_week(firstDay), monthlyString);
monthlyString = getRString(monthlyString, [weekdaysString]);
ruleString = PluralForm.get(rule.interval, monthlyString).
replace("#2", rule.interval);
} else if (checkRecurrenceRule(rule, ['BYMONTHDAY'])) {
let component = rule.getComponent("BYMONTHDAY", {});

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

@ -46,12 +46,12 @@ repeatDetailsRuleDaily4=every weekday
# LOCALIZATION NOTE (weeklyNthOnNounclass...)
# Edit recurrence window -> Recurrence pattern -> Weekly repeat rules
# Translate these strings according to noun class/gender of weekday (%1$S)
# Translate these strings according to noun class/gender of weekday (%1$S)
# set in 'repeadDetailsDay...Nounclass' strings.
# Nounclass1 <-> Masculine gender; Nounclass2 <-> Feminine gender.
# Add others strings with suffix 3, 4,... for others noun classes if your
# language need them. In this case, corresponding strings must be added for
# others rule strings with 'Nounclass...' suffix and corresponding values
# others rule strings with 'Nounclass...' suffix and corresponding values
# "nounclass..." must be written in 'repeatDetailsDayxNounclass' strings.
# %1$S - weekday (one or more)
# #2 - week interval
@ -77,11 +77,11 @@ weeklyEveryNth=every week;every #1 weeks
# "nounclass2" for languages with grammatical genders -> FEMININE gender;
# for languages with noun classes -> a different noun class.
#
# "nounclass3", "nounclass4" and so on for languages that need more than two
# "nounclass3", "nounclass4" and so on for languages that need more than two
# noun classes for weekdays. In this case add corresponding
# rule string with "Nounclass..." suffix and ordinal string
# "repeatOrdinalxNounclass..."
# Will be used rule strings with "Nounclass..." suffix corresponding to the
# Will be used rule strings with "Nounclass..." suffix corresponding to the
# following strings if there is a weekday in the rule string.
repeatDetailsDay1=Sunday
repeatDetailsDay1Nounclass=nounclass1
@ -103,35 +103,48 @@ repeatDetailsDay7Nounclass=nounclass1
# i.e. "Sunday, Monday, Tuesday " + and + " Wednesday"
repeatDetailsAnd=and
# LOCALIZATION NOTE (monthlyNthOfEveryNounclass...):
# LOCALIZATION NOTE (monthlyRuleNthOfEveryNounclass...):
# Edit recurrence window -> Recurrence pattern -> Monthly repeat rules
# Translate these strings according to noun class/gender of weekday (%2$S)
# Translate these strings according to noun class/gender of weekday (%2$S)
# set in 'repeadDetailsDay...Nounclass' strings.
# Nounclass1 <-> Masculine gender; Nounclass2 <-> Feminine gender.
# Add others strings with suffix 3, 4,... for others noun classes if your
# language need them. In this case, corresponding strings must be added for
# others rule strings with 'Nounclass...' suffix and corresponding values
# "nounclass..." must be written in 'repeatDetailsDayxNounclass' strings.
# %1$S - ordinal with article and noun class/gender corresponding to weekday
# %2$S - weekday
# #3 - interval
# i.e. "the FIRST MONDAY of every 3 months"
monthlyNthOfEveryNounclass1=%1$S %2$S of every month;%1$S %2$S of every #3 months
monthlyNthOfEveryNounclass2=%1$S %2$S of every month;%1$S %2$S of every #3 months
# others rule strings with 'Nounclass...' suffix and corresponding values
# "nounclass..." must be written in 'repeatDetailsDayxNounclass' strings.
# %1$S - list of weekdays with ordinal, article and noun class/gender
# (ordinal and weekday of every element in the list follow the order
# and the rule of ordinalWeekdayOrder string)
# #2 - interval
# e.g. "the first Monday and the last Friday of every 3 months"
monthlyRuleNthOfEveryNounclass1=%1$S of every month;%1$S of every #2 months
monthlyRuleNthOfEveryNounclass2=%1$S of every month;%1$S of every #2 months
# LOCALIZATION NOTE (ordinalWeekdayOrder):
# Edit recurrence window -> Recurrence pattern -> Monthly repeat rules
# This string allows to change the order of the elements "ordinal" and
# "weekday" (or to insert a word between them) for the argument %1$S of the
# string monthlyRuleNthOfEveryNounclass...
# Without changing this string, the order is that one required from most
# languages: ordinal + weekday (e.g. "'the first' 'Monday' of every 2 months").
# %1$S - ordinal with article
# %2$S - weekday noun
# e.g. "'the first' 'Monday'"
ordinalWeekdayOrder=%1$S %2$S
# LOCALIZATION NOTE (monthlyEveryOfEveryNounclass...):
# Edit recurrence window -> Recurrence pattern -> Monthly repeat rules
# Translate these strings according to noun class/gender of weekday (%1$S)
# Translate these strings according to noun class/gender of weekday (%1$S)
# set in 'repeadDetailsDay...Nounclass' strings.
# Nounclass1 <-> Masculine gender; Nounclass2 <-> Feminine gender.
# Add others strings with suffix 3, 4,... for others noun classes if your
# language need them. In this case, corresponding strings must be added for
# others rule strings with 'Nounclass...' suffix and corresponding values
# others rule strings with 'Nounclass...' suffix and corresponding values
# "nounclass..." must be written in 'repeatDetailsDayxNounclass' strings.
# %1$S - weekday
# %1$S - list of single weekdays and/or weekdays with ordinal, article and
# noun class/gender when rule contains also specific day in the month
# #2 - interval
# i.e. "every MONDAY of every 3 months"
# more specific: every monday of January, April, July, October
# e.g. "every Monday, Tuesday and the second Sunday of every month"
monthlyEveryOfEveryNounclass1=every %1$S of every month;every %1$S of every #2 months
monthlyEveryOfEveryNounclass2=every %1$S of every month;every %1$S of every #2 months
@ -161,8 +174,8 @@ monthlyEveryDayOfNth=every day of every month;every day of the month every #2 mo
# localization according to genders or noun classes.
# Nounclass1 <-> Masculine gender; Nounclass2 <-> Feminine gender.
# Add 'repeatOrdinal...Nounclass' strings with suffix 3, 4 and so on for
# languages with more than two noun classes for weekdays. In this case
# must be added corresponding rule strings with 'Nounclass...' suffix and
# languages with more than two noun classes for weekdays. In this case
# must be added corresponding rule strings with 'Nounclass...' suffix and
# corresponding values "nounclass..." must be written in
# 'repeatDetailsDayxNounclass' strings.
repeatOrdinal1Nounclass1=the first
@ -188,12 +201,12 @@ yearlyNthOn=every %1$S %2$S;every #3 years on %1$S %2$S
# LOCALIZATION NOTE (yearlyNthOnNthOfNounclass...):
# Edit recurrence window -> Recurrence pattern -> Yearly repeat rules
# Translate these strings according to noun class/gender of weekday (%2$S)
# Translate these strings according to noun class/gender of weekday (%2$S)
# set in 'repeadDetailsDay...Nounclass' strings.
# Nounclass1 <-> Masculine gender; Nounclass2 <-> Feminine gender.
# Add others strings with suffix 3, 4,... for others noun classes if your
# language need them. In this case, corresponding strings must be added for
# others rule strings with 'Nounclass...' suffix and corresponding values
# others rule strings with 'Nounclass...' suffix and corresponding values
# "nounclass..." must be written in 'repeatDetailsDayxNounclass' strings.
# %1$S - ordinal with article and noun class/gender corresponding to weekday
# %2$S - weekday
@ -206,12 +219,12 @@ yearlyNthOnNthOfNounclass2=%1$S %2$S of every %3$S;every #4 years on %1$S %2$S o
# LOCALIZATION NOTE (yearlyOnEveryNthOfNthNounclass1):
# Edit recurrence window -> Recurrence pattern -> Yearly repeat rules
# Translate these strings according to noun class/gender of weekday (%1$S)
# Translate these strings according to noun class/gender of weekday (%1$S)
# set in 'repeadDetailsDay...Nounclass' strings.
# Nounclass1 <-> Masculine gender; Nounclass2 <-> Feminine gender.
# Add others strings with suffix 3, 4,... for others noun classes if your
# language need them. In this case, corresponding strings must be added for
# others rule strings with 'Nounclass...' suffix and corresponding values
# others rule strings with 'Nounclass...' suffix and corresponding values
# "nounclass..." must be written in 'repeatDetailsDayxNounclass' strings.
# %1$S - weekday
# %2$S - month
@ -241,7 +254,7 @@ repeatDetailsMonth12=December
# %3$S - event start time (e.g. hh:mm (PM/AM))
# %4$S - event end time (e.g. hh:mm (PM/AM))
# #5 - event occurence times: number
# e.g. with monthlyNthOfEvery:
# e.g. with monthlyRuleNthOfEvery:
# "Occurs the first Sunday of every 3 month
# only on 1/1/2009"
# from 5:00 PM to 6:00 PM"
@ -255,7 +268,7 @@ repeatCount=Occurs %1$S\neffective %2$S for #5 time\nfrom %3$S to %4$S.;Occurs %
# %1%$ - A rule string (see above). This is the first line of the link
# %2%$ - event start date (e.g. mm/gg/yyyy)
# #3 - event occurence times: number
# e.g. with monthlyNthOfEvery:
# e.g. with monthlyRuleNthOfEvery:
# "Occurs the first Sunday of every 3 month
# only on 1/1/2009"
# "Occurs the first Sunday of every 3 month
@ -271,7 +284,7 @@ repeatCountAllDay=Occurs %1$S\neffective %2$S for #3 time.;Occurs %1$S\neffectiv
# %5$S - event end time (e.g. hh:mm (PM/AM))
# e.g. with weeklyNthOn:
# "Occurs every 2 weeks on Sunday and Friday
# effective 1/1/2009 until 1/1/2010
# effective 1/1/2009 until 1/1/2010
# from 5:00 PM to 6:00 PM"
repeatDetailsUntil=Occurs %1$S\neffective %2$S until %3$S\nfrom %4$S to %5$S.

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

@ -112,46 +112,46 @@ RRULE:FREQ=MONTHLY;BYDAY=WE;INTERVAL=3
SUMMARY:monthlyEveryOfEvery,Interval=3
END:VEVENT
BEGIN:VEVENT
UID:monthlyNthOfEvery-1
UID:monthlyRuleNthOfEvery-1
DTSTART:20090121T130000Z
DTEND:20090121T140000Z
RRULE:FREQ=MONTHLY;BYDAY=1WE;INTERVAL=1
SUMMARY:monthlyNthOfEvery,Nth=1,Interval=1
SUMMARY:monthlyRuleNthOfEvery,Nth=1,Interval=1
END:VEVENT
BEGIN:VEVENT
UID:monthlyNthOfEvery-2
UID:monthlyRuleNthOfEvery-2
DTSTART:20090121T140000Z
DTEND:20090121T150000Z
RRULE:FREQ=MONTHLY;BYDAY=2WE;INTERVAL=2
SUMMARY:monthlyNthOfEvery,Nth=2,Interval=2
SUMMARY:monthlyRuleNthOfEvery,Nth=2,Interval=2
END:VEVENT
BEGIN:VEVENT
UID:monthlyNthOfEvery-3
UID:monthlyRuleNthOfEvery-3
DTSTART:20090121T150000Z
DTEND:20090121T160000Z
RRULE:FREQ=MONTHLY;BYDAY=3WE;INTERVAL=3
SUMMARY:monthlyNthOfEvery,Nth=3Interval=3
SUMMARY:monthlyRuleNthOfEvery,Nth=3Interval=3
END:VEVENT
BEGIN:VEVENT
UID:monthlyNthOfEvery-4
UID:monthlyRuleNthOfEvery-4
DTSTART:20090121T160000Z
DTEND:20090121T170000Z
RRULE:FREQ=MONTHLY;BYDAY=4WE;INTERVAL=4
SUMMARY:monthlyNthOfEvery,Nth=4,Interval=4
SUMMARY:monthlyRuleNthOfEvery,Nth=4,Interval=4
END:VEVENT
BEGIN:VEVENT
UID:monthlyNthOfEvery-5
UID:monthlyRuleNthOfEvery-5
DTSTART:20090121T170000Z
DTEND:20090121T180000Z
RRULE:FREQ=MONTHLY;BYDAY=5WE;INTERVAL=5
SUMMARY:monthlyNthOfEvery,Nth=5,Interval=5
SUMMARY:monthlyRuleNthOfEvery,Nth=5,Interval=5
END:VEVENT
BEGIN:VEVENT
UID:monthlyNthOfEvery-6
UID:monthlyRuleNthOfEvery-6
DTSTART:20090121T180000Z
DTEND:20090121T190000Z
RRULE:FREQ=MONTHLY;BYDAY=-1WE;INTERVAL=5
SUMMARY:monthlyNthOfEvery,Nth=-1,Interval=5
SUMMARY:monthlyRuleNthOfEvery,Nth=-1,Interval=5
END:VEVENT
BEGIN:VEVENT
UID:monthlyLastDayOfNth-1