Bug 466996 - Implement single / plural form in alarmWindowTitle. r=philipp
authorVlado Valastiak <wladow@gmail.com>
Thu, 27 Nov 2008 21:26:04 +0100
changeset 1249 d88b39fbf6977ef806cd7e21ea170b033db359c0
parent 1248 6a2107f99390f4faad09cc51edd8bf419d7c1126
child 1250 a9abcbb479da2bbc4f44a55d4741e83af8667247
push id974
push usermschroeder@mozilla.x-home.org
push dateThu, 27 Nov 2008 20:26:17 +0000
treeherdercomm-central@d88b39fbf697 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersphilipp
bugs466996
Bug 466996 - Implement single / plural form in alarmWindowTitle. r=philipp
calendar/base/content/calendar-alarm-dialog.js
calendar/locales/en-US/chrome/calendar/calendar.properties
--- a/calendar/base/content/calendar-alarm-dialog.js
+++ b/calendar/base/content/calendar-alarm-dialog.js
@@ -36,16 +36,19 @@
  *
  * ***** END LICENSE BLOCK ***** */
 
 /**
  * Helper function to get the alarm service and cache it.
  *
  * @return The alarm service component
  */
+
+Components.utils.import("resource://gre/modules/PluralForm.jsm");
+
 function getAlarmService() {
     if (!window.mAlarmService) {
         window.mAlarmService = Components.classes["@mozilla.org/calendar/alarm-service;1"]
                                          .getService(Components.interfaces.calIAlarmService);
     }
     return window.mAlarmService;
 }
 
@@ -208,17 +211,18 @@ function snoozeAllItems(aDurationMinutes
 
 /**
  * Sets up the window title, counting the number of alarms in the window.
  */
 function setupTitle() {
     var alarmRichlist = document.getElementById("alarm-richlist");
     var reminders = alarmRichlist.childNodes.length;
 
-    document.title = calGetString("calendar", "alarmWindowTitle", [reminders]);
+    let title = PluralForm.get(reminders, calGetString("calendar", "alarmWindowTitle.label")); 
+    document.title = title.replace("#1", reminders);
 }
 
 /**
  * Add an alarm widget for the passed calendar item
  *
  * @param aItem       The calendar item to add a widget for.
  */
 function addWidgetFor(aItem) {
--- a/calendar/locales/en-US/chrome/calendar/calendar.properties
+++ b/calendar/locales/en-US/chrome/calendar/calendar.properties
@@ -366,20 +366,19 @@ updatesItem_defaultFallback=Check for Updates…
 updatesItem_downloading=Downloading %S…
 updatesItem_downloadingFallback=Downloading Update…
 updatesItem_resume=Resume Downloading %S…
 updatesItem_resumeFallback=Resume Downloading Update…
 updatesItem_pending=Apply Downloaded Update Now…
 updatesItem_pendingFallback=Apply Downloaded Update Now…
 
 # Alarm Dialog
-# LOCALIZATION NOTE (alarmWindowTitle):
-# used for a dialog title indicating numbers of reminders like '4 Reminders'
-#    %1$S will be replaced with the number of reminders
-alarmWindowTitle=%1$S Reminders
+# LOCALIZATION NOTE (alarmWindowTitle.label): Semi-colon list of plural
+# forms. See: http://developer.mozilla.org/en/docs/Localization_and_Plurals
+alarmWindowTitle.label=#1 Reminder;#1 Reminders
 
 # LOCALIZATION NOTE (alarmStarts):
 # used for a display the start of an alarm like 'Starts:  Thu 2 Oct 2008 13:21'
 #    %1$S will be replaced with a date-time
 alarmStarts=Starts: %1$S
 
 # LOCALIZATION NOTE (alarmTodayAt):
 # used for a display the date-time of an alarm like 'Today at Thu 2 Oct 2008 13:21'