Bug 1440490 - Move l10n related functions into calL10NUtils.jsm - part 8 - migrate remaining calGetString instances. r=MakeMyDay
authorPhilipp Kewisch <mozilla@kewis.ch>
Thu, 22 Feb 2018 09:44:33 +0100
changeset 31386 7bc3d4ebc70acc329b8cd98cbf2c0f137433eec5
parent 31385 b2648949aedf65d20f4ef5b641dd25ccbc004b62
child 31387 533050294814df4ea1a3afbf58f0265c7fbc26af
push id383
push userclokep@gmail.com
push dateMon, 07 May 2018 21:52:48 +0000
reviewersMakeMyDay
bugs1440490
Bug 1440490 - Move l10n related functions into calL10NUtils.jsm - part 8 - migrate remaining calGetString instances. r=MakeMyDay MozReview-Commit-ID: AtKAYYwS0ED
calendar/base/content/calendar-daypicker.xml
calendar/base/content/calendar-extract.js
calendar/base/content/calendar-task-view.js
calendar/base/content/calendar-views.js
calendar/base/content/dialogs/calendar-alarm-dialog.js
calendar/base/content/dialogs/calendar-event-dialog-attendees.xml
calendar/base/content/dialogs/calendar-event-dialog-recurrence.js
calendar/base/content/dialogs/calendar-event-dialog-reminder.js
calendar/base/content/dialogs/calendar-occurrence-prompt.xul
calendar/base/content/dialogs/calendar-summary-dialog.js
calendar/base/content/widgets/calendar-alarm-widget.xml
calendar/base/modules/calAuthUtils.jsm
calendar/base/modules/calCategoryUtils.jsm
calendar/base/modules/calRecurrenceUtils.jsm
calendar/base/src/calAlarm.js
calendar/base/src/calCalendarManager.js
calendar/lightning/content/lightning-item-iframe.js
calendar/lightning/content/messenger-overlay-sidebar.js
calendar/providers/caldav/calDavCalendar.js
calendar/resources/content/calendarCreation.js
calendar/resources/content/datetimepickers/datetimepickers.xml
calendar/test/mozmill/testAlarmDefaultValue.js
--- a/calendar/base/content/calendar-daypicker.xml
+++ b/calendar/base/content/calendar-daypicker.xml
@@ -253,14 +253,14 @@
           for (let i = 0; i < numRows; i++) {
               let row = mainbox.childNodes[i];
               let numChilds = row.childNodes.length;
               for (let j = 0; j < numChilds; j++) {
                   child = row.childNodes[j];
                   child.calendar = this;
               }
           }
-          let labelLastDay = cal.calGetString("calendar-event-dialog", "eventRecurrenceMonthlyLastDayLabel");
+          let labelLastDay = cal.l10n.getString("calendar-event-dialog", "eventRecurrenceMonthlyLastDayLabel");
           child.setAttribute("label", labelLastDay);
       ]]></constructor>
     </implementation>
   </binding>
 </bindings>
