Bug 952957 - There should be adjective instead of nominative used in monthlyDayOfNth. r=philipp
authorDecathlon <bv1578@gmail.com>
Sun, 16 Feb 2014 10:10:38 +0100
changeset 19510 ffcb78ff2dd57ceea68520baae03fc7af70b9f72
parent 19509 32727e981b2d311fcc12e02edb569a8d68e327ed
child 19511 64b07ee8a79374d40c71d81a05c0c7303318c156
push id1133
push usermbanner@mozilla.com
push dateMon, 28 Apr 2014 19:42:02 +0000
treeherdercomm-beta@ca498fc736fc [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersphilipp
bugs952957
Bug 952957 - There should be adjective instead of nominative used in monthlyDayOfNth. r=philipp
calendar/base/modules/calRecurrenceUtils.jsm
calendar/locales/en-US/chrome/calendar/calendar-event-dialog.properties
calendar/test/calendars/l10n-rrule-details.ics
--- a/calendar/base/modules/calRecurrenceUtils.jsm
+++ b/calendar/base/modules/calRecurrenceUtils.jsm
@@ -182,38 +182,47 @@ function recurrenceRule2String(recurrenc
                                                         }
                                                         return false;
                                                     })) {
                             // i.e. every day every N months
                             ruleString = getRString("monthlyEveryDayOfNth");
                             ruleString = PluralForm.get(rule.interval, ruleString)
                                                    .replace("#2", rule.interval);
                         } else {
-                            // i.e. one or more monthdays every N months
+                            // i.e. one or more monthdays every N months.
+
+                            // Build a string with a list of days separated with commas.
                             let day_string = "";
+                            let ordinalSymbols = getRString("monthlyDaysOfNth_ordSymbol").split(",");
                             let lastDay = false;
                             for (let i = 0; i < component.length; i++) {
                                 if (component[i] == -1) {
                                     lastDay = true;
                                     continue;
                                 }
-                                day_string += component[i] + ", ";
+                                let dayOrdinalSymbol = ordinalSymbols[component[i] -1] || ordinalSymbols[0];
+                                day_string += component[i] + dayOrdinalSymbol + ", ";
                             }
                             if (lastDay) {
                                 day_string += getRString("monthlyLastDay") + ", ";
                             }
                             day_string = day_string.slice(0,-2)
                                          .replace(/,(?= [^,]*$)/, ' ' + getRString("repeatDetailsAnd"));
-                            let monthlyString = getRString("monthlyDayOfNth", [day_string]);
+
+                            // Add the word "day" in plural form to the list of days then
+                            // compose the final string with the interval of months
+                            let monthlyDayString = getRString("monthlyDaysOfNth_day", [day_string]);
+                            monthlyDayString = PluralForm.get(component.length, monthlyDayString);
+                            let monthlyString = getRString("monthlyDaysOfNth", [monthlyDayString]);
                             ruleString = PluralForm.get(rule.interval, monthlyString)
                                                    .replace("#2", rule.interval);
                         }
                     }
                 } else {
-                    let monthlyString = getRString("monthlyDayOfNth", [startDate.day]);
+                    let monthlyString = getRString("monthlyDaysOfNth", [startDate.day]);
                     ruleString = PluralForm.get(rule.interval, monthlyString)
                                            .replace("#2", rule.interval);
                 }
             } else if (rule.type == 'YEARLY') {
                 let bymonth = rule.getComponent("BYMONTH", {});
                 if (checkRecurrenceRule(rule, ['BYMONTH']) &&
                     checkRecurrenceRule(rule, ['BYMONTHDAY'])) {
                     let bymonthday = rule.getComponent("BYMONTHDAY", {});
--- a/calendar/locales/en-US/chrome/calendar/calendar-event-dialog.properties
+++ b/calendar/locales/en-US/chrome/calendar/calendar-event-dialog.properties
@@ -109,22 +109,46 @@ ordinalWeekdayOrder=%1$S %2$S
 # "nounclass..." must be written in 'repeatDetailsDayxNounclass' strings.
 # %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
 # 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
 
-# LOCALIZATION NOTE (monthlyDayOfNth):
+# LOCALIZATION NOTE (monthlyDaysOfNth_ordSymbol):
 # Edit recurrence window -> Recurrence pattern -> Monthly repeat rules
-# %1$S - day of month
-# #2 - month interval
-# e.g. "day 3 of every 2 months"
-monthlyDayOfNth=day %1$S of every month;day %1$S of every #2 months
+# Allows to insert a string, a character or a symbol after the numbers of a day
+# in a monthly rule monthlyDaysOfNth in order to give to each day number the
+# meaning of ordinal number (e.g.  1 -> 1st; 2 -> 2nd etc.).
+# Use a single string if the symbol used is the same for every monthday, otherwise
+# write a sequence of _31_ strings (one for every monthday) separated with commas.
+# If your language doesn't require that in monthlyDaysOfNth, leave it empty.
+# e.g.
+# monthlyDaysOfNth_ordSymbol=.
+#    -> "Occurs days 1., 2., 10. and 11. of every 2 months"
+# monthlyDaysOfNth_ordSymbol=st,nd,rd,th,th,th,th,th,th,th,th,th,th,th,th,
+#                            th,th,th,th,th,st,nd,rd,th,th,th,th,th,th,th,st
+#    -> "Occurs days 1st, 2nd, 10th and 11th of every 2 months"
+monthlyDaysOfNth_ordSymbol=
+
+# LOCALIZATION NOTE (monthlyDaysOfNth_day):
+# Edit recurrence window -> Recurrence pattern -> Monthly repeat rules
+# %1$S - day of month or a sequence of days of month, eventually with ordinal symbol
+#        coming from monthlyDaysOfNth_ordSymbol, separated with commas;
+# e.g. "days 3, 6 and 9" or "days 3rd, 6th and 9th"
+monthlyDaysOfNth_day=day %1$S;days %1$S
+
+# LOCALIZATION NOTE (monthlyDaysOfNth):
+# Edit recurrence window -> Recurrence pattern -> Monthly repeat rules
+# %1$S - it's the strig monthlyDaysOfNth_day: day of month or a sequence of days
+#        of month, eventually with ordinal symbol, separated with commas;
+# #2   - monthly interval
+# e.g. "days 3, 6, 9 and 12 of every 3 months"
+monthlyDaysOfNth=%1$S of every month;%1$S of every #2 months
 
 # LOCALIZATION NOTE (monthlyLastDayOfNth):
 # Edit recurrence window -> Recurrence pattern -> Monthly repeat rules
 # %1$S - day of month
 # #2 - month interval
 # e.g. "the last day of every 3 months"
 monthlyLastDayOfNth=the last day of the month; the last day of every #1 months
 
@@ -254,45 +278,45 @@ repeatCountAllDay=Occurs %1$S\neffective
 #  from 5:00 PM to 6:00 PM"
 repeatDetailsUntil=Occurs %1$S\neffective %2$S until %3$S\nfrom %4$S to %5$S.
 
 # LOCALIZATION NOTE (repeatDetailsUntilAllDay):
 # Edit recurrence window -> Recurrence details link on Event/Task dialog window
 # %1%$ - A rule string (see above). This is the first line of the link
 # %2%$ - event start date (e.g. mm/gg/yyyy)
 # %3$S - event end date (e.g. mm/gg/yyyy)
-# e.g. with monthlyDayOfNth and all day event:
+# e.g. with monthlyDaysOfNth and all day event:
 # "Occurs day 3 of every 5 month
 #  effective 1/1/2009 until 1/1/2010"
 repeatDetailsUntilAllDay=Occurs %1$S\neffective %2$S until %3$S.
 
 # LOCALIZATION NOTE (repeatDetailsInfinite):
 # Edit recurrence window -> Recurrence details link on Event/Task dialog window
 # %1%$ - A rule string (see above). This is the first line of the link
 # %2%$ - event start date (e.g. mm/gg/yyyy)
 # %3$S - event start time (e.g. hh:mm (PM/AM))
 # %4$S - event end time (e.g. hh:mm (PM/AM))
-# e.g. with monthlyDayOfNth:
+# e.g. with monthlyDaysOfNth:
 # "Occurs day 3 of every 5 month
 #  effective 1/1/2009
 #  from 5:00 PM to 6:00 PM"
 repeatDetailsInfinite=Occurs %1$S\neffective %2$S\nfrom %3$S to %4$S.
 
 # LOCALIZATION NOTE (repeatDetailsInfiniteAllDay):
 # Edit recurrence window -> Recurrence details link on Event/Task dialog window
 # %1%$ - A rule string (see above). This is the first line of the link
 # %2%$ - event start date (e.g. mm/gg/yyyy)
-# e.g. with monthlyDayOfNth and all day event:
+# e.g. with monthlyDaysOfNth and all day event:
 # "Occurs day 3 of every 5 month
 #  effective 1/1/2009"
 repeatDetailsInfiniteAllDay=Occurs %1$S\neffective %2$S.
 
 # LOCALIZATION NOTE (monthlyLastDay):
 # Edit recurrence window -> Recurrence details link on Event/Task dialog window
-# A monthly rule with one or more days of the month (monthlyDayOfNth) and the
+# A monthly rule with one or more days of the month (monthlyDaysOfNth) and the
 # string "the last day" of the month.
 # e.g.: "Occurs day 15, 20, 25 and the last day of every 3 months"
 monthlyLastDay=the last day
 
 # LOCALIZATION NOTE (ruleTooComplex):
 # This string is shown in the repeat details area if our code can't handle the
 # complexity of the recurrence rule yet.
 ruleTooComplex=Click here for details
--- a/calendar/test/calendars/l10n-rrule-details.ics
+++ b/calendar/test/calendars/l10n-rrule-details.ics
@@ -153,31 +153,31 @@ DTEND:20090121T190000Z
 RRULE:FREQ=MONTHLY;BYDAY=-1WE;INTERVAL=5
 SUMMARY:monthlyRuleNthOfEvery,Nth=-1,Interval=5
 END:VEVENT
 BEGIN:VEVENT
 UID:monthlyLastDayOfNth-1
 DTSTART:20090121T200000Z
 DTEND:20090121T210000Z
 RRULE:FREQ=MONTHLY;BYMONTHDAY=1,3,5,7,9,11,13,15;INTERVAL=1
-SUMMARY:monthlyDayOfNth,Nth=1,3,5,7,9,11,13,15,Interval=1
+SUMMARY:monthlyDaysOfNth,Nth=1,3,5,7,9,11,13,15,Interval=1
 END:VEVENT
 BEGIN:VEVENT
 UID:monthlyLastDayOfNth-2
 DTSTART:20090121T210000Z
 DTEND:20090121T220000Z
 RRULE:FREQ=MONTHLY;BYMONTHDAY=1,3,5,7,9,11,13,15;INTERVAL=2
-SUMMARY:monthlyDayOfNth,Nth=1,3,5,7,9,11,13,15,Interval=2
+SUMMARY:monthlyDaysOfNth,Nth=1,3,5,7,9,11,13,15,Interval=2
 END:VEVENT
 BEGIN:VEVENT
 UID:monthlyLastDayOfNth-3
 DTSTART:20090121T220000Z
 DTEND:20090121T230000Z
 RRULE:FREQ=MONTHLY;BYMONTHDAY=1,3,5,7,9,11,13,15;INTERVAL=3
-SUMMARY:monthlyDayOfNth,Nth=1,3,5,7,9,11,13,15,Interval=3
+SUMMARY:monthlyDaysOfNth,Nth=1,3,5,7,9,11,13,15,Interval=3
 END:VEVENT
 BEGIN:VEVENT
 UID:monthlyLastDayOfNth-1
 DTSTART:20090121T220000Z
 DTEND:20090121T230000Z
 RRULE:FREQ=MONTHLY;BYMONTHDAY=-1;INTERVAL=1
 SUMMARY:monthlyLastDayOfNth,Nth=-1,Interval=1
 END:VEVENT