--- a/calendar/base/content/calendar-extract.js
+++ b/calendar/base/content/calendar-extract.js
@@ -17,17 +17,17 @@ var calendarExtract = {
         let locales = chrome.getLocalesForPackage("calendar");
         let langRegex = /^(([^-]+)-*(.*))$/;
 
         while (locales.hasMore()) {
             let localeParts = langRegex.exec(locales.getNext());
             let langName = localeParts[2];
 
             try {
-                langName = cal.calGetString("languageNames", langName, null, "global");
+                langName = cal.l10n.getAnyString("global", "languageNames", langName);
             } catch (ex) {
                 // If no language name is found that is ok, keep the technical term
             }
 
             let label = cal.l10n.getCalString("extractUsing", [langName]);
             if (localeParts[3] != "") {
                 label = cal.l10n.getCalString("extractUsingRegion", [langName, localeParts[3]]);
             }
--- a/calendar/base/content/calendar-task-view.js
+++ b/calendar/base/content/calendar-task-view.js
@@ -213,17 +213,17 @@ function taskViewUpdate(aFilter) {
  * XXX We already have a function with this name in the event dialog. Either
  * consolidate or make name more clear.
  */
 function sendMailToOrganizer() {
     let item = document.getElementById("calendar-task-tree").currentTask;
     if (item != null) {
         let organizer = item.organizer;
         let email = cal.email.getAttendeeEmail(organizer, true);
-        let emailSubject = cal.calGetString("calendar-event-dialog", "emailSubjectReply", [item.title]);
+        let emailSubject = cal.l10n.getString("calendar-event-dialog", "emailSubjectReply", [item.title]);
         let identity = item.calendar.getProperty("imip.identity");
         cal.email.sendTo(email, emailSubject, null, identity);
     }
 }
 
 /**
  * Handler function to observe changing of the calendar display deck. Updates
  * the task tree if the task view was selected.
--- a/calendar/base/content/calendar-views.js
+++ b/calendar/base/content/calendar-views.js
@@ -707,17 +707,17 @@ cal.navigationBar = {
             } else {
                 weekLabel.value = cal.l10n.getCalString("severalShortCalendarWeeks", [firstWeekNo, secondWeekNo]);
                 weekLabel.tooltipText = cal.l10n.getCalString("severalLongCalendarWeeks", [firstWeekNo, secondWeekNo]);
             }
             docTitle = intervalLabel.value;
         }
         if (document.getElementById("modeBroadcaster").getAttribute("mode") == "calendar") {
             document.title = (docTitle ? docTitle + " - " : "") +
-                cal.calGetString("brand", "brandFullName", null, "branding");
+                cal.l10n.getAnyString("branding", "brand", "brandFullName");
         }
         let viewTabs = document.getElementById("view-tabs");
         viewTabs.selectedIndex = getViewDeck().selectedIndex;
     }
 };
 
 /*
  * Timer for the time indicator in day and week view.
--- a/calendar/base/content/dialogs/calendar-alarm-dialog.js
+++ b/calendar/base/content/dialogs/calendar-alarm-dialog.js
@@ -351,29 +351,28 @@ function doReadOnlyChecks() {
             countRO++;
         }
     }
 
     // we disable the button if there are only alarms for not-writable items
     let snoozeAllButton = document.getElementById("alarm-snooze-all-button");
     snoozeAllButton.disabled = (countRO && countRO == alarmRichlist.childNodes.length);
     if (snoozeAllButton.disabled) {
-        let tooltip = cal.calGetString("calendar-alarms",
-                                       "reminderDisabledSnoozeButtonTooltip");
+        let tooltip = cal.l10n.getString("calendar-alarms", "reminderDisabledSnoozeButtonTooltip");
         snoozeAllButton.setAttribute("tooltiptext", tooltip);
     } else {
         snoozeAllButton.removeAttribute("tooltiptext");
     }
 
     let nBox = document.getElementById("readonly-notification");
     let notification = nBox.getNotificationWithValue("calendar-readonly");
     if (countRO && !notification) {
-        let message = cal.calGetString("calendar-alarms",
-                                       "reminderReadonlyNotification",
-                                       [snoozeAllButton.label]);
+        let message = cal.l10n.getString("calendar-alarms",
+                                         "reminderReadonlyNotification",
+                                         [snoozeAllButton.label]);
         nBox.appendNotification(message,
                                 "calendar-readonly",
                                 null,
                                 nBox.PRIORITY_WARNING_MEDIUM,
                                 null,
                                 null);
     } else if (notification && !countRO) {
         nBox.removeNotification(notification);
--- a/calendar/base/content/dialogs/calendar-event-dialog-attendees.xml
+++ b/calendar/base/content/dialogs/calendar-event-dialog-attendees.xml
@@ -660,34 +660,34 @@
               const roleMap = {
                   "REQ-PARTICIPANT": "required",
                   "OPT-PARTICIPANT": "optional",
                   "NON-PARTICIPANT": "nonparticipant",
                   "CHAIR": "chair"
               };
 
               let roleNameString = "event.attendee.role." + (role in roleMap ? roleMap[role] : "unknown");
-              let tooltip = cal.calGetString("calendar-event-dialog-attendees",
-                                             roleNameString,
-                                             role in roleMap ? null : [role]);
+              let tooltip = cal.l10n.getString("calendar-event-dialog-attendees",
+                                               roleNameString,
+                                               role in roleMap ? null : [role]);
               targetIcon.setAttribute("tooltiptext", tooltip);
           } else if (targetIcon.className == "usertype-icon") {
               let cutype = targetIcon.getAttribute("cutype");
               const cutypeMap = {
                   INDIVIDUAL: "individual",
                   GROUP: "group",
                   RESOURCE: "resource",
                   ROOM: "room",
                   // I've decided UNKNOWN will not be handled.
               };
 
               let cutypeString = "event.attendee.usertype." + (cutype in cutypeMap ? cutypeMap[cutype] : "unknown");
-              let tooltip = cal.calGetString("calendar-event-dialog-attendees",
-                                             cutypeString,
-                                             cutype in cutypeMap ? null : [cutype]);
+              let tooltip = cal.l10n.getString("calendar-event-dialog-attendees",
+                                               cutypeString,
+                                               cutype in cutypeMap ? null : [cutype]);
               targetIcon.setAttribute("tooltiptext", tooltip);
           }
       ]]></body>
       </method>
 
       <property name="documentSize">
         <getter><![CDATA[
             return this.mRowHeight * this.mMaxAttendees;
--- a/calendar/base/content/dialogs/calendar-event-dialog-recurrence.js
+++ b/calendar/base/content/dialogs/calendar-event-dialog-recurrence.js
@@ -756,21 +756,17 @@ function changeOrderForElements(aPropKey
 
     for (let key in aPropParams) {
         // Save original parents so that the nodes to reorder get appended to
         // the correct parent nodes.
         parents[key] = document.getElementById(aPropParams[key]).parentNode;
     }
 
     try {
-        localeOrder = cal.calGetString("calendar-event-dialog",
-                                       aPropKey,
-                                       aPropParams);
-
-        localeOrder = localeOrder.split(" ");
+        localeOrder = cal.l10n.getString("calendar-event-dialog", aPropKey, aPropParams).split(" ");
     } catch (ex) {
         let msg = "The key " + aPropKey + " in calendar-event-dialog.prop" +
                   "erties has incorrect number of params. Expected " +
                   aPropParams.length + " params.";
         Components.utils.reportError(msg + " " + ex);
         return;
     }
 
--- a/calendar/base/content/dialogs/calendar-event-dialog-reminder.js
+++ b/calendar/base/content/dialogs/calendar-event-dialog-reminder.js
@@ -16,17 +16,17 @@ var allowedActionsMap = {};
 /**
  * Sets up the reminder dialog.
  */
 function onLoad() {
     let calendar = window.arguments[0].calendar;
 
     // Make sure the origin menulist uses the right labels, depending on if the
     // dialog is showing an event or task.
-    function _sn(x) { return cal.calGetString("calendar-alarms", getItemBundleStringName(x)); }
+    function _sn(x) { return cal.l10n.getString("calendar-alarms", getItemBundleStringName(x)); }
 
     setElementValue("reminder-before-start-menuitem",
                     _sn("reminderCustomOriginBeginBefore"),
                     "label");
 
     setElementValue("reminder-after-start-menuitem",
                     _sn("reminderCustomOriginBeginAfter"),
                     "label");
@@ -166,19 +166,19 @@ function setupMaxReminders() {
 
     // If we hit the maximum number of reminders, show the error box and
     // disable the new button.
     setElementValue("reminder-new-button", cond && "true", "disabled");
 
     if (!setupMaxReminders.notification) {
         let notification = createXULElement("notification");
         let localeErrorString =
-            cal.calGetString("calendar-alarms",
-                             getItemBundleStringName("reminderErrorMaxCountReached"),
-                             [maxReminders]);
+            cal.l10n.getString("calendar-alarms",
+                               getItemBundleStringName("reminderErrorMaxCountReached"),
+                               [maxReminders]);
         let pluralErrorLabel = PluralForm.get(maxReminders, localeErrorString)
                                          .replace("#1", maxReminders);
 
         notification.setAttribute("label", pluralErrorLabel);
         notification.setAttribute("type", "warning");
         notification.setAttribute("hideclose", "true");
         setupMaxReminders.notification = notification;
     }
--- a/calendar/base/content/dialogs/calendar-occurrence-prompt.xul
+++ b/calendar/base/content/dialogs/calendar-occurrence-prompt.xul
@@ -23,17 +23,17 @@
 
       function exitOccurrenceDialog(aReturnValue) {
           window.arguments[0].value = aReturnValue;
           window.close();
           return true;
       }
 
       function getDString(aKey) {
-          return cal.calGetString("calendar-occurrence-prompt", aKey);
+          return cal.l10n.getString("calendar-occurrence-prompt", aKey);
       }
 
       function onLoad() {
           let action = window.arguments[0].action || "edit";
           // the calling code prevents sending no items
           let multiple = (window.arguments[0].items.length == 1)
                        ? "single" : "multiple";
           let itemType;
--- a/calendar/base/content/dialogs/calendar-summary-dialog.js
+++ b/calendar/base/content/dialogs/calendar-summary-dialog.js
@@ -384,17 +384,17 @@ function updateRepeatDetails() {
     let startDate = item.startDate || item.entryDate;
     let endDate = item.endDate || item.dueDate;
     startDate = startDate ? startDate.getInTimezone(kDefaultTimezone) : null;
     endDate = endDate ? endDate.getInTimezone(kDefaultTimezone) : null;
     let detailsString = recurrenceRule2String(recurrenceInfo, startDate,
                                               endDate, startDate.isDate);
 
     if (!detailsString) {
-        detailsString = cal.calGetString("calendar-event-dialog", "ruleTooComplexSummary");
+        detailsString = cal.l10n.getString("calendar-event-dialog", "ruleTooComplexSummary");
     }
 
     // Now display the string...
     let lines = detailsString.split("\n");
     repeatDetails.removeAttribute("collapsed");
     while (repeatDetails.childNodes.length > lines.length) {
         repeatDetails.lastChild.remove();
     }
@@ -445,17 +445,17 @@ function browseDocument() {
  * Extracts the item's organizer and opens a compose window to send the
  * organizer an email.
  */
 function sendMailToOrganizer() {
     let args = window.arguments[0];
     let item = args.calendarEvent;
     let organizer = item.organizer;
     let email = cal.email.getAttendeeEmail(organizer, true);
-    let emailSubject = cal.calGetString("calendar-event-dialog", "emailSubjectReply", [item.title]);
+    let emailSubject = cal.l10n.getString("calendar-event-dialog", "emailSubjectReply", [item.title]);
     let identity = item.calendar.getProperty("imip.identity");
     cal.email.sendTo(email, emailSubject, null, identity);
 }
 
 /**
  * Opens an attachment
  *
  * @param {AUTF8String}  aAttachmentId   The hashId of the attachment to open
--- a/calendar/base/content/widgets/calendar-alarm-widget.xml
+++ b/calendar/base/content/widgets/calendar-alarm-widget.xml
@@ -121,17 +121,17 @@
                 "anonid",
                 "alarm-snooze-button"
             );
             if (!cal.acl.isCalendarWritable(this.mItem.calendar) ||
                 !cal.acl.userCanModifyItem(this.mItem)) {
                 let tooltip = "reminderDisabledSnoozeButtonTooltip";
                 snoozeButton.disabled = true;
                 snoozeButton.setAttribute("tooltiptext",
-                                          cal.calGetString("calendar-alarms", tooltip));
+                                          cal.l10n.getString("calendar-alarms", tooltip));
             } else {
                 snoozeButton.disabled = false;
                 snoozeButton.removeAttribute("tooltiptext");
             }
         ]]></body>
       </method>
 
       <method name="updateRelativeDateLabel">
@@ -350,19 +350,19 @@
             function unitName(list) {
                 return { 1: "unitMinutes", 60: "unitHours", 1440: "unitDays" }[list.value] || "unitMinutes";
             }
 
             let pluralString = cal.l10n.getCalString(unitName(unitList));
             let unitPlural = PluralForm.get(unitValue.value, pluralString)
                                        .replace("#1", unitValue.value);
 
-            let accessibleString = cal.calGetString("calendar-alarms",
-                                                    "reminderSnoozeOkA11y",
-                                                    [unitPlural]);
+            let accessibleString = cal.l10n.getString("calendar-alarms",
+                                                      "reminderSnoozeOkA11y",
+                                                      [unitPlural]);
             okButton.setAttribute("aria-label", accessibleString);
 
             let items = unitPopup.getElementsByTagName("xul:menuitem");
             for (let menuItem of items) {
                 pluralString = cal.l10n.getCalString(unitName(menuItem));
                 menuItem.label = PluralForm.get(unitValue.value, pluralString)
                                            .replace("#1", "").trim();
             }
--- a/calendar/base/modules/calAuthUtils.jsm
+++ b/calendar/base/modules/calAuthUtils.jsm
@@ -40,29 +40,29 @@ cal.auth = {
             throw new Components.Exception("", Components.results.NS_ERROR_XPC_NEED_OUT_OBJECT);
         }
 
         let prompter = Services.ww.getNewPrompter(null);
 
         // Only show the save password box if we are supposed to.
         let savepassword = null;
         if (Preferences.get("signon.rememberSignons", true)) {
-            savepassword = cal.calGetString("passwordmgr", "rememberPassword", null, "passwordmgr");
+            savepassword = cal.l10n.getAnyString("passwordmgr", "passwordmgr", "rememberPassword");
         }
 
         let aText;
         if (aFixedUsername) {
-            aText = cal.calGetString("commonDialogs", "EnterPasswordFor", [aUsername.value, aCalendarName], "global");
+            aText = cal.l10n.getAnyString("global", "commonDialogs", "EnterPasswordFor", [aUsername.value, aCalendarName]);
             return prompter.promptPassword(aTitle,
                                            aText,
                                            aPassword,
                                            savepassword,
                                            aSavePassword);
         } else {
-            aText = cal.calGetString("commonDialogs", "EnterUserPasswordFor2", [aCalendarName], "global");
+            aText = cal.l10n.getAnyString("global", "commonDialogs", "EnterUserPasswordFor2", [aCalendarName]);
             return prompter.promptUsernameAndPassword(aTitle,
                                                       aText,
                                                       aUsername,
                                                       aPassword,
                                                       savepassword,
                                                       aSavePassword);
         }
     },
--- a/calendar/base/modules/calCategoryUtils.jsm
+++ b/calendar/base/modules/calCategoryUtils.jsm
@@ -12,17 +12,17 @@ this.EXPORTED_SYMBOLS = ["calcategory"];
 var calcategory = {
     /**
      * Sets up the default categories from the localized string
      *
      * @return      The default set of categories as a comma separated string.
      */
     setupDefaultCategories: function() {
         // First, set up the category names
-        let categories = cal.calGetString("categories", "categories2");
+        let categories = cal.l10n.getString("categories", "categories2");
         Preferences.set("calendar.categories.names", categories);
 
         // Now, initialize the category default colors
         let categoryArray = calcategory.stringToArray(categories);
         for (let category of categoryArray) {
             let prefName = cal.view.formatStringForCSSRule(category);
             Preferences.set("calendar.category.color." + prefName,
                             cal.view.hashColor(category));
--- a/calendar/base/modules/calRecurrenceUtils.jsm
+++ b/calendar/base/modules/calRecurrenceUtils.jsm
@@ -16,17 +16,17 @@ this.EXPORTED_SYMBOLS = ["recurrenceRule
  * @param recurrenceInfo    An item's recurrence info to parse.
  * @param startDate         The start date to base rules on.
  * @param endDate           The end date to base rules on.
  * @param allDay            If true, the pattern should assume an allday item.
  * @return                  A human readable string describing the recurrence.
  */
 function recurrenceRule2String(recurrenceInfo, startDate, endDate, allDay) {
     function getRString(name, args) {
-        return cal.calGetString("calendar-event-dialog", name, args);
+        return cal.l10n.getString("calendar-event-dialog", name, args);
     }
     function day_of_week(day) {
         return Math.abs(day) % 8;
     }
     function day_position(day) {
         return (Math.abs(day) - day_of_week(day)) / 8 * (day < 0 ? -1 : 1);
     }
     function nounClass(aDayString, aRuleString) {
--- a/calendar/base/src/calAlarm.js
+++ b/calendar/base/src/calAlarm.js
@@ -614,17 +614,17 @@ calAlarm.prototype = {
         } else {
             this.mProperties.delete(name);
         }
     },
 
     get propertyEnumerator() { return this.mProperties.simpleEnumerator; },
 
     toString: function(aItem) {
-        function getItemBundleStringName(aPrefix) {
+        function alarmString(aPrefix) {
             if (!aItem || cal.item.isEvent(aItem)) {
                 return aPrefix + "Event";
             } else if (cal.item.isToDo(aItem)) {
                 return aPrefix + "Task";
             } else {
                 return aPrefix;
             }
         }
@@ -637,21 +637,19 @@ calAlarm.prototype = {
             return formatter.formatDateTime(formatDate);
         } else if (this.related != ALARM_RELATED_ABSOLUTE && this.mOffset) {
             // Relative alarm length
             let alarmlen = Math.abs(this.mOffset.inSeconds / 60);
             if (alarmlen == 0) {
                 // No need to get the other information if the alarm is at the start
                 // of the event/task.
                 if (this.related == ALARM_RELATED_START) {
-                    return cal.calGetString("calendar-alarms",
-                                            getItemBundleStringName("reminderTitleAtStart"));
+                    return cal.l10n.getString("calendar-alarms", alarmString("reminderTitleAtStart"));
                 } else if (this.related == ALARM_RELATED_END) {
-                    return cal.calGetString("calendar-alarms",
-                                            getItemBundleStringName("reminderTitleAtEnd"));
+                    return cal.l10n.getString("calendar-alarms", alarmString("reminderTitleAtEnd"));
                 }
             }
 
             let unit;
             if (alarmlen % 1440 == 0) {
                 // Alarm is in days
                 unit = "unitDays";
                 alarmlen /= 1440;
@@ -677,20 +675,19 @@ calAlarm.prototype = {
             }
 
             if (this.offset.isNegative) {
                 originStringName += "Before";
             } else {
                 originStringName += "After";
             }
 
-            let originString = cal.calGetString("calendar-alarms",
-                                                getItemBundleStringName(originStringName));
-            return cal.calGetString("calendar-alarms",
-                                    "reminderCustomTitle",
-                                    [unitString, originString]);
+            let originString = cal.l10n.getString("calendar-alarms", alarmString(originStringName));
+            return cal.l10n.getString("calendar-alarms",
+                                      "reminderCustomTitle",
+                                      [unitString, originString]);
         } else {
             // This is an incomplete alarm, but then again we should never reach
             // this state.
             return "[Incomplete calIAlarm]";
         }
     }
 };
--- a/calendar/base/src/calCalendarManager.js
+++ b/calendar/base/src/calCalendarManager.js
@@ -398,17 +398,17 @@ calCalendarManager.prototype = {
 
     //
     // / DB migration code ends here
     //
 
     alertAndQuit: function() {
         // We want to include the extension name in the error message rather
         // than blaming Thunderbird.
-        let hostAppName = cal.calGetString("brand", "brandShortName", null, "branding");
+        let hostAppName = cal.l10n.getAnyString("branding", "brand", "brandShortName");
         let calAppName = cal.l10n.getLtnString("brandShortName");
         let errorBoxTitle = cal.l10n.getCalString("tooNewSchemaErrorBoxTitle", [calAppName]);
         let errorBoxText = cal.l10n.getCalString("tooNewSchemaErrorBoxTextLightning", [calAppName, hostAppName]);
         let errorBoxButtonLabel = cal.l10n.getCalString("tooNewSchemaButtonRestart", [hostAppName]);
 
         let promptSvc = Services.prompt;
 
         let errorBoxButtonFlags = promptSvc.BUTTON_POS_0 *
--- a/calendar/lightning/content/lightning-item-iframe.js
+++ b/calendar/lightning/content/lightning-item-iframe.js
@@ -306,17 +306,17 @@ function onLoad() {
 
     // set the iframe's top level id for event vs task
     if (!cal.item.isEvent(item)) {
         setDialogId(document.documentElement, "calendar-task-dialog-inner");
     }
 
     // new items should have a non-empty title.
     if (item.isMutable && (!item.title || item.title.length <= 0)) {
-        item.title = cal.calGetString("calendar-event-dialog",
+        item.title = cal.l10n.getString("calendar-event-dialog",
                                       cal.item.isEvent(item) ? "newEvent" : "newTask");
     }
 
     window.onAcceptCallback = args.onOk;
     window.mode = args.mode;
 
     // we store the item in the window to be able
     // to access this from any location. please note
@@ -691,20 +691,20 @@ function loadDialog(aItem) {
         }
     }
 
     // When in a window, set Item-Menu label to Event or Task
     if (!gInTab) {
         let isEvent = cal.item.isEvent(aItem);
 
         let labelString = isEvent ? "itemMenuLabelEvent" : "itemMenuLabelTask";
-        let label = cal.calGetString("calendar-event-dialog", labelString);
+        let label = cal.l10n.getString("calendar-event-dialog", labelString);
 
         let accessKeyString = isEvent ? "itemMenuAccesskeyEvent2" : "itemMenuAccesskeyTask2";
-        let accessKey = cal.calGetString("calendar-event-dialog", accessKeyString);
+        let accessKey = cal.l10n.getString("calendar-event-dialog", accessKeyString);
         sendMessage({
             command: "initializeItemMenu",
             label: label,
             accessKey: accessKey
         });
     }
 
     // Repeat details
@@ -1903,17 +1903,17 @@ function loadCloudProviders() {
     sendMessage(message);
 
     let itemObjects = [];
 
     for (let cloudProvider of cloudFileAccounts.accounts) {
         // Create a serializable object to pass in a message outside the iframe
         let itemObject = {};
         itemObject.displayName = cloudFileAccounts.getDisplayName(cloudProvider);
-        itemObject.label = cal.calGetString("calendar-event-dialog", "attachViaFilelink", [itemObject.displayName]);
+        itemObject.label = cal.l10n.getString("calendar-event-dialog", "attachViaFilelink", [itemObject.displayName]);
         itemObject.cloudProviderAccountKey = cloudProvider.accountKey;
         if (cloudProvider.iconClass) {
             itemObject.class = "menuitem-iconic";
             itemObject.image = cloudProvider.iconClass;
         }
 
         itemObjects.push(itemObject);
 
@@ -1939,24 +1939,26 @@ function loadCloudProviders() {
 
 /**
  * Prompts the user to attach an url to this item.
  */
 function attachURL() {
     if (Services.prompt) {
         // ghost in an example...
         let result = { value: "http://" };
-        if (Services.prompt.prompt(window,
-                                   cal.calGetString("calendar-event-dialog",
-                                                    "specifyLinkLocation"),
-                                   cal.calGetString("calendar-event-dialog",
-                                                    "enterLinkLocation"),
-                                   result,
-                                   null,
-                                   { value: 0 })) {
+        let confirm = Services.prompt.prompt(
+            window,
+            cal.l10n.getString("calendar-event-dialog", "specifyLinkLocation"),
+            cal.l10n.getString("calendar-event-dialog", "enterLinkLocation"),
+            result,
+            null,
+            { value: 0 }
+        );
+
+        if (confirm) {
             try {
                 // If something bogus was entered, Services.io.newURI may fail.
                 let attachment = cal.createAttachment();
                 attachment.uri = Services.io.newURI(result.value);
                 addAttachment(attachment);
             } catch (e) {
                 // TODO We might want to show a warning instead of just not
                 // adding the file
@@ -1988,17 +1990,17 @@ function attachFile(cloudProvider) {
     if (!cloudProvider) {
         cal.ERROR("[calendar-event-dialog] Could not attach file without cloud provider" + cal.STACK(10));
     }
 
     const nsIFilePicker = Components.interfaces.nsIFilePicker;
     let filePicker = Components.classes["@mozilla.org/filepicker;1"]
                                .createInstance(nsIFilePicker);
     filePicker.init(window,
-                    cal.calGetString("calendar-event-dialog", "selectAFile"),
+                    cal.l10n.getString("calendar-event-dialog", "selectAFile"),
                     nsIFilePicker.modeOpenMultiple);
 
     // Check for the last directory
     let lastDir = lastDirectory();
     if (lastDir) {
         filePicker.displayDirectory = lastDir;
     }
 
@@ -2228,18 +2230,18 @@ function deleteAttachment() {
  * Removes all attachments from the dialog controls.
  */
 function deleteAllAttachments() {
     let documentLink = document.getElementById("attachment-link");
     let itemCount = documentLink.getRowCount();
     let canRemove = (itemCount < 2);
 
     if (itemCount > 1) {
-        let removeText = PluralForm.get(itemCount, cal.calGetString("calendar-event-dialog", "removeAttachmentsText"));
-        let removeTitle = cal.calGetString("calendar-event-dialog", "removeCalendarsTitle");
+        let removeText = PluralForm.get(itemCount, cal.l10n.getString("calendar-event-dialog", "removeAttachmentsText"));
+        let removeTitle = cal.l10n.getString("calendar-event-dialog", "removeCalendarsTitle");
         canRemove = Services.prompt.confirm(window, removeTitle, removeText.replace("#1", itemCount), {});
     }
 
     if (canRemove) {
         let child;
         while (documentLink.hasChildNodes()) {
             child = documentLink.lastChild;
             child.attachment = null;
@@ -3620,17 +3622,17 @@ function updateRepeatDetails() {
         startDate = cal.dtz.jsDateToDateTime(startDate, kDefaultTimezone);
         endDate = cal.dtz.jsDateToDateTime(endDate, kDefaultTimezone);
 
         let allDay = getElementValue("event-all-day", "checked");
         let detailsString = recurrenceRule2String(recurrenceInfo, startDate,
                                                   endDate, allDay);
 
         if (!detailsString) {
-            detailsString = cal.calGetString("calendar-event-dialog", "ruleTooComplex");
+            detailsString = cal.l10n.getString("calendar-event-dialog", "ruleTooComplex");
         }
 
         // Now display the string...
         let lines = detailsString.split("\n");
         repeatDetails.removeAttribute("collapsed");
         while (repeatDetails.childNodes.length > lines.length) {
             repeatDetails.lastChild.remove();
         }
@@ -3766,17 +3768,17 @@ function sendMailToUndecidedAttendees(aA
 /**
  * Send Email to all given attendees.
  *
  * @param aAttendees    The attendees to send mail to.
  */
 function sendMailToAttendees(aAttendees) {
     let toList = cal.email.createRecipientList(aAttendees);
     let item = saveItem();
-    let emailSubject = cal.calGetString("calendar-event-dialog", "emailSubjectReply", [item.title]);
+    let emailSubject = cal.l10n.getString("calendar-event-dialog", "emailSubjectReply", [item.title]);
     let identity = window.calendarItem.calendar.getProperty("imip.identity");
     cal.email.sendTo(toList, emailSubject, null, identity);
 }
 
 /**
  * Make sure all fields that may have calendar specific capabilities are updated
  */
 function updateCapabilities() {
@@ -3940,17 +3942,17 @@ function displayCounterProposal() {
         cal.LOG("Unexpected partstat " + partStat + " detected.");
         // we simply reset partStat not display the summary text of the counter box
         // to avoid the window of death
         partStat = null;
     }
 
     if (idCounter > 0) {
         if (partStat && attendeeId.length) {
-            document.getElementById("counter-proposal-summary").value = cal.calGetString(
+            document.getElementById("counter-proposal-summary").value = cal.l10n.getString(
                 "calendar-event-dialog",
                 partStat,
                 [attendeeId]
             );
             document.getElementById("counter-proposal-summary").removeAttribute("collapsed");
         }
         if (comment) {
             document.getElementById("counter-proposal-comment").value = comment;
@@ -3958,26 +3960,26 @@ function displayCounterProposal() {
         }
         document.getElementById("counter-proposal-box").removeAttribute("collapsed");
 
         if (window.counterProposal.oldVersion) {
             // this is a counterproposal to a previous version of the event - we should notify the
             // user accordingly
             notifyUser(
                 "counterProposalOnPreviousVersion",
-                cal.calGetString("calendar-event-dialog", "counterOnPreviousVersionNotification"),
+                cal.l10n.getString("calendar-event-dialog", "counterOnPreviousVersionNotification"),
                 "warn"
             );
         }
         if (window.calendarItem.getProperty("X-MICROSOFT-DISALLOW-COUNTER") == "TRUE") {
             // this is a counterproposal although the user disallowed countering when sending the
             // invitation, so we notify the user accordingly
             notifyUser(
                 "counterProposalOnCounteringDisallowed",
-                cal.calGetString("calendar-event-dialog", "counterOnCounterDisallowedNotification"),
+                cal.l10n.getString("calendar-event-dialog", "counterOnCounterDisallowedNotification"),
                 "warn"
             );
         }
     }
 }
 
 /**
  * Get the property label to display for a counterproposal based on the respective label used in
--- a/calendar/lightning/content/messenger-overlay-sidebar.js
+++ b/calendar/lightning/content/messenger-overlay-sidebar.js
@@ -422,17 +422,17 @@ function ltnIntegrationNotification() {
     const kNotify = "calendar.integration.notify"; // default: true
     const kSupportUri = "https://support.mozilla.org/kb/thunderbird-calendar-integration";
     const kLightningGuuid = "{e2fda1a4-762b-4020-b5ad-a41df1933103}";
 
     // we fall back to messagepanebox for Seamonkey
     let notifyBox = document.getElementById("mail-notification-box") ||
                     document.getElementById("messagepanebox");
 
-    let appBrand = cal.calGetString("brand", "brandShortName", null, "branding");
+    let appBrand = cal.l10n.getAnyString("branding", "brand", "brandShortName");
     let ltnBrand = cal.l10n.getLtnString("brandShortName");
     let label = cal.l10n.getLtnString("integrationLabel", [appBrand, ltnBrand]);
 
     // call backs for doing/undoing Lightning removal
     let cbRemoveLightning = function(aAddon) {
         aAddon.userDisabled = true;
     };
     let cbUndoRemoveLightning = function(aAddon) {
@@ -937,17 +937,17 @@ function checkCalendarBinaryComponent() 
                 break;
         }
 
         let text;
         if (version && version != ext.version) {
             let args = [extbrand, ext.version, version];
             text = cal.l10n.getLtnString("binaryComponentKnown", args);
         } else {
-            let brand = cal.calGetString("brand", "brandShortName", null, "branding");
+            let brand = cal.l10n.getAnyString("branding", "brand", "brandShortName");
             let args = [extbrand, brand, appversion, ext.version];
             text = cal.l10n.getLtnString("binaryComponentUnknown", args);
         }
 
         let title = cal.l10n.getLtnString("binaryComponentTitle", [extbrand]);
         openAddonsMgr("addons://detail/" + encodeURIComponent(LIGHTNING_GUID));
         Services.prompt.alert(window, title, text);
     });
--- a/calendar/providers/caldav/calDavCalendar.js
+++ b/calendar/providers/caldav/calDavCalendar.js
@@ -1600,19 +1600,19 @@ calDavCalendar.prototype = {
             let asyncprompter = Components.classes["@mozilla.org/messenger/msgAsyncPrompter;1"]
                                           .getService(Components.interfaces.nsIMsgAsyncPrompter);
             asyncprompter.queueAsyncAuthPrompt(self.uri.spec, false, promptlistener);
         }
         if (this.mUri.host == "apidata.googleusercontent.com") {
             if (!this.oauth) {
                 let sessionId = this.id;
                 let pwMgrId = "Google CalDAV v2";
-                let authTitle = cal.calGetString("commonDialogs", "EnterUserPasswordFor2",
-                                                 [this.name], "global");
-
+                let authTitle = cal.l10n.getAnyString(
+                    "global", "commonDialogs", "EnterUserPasswordFor2", [this.name]
+                );
                 this.oauth = new OAuth2(OAUTH_BASE_URI, OAUTH_SCOPE,
                                         OAUTH_CLIENT_ID, OAUTH_HASH);
                 this.oauth.requestWindowTitle = authTitle;
                 this.oauth.requestWindowFeatures = "chrome,private,centerscreen,width=430,height=600";
 
                 Object.defineProperty(this.oauth, "refreshToken", {
                     get: function() {
                         if (!this.mRefreshToken) {
--- a/calendar/resources/content/calendarCreation.js
+++ b/calendar/resources/content/calendarCreation.js
@@ -15,18 +15,18 @@ var gCalendar;
 var errorConstants = {
     SUCCESS: 0,
     INVALID_URI: 1,
     ALREADY_EXISTS: 2
 };
 
 var l10nStrings = {};
 l10nStrings[errorConstants.SUCCESS] = "";
-l10nStrings[errorConstants.INVALID_URI] = cal.calGetString("calendarCreation", "error.invalidUri");
-l10nStrings[errorConstants.ALREADY_EXISTS] = cal.calGetString("calendarCreation", "error.alreadyExists");
+l10nStrings[errorConstants.INVALID_URI] = cal.l10n.getString("calendarCreation", "error.invalidUri");
+l10nStrings[errorConstants.ALREADY_EXISTS] = cal.l10n.getString("calendarCreation", "error.alreadyExists");
 
 /**
  * Initialize the location page
  */
 function initLocationPage() {
     checkRequired();
 }
 
--- a/calendar/resources/content/datetimepickers/datetimepickers.xml
+++ b/calendar/resources/content/datetimepickers/datetimepickers.xml
@@ -415,17 +415,17 @@
     </content>
 
     <implementation>
       <field name="mForeverStr">null</field>
 
       <constructor><![CDATA[
           ChromeUtils.import("resource://calendar/modules/calUtils.jsm");
 
-          this.mForeverStr = cal.calGetString("calendar-event-dialog", "eventRecurrenceForeverLabel");
+          this.mForeverStr = cal.l10n.getString("calendar-event-dialog", "eventRecurrenceForeverLabel");
           document.getAnonymousElementByAttribute(this, "anonid", "menuitemForever")
                   .setAttribute("label", this.mForeverStr);
       ]]></constructor>
 
       <method name="parseTextBoxDate">
         <parameter name="aRefresh"/>
         <parameter name="aEvent"/>
         <body><![CDATA[
@@ -1600,30 +1600,24 @@
            above/below noon      "\u4e0a\u534802:34"    "\u4e0b\u5348 02 34"
            noon before/after     "\u5348\u524d02:34"    "\u5348\u5f8c 02 34"
       -->
       <method name="parseTime">
         <parameter name="aValue"/>
         <body><![CDATA[
             let now = new Date();
 
-            try {
-                let noon = cal.l10n.getDateFmtString("noon");
-                if (aValue.toLowerCase() == noon.toLowerCase()) {
-                    return new Date(now.getFullYear(), now.getMonth(), now.getDate(), 12, 0, 0, 0);
-                }
+            let noon = cal.l10n.getDateFmtString("noon");
+            if (aValue.toLowerCase() == noon.toLowerCase()) {
+                return new Date(now.getFullYear(), now.getMonth(), now.getDate(), 12, 0, 0, 0);
+            }
 
-                let midnight = cal.l10n.getDateFmtString("midnight");
-                if (aValue.toLowerCase() == midnight.toLowerCase()) {
-                    return new Date(now.getFullYear(), now.getMonth(), now.getDate(), 0, 0, 0, 0);
-                }
-            } catch (ex) {
-                // Try/catch this, since some people are apparently
-                // interested in using the datepicker in remote apps, where
-                // calGetString wouldn't exist
+            let midnight = cal.l10n.getDateFmtString("midnight");
+            if (aValue.toLowerCase() == midnight.toLowerCase()) {
+                return new Date(now.getFullYear(), now.getMonth(), now.getDate(), 0, 0, 0, 0);
             }
 
             let time = null;
             let timePartsArray = this.parseTimeRegExp.exec(aValue);
             const PRE_INDEX = 1, HR_INDEX = 2, MIN_INDEX = 4, SEC_INDEX = 6, POST_INDEX = 8;
 
             if (timePartsArray != null) {
                 let hoursString = timePartsArray[HR_INDEX];
--- a/calendar/test/mozmill/testAlarmDefaultValue.js
+++ b/calendar/test/mozmill/testAlarmDefaultValue.js
@@ -28,17 +28,17 @@ function setupModule(module) {
     } = collector.getModule("calendar-utils"));
     collector.getModule("calendar-utils").setupModule();
     Object.assign(module, helpersForController(controller));
 }
 
 function testDefaultAlarms() {
     let localeUnitString = cal.l10n.getCalString("unitDays");
     let unitString = PluralForm.get(DEFVALUE, localeUnitString).replace("#1", DEFVALUE);
-    let alarmString = (...args) => cal.calGetString("calendar-alarms", ...args);
+    let alarmString = (...args) => cal.l10n.getString("calendar-alarms", ...args);
     let originStringEvent = alarmString("reminderCustomOriginBeginBeforeEvent");
     let originStringTask = alarmString("reminderCustomOriginBeginBeforeTask");
     let expectedEventReminder = alarmString("reminderCustomTitle", [unitString, originStringEvent]);
     let expectedTaskReminder = alarmString("reminderCustomTitle", [unitString, originStringTask]);
 
     // Configure the lightning preferences
     openLightningPrefs(handlePrefDialog, controller);