Bug 1440490 - Move l10n related functions into calL10NUtils.jsm - part 4 - Migrate getLtnString. r=MakeMyDay
authorPhilipp Kewisch <mozilla@kewis.ch>
Thu, 22 Feb 2018 07:47:47 +0100
changeset 30546 4151d5bee5b7d4a491556ea4e3ed57f36fb4ed62
parent 30545 5250ba1d9d41e15629fe93b30b150562a303de1c
child 30547 3e0fec7cfb1b94b6707a96d749338e072e5e93be
push id2172
push usermozilla@kewis.ch
push dateSun, 15 Apr 2018 05:33:14 +0000
treeherdercomm-beta@33a67b0129b3 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersMakeMyDay
bugs1440490
Bug 1440490 - Move l10n related functions into calL10NUtils.jsm - part 4 - Migrate getLtnString. r=MakeMyDay MozReview-Commit-ID: DRN181PLsSh
calendar/base/modules/calItipUtils.jsm
calendar/base/src/calCalendarManager.js
calendar/itip/calItipEmailTransport.js
calendar/lightning/content/imip-bar.js
calendar/lightning/content/lightning-utils.js
calendar/lightning/content/messenger-overlay-sidebar.js
calendar/lightning/modules/ltnInvitationUtils.jsm
calendar/lightning/modules/ltnUtils.jsm
calendar/lightning/modules/moz.build
--- a/calendar/base/modules/calItipUtils.jsm
+++ b/calendar/base/modules/calItipUtils.jsm
@@ -207,71 +207,51 @@ var calitip = {
      * Gets the suggested text to be shown when an imip item has been processed.
      * This text is ready localized and can be displayed to the user.
      *
      * @param {Number} aStatus         The status of the processing (i.e NS_OK, an error code)
      * @param {Number} aOperationType  An operation type from calIOperationListener
      * @return {String}                The suggested text.
      */
     getCompleteText: function(aStatus, aOperationType) {
-        /**
-         * Gets the string from the lightning bundle
-         * @param {String} strName      The string identifier name
-         * @param {String} param        An array of parameters for the strgin
-         * @return {String}             The translated string
-         */
-        function _gs(strName, param) {
-            return cal.calGetString("lightning", strName, param, "lightning");
-        }
-
         let text = "";
         const cIOL = Components.interfaces.calIOperationListener;
         if (Components.isSuccessCode(aStatus)) {
             switch (aOperationType) {
-                case cIOL.ADD: text = _gs("imipAddedItemToCal2"); break;
-                case cIOL.MODIFY: text = _gs("imipUpdatedItem2"); break;
-                case cIOL.DELETE: text = _gs("imipCanceledItem2"); break;
+                case cIOL.ADD: text = cal.l10n.getLtnString("imipAddedItemToCal2"); break;
+                case cIOL.MODIFY: text = cal.l10n.getLtnString("imipUpdatedItem2"); break;
+                case cIOL.DELETE: text = cal.l10n.getLtnString("imipCanceledItem2"); break;
             }
         } else {
-            text = _gs("imipBarProcessingFailed", [aStatus.toString(16)]);
+            text = cal.l10n.getLtnString("imipBarProcessingFailed", [aStatus.toString(16)]);
         }
         return text;
     },
 
     /**
      * Scope: iTIP message receiver
      *
      * Gets a text describing the given itip method. The text is of the form
      * "This Message contains a ... ".
      *
      * @param {String} method      The method to describe.
      * @return {String}            The localized text about the method.
      */
     getMethodText: function(method) {
-        /**
-         * Gets the string from the lightning bundle
-         * @param {String} strName      The string identifier name
-         * @param {String} param        An array of parameters for the strgin
-         * @return {String}             The translated string
-         */
-        function _gs(strName) {
-            return cal.calGetString("lightning", strName, null, "lightning");
-        }
-
         switch (method) {
-            case "REFRESH": return _gs("imipBarRefreshText");
-            case "REQUEST": return _gs("imipBarRequestText");
-            case "PUBLISH": return _gs("imipBarPublishText");
-            case "CANCEL": return _gs("imipBarCancelText");
-            case "REPLY": return _gs("imipBarReplyText");
-            case "COUNTER": return _gs("imipBarCounterText");
-            case "DECLINECOUNTER": return _gs("imipBarDeclineCounterText");
+            case "REFRESH": return cal.l10n.getLtnString("imipBarRefreshText");
+            case "REQUEST": return cal.l10n.getLtnString("imipBarRequestText");
+            case "PUBLISH": return cal.l10n.getLtnString("imipBarPublishText");
+            case "CANCEL": return cal.l10n.getLtnString("imipBarCancelText");
+            case "REPLY": return cal.l10n.getLtnString("imipBarReplyText");
+            case "COUNTER": return cal.l10n.getLtnString("imipBarCounterText");
+            case "DECLINECOUNTER": return cal.l10n.getLtnString("imipBarDeclineCounterText");
             default:
                 cal.ERROR("Unknown iTIP method: " + method);
-                return _gs("imipBarUnsupportedText");
+                return cal.l10n.getLtnString("imipBarUnsupportedText");
         }
     },
 
     /**
      * Scope: iTIP message receiver
      *
      * Gets localized toolbar label about the message state and triggers buttons to show.
      * This returns a JS object with the following structure:
@@ -286,92 +266,83 @@ var calitip = {
      * @param {calIItipItem} itipItem       The itipItem to query.
      * @param {Number} rc                   The result of retrieving the item
      * @param {Function} actionFunc         The action function.
      * @param {calIItemBase[]} foundItems   An array of items found while searching for the item
      *                                        in subscribed calendars
      * @return {Object}                     Return information about the options
      */
     getOptionsText: function(itipItem, rc, actionFunc, foundItems) {
-        /**
-         * Gets the string from the lightning bundle
-         * @param {String} strName      The string identifier name
-         * @param {String} aParam       An array of parameters for the strgin
-         * @return {String}             The translated string
-         */
-        function _gs(strName, aParam=null) {
-            return cal.calGetString("lightning", strName, aParam, "lightning");
-        }
         let imipLabel = null;
         if (itipItem.receivedMethod) {
             imipLabel = calitip.getMethodText(itipItem.receivedMethod);
         }
         let data = { label: imipLabel, showItems: [], hideItems: [] };
         let separateButtons = Preferences.get("calendar.itip.separateInvitationButtons", false);
 
         let disallowedCounter = false;
         if (foundItems && foundItems.length) {
             let disallow = foundItems[0].getProperty("X-MICROSOFT-DISALLOW-COUNTER");
             disallowedCounter = disallow && disallow == "TRUE";
         }
         if (rc == Components.interfaces.calIErrors.CAL_IS_READONLY) {
             // No writable calendars, tell the user about it
-            data.label = _gs("imipBarNotWritable");
+            data.label = cal.l10n.getLtnString("imipBarNotWritable");
         } else if (Components.isSuccessCode(rc) && !actionFunc) {
             // This case, they clicked on an old message that has already been
             // added/updated, we want to tell them that.
-            data.label = _gs("imipBarAlreadyProcessedText");
+            data.label = cal.l10n.getLtnString("imipBarAlreadyProcessedText");
             if (foundItems && foundItems.length) {
                 data.showItems.push("imipDetailsButton");
                 if (itipItem.receivedMethod == "COUNTER" && itipItem.sender) {
                     if (disallowedCounter) {
-                        data.label = _gs("imipBarDisallowedCounterText");
+                        data.label = cal.l10n.getLtnString("imipBarDisallowedCounterText");
                     } else {
                         let comparison;
                         for (let item of itipItem.getItemList({})) {
                             let attendees = cal.itip.getAttendeesBySender(
                                     item.getAttendees({}),
                                     itipItem.sender
                             );
                             if (attendees.length == 1) {
                                 comparison = calitip.compareSequence(item, foundItems[0]);
                                 if (comparison == 1) {
-                                    data.label = _gs("imipBarCounterErrorText");
+                                    data.label = cal.l10n.getLtnString("imipBarCounterErrorText");
                                     break;
                                 } else if (comparison == -1) {
-                                    data.label = _gs("imipBarCounterPreviousVersionText");
+                                    data.label = cal.l10n.getLtnString("imipBarCounterPreviousVersionText");
                                 }
                             }
                         }
                     }
                 }
             } else if (itipItem.receivedMethod == "REPLY") {
                 // The item has been previously removed from the available calendars or the calendar
                 // containing the item is not available
                 let delmgr = Components.classes["@mozilla.org/calendar/deleted-items-manager;1"]
                                        .getService(Components.interfaces.calIDeletedItems);
                 let delTime = null;
                 let items = itipItem.getItemList({});
                 if (items && items.length) {
                     delTime = delmgr.getDeletedDate(items[0].id);
                 }
                 if (delTime) {
-                    data.label = _gs("imipBarReplyToRecentlyRemovedItem", [delTime.toString()]);
+                    data.label = cal.l10n.getLtnString("imipBarReplyToRecentlyRemovedItem", [delTime.toString()]);
                 } else {
-                    data.label = _gs("imipBarReplyToNotExistingItem");
+                    data.label = cal.l10n.getLtnString("imipBarReplyToNotExistingItem");
                 }
             } else if (itipItem.receivedMethod == "DECLINECOUNTER") {
-                data.label = _gs("imipBarDeclineCounterText");
+                data.label = cal.l10n.getLtnString("imipBarDeclineCounterText");
             }
         } else if (Components.isSuccessCode(rc)) {
             cal.LOG("iTIP options on: " + actionFunc.method);
             switch (actionFunc.method) {
                 case "PUBLISH:UPDATE":
                 case "REQUEST:UPDATE-MINOR":
-                    data.label = _gs("imipBarUpdateText");
+                    data.label = cal.l10n.getLtnString("imipBarUpdateText");
                     // falls through
                 case "REPLY":
                     data.showItems.push("imipUpdateButton");
                     break;
                 case "PUBLISH":
                     data.showItems.push("imipAddButton");
                     break;
                 case "REQUEST:UPDATE":
@@ -381,29 +352,29 @@ var calitip = {
                     for (let item of itipItem.getItemList({})) {
                         if (item.recurrenceInfo) {
                             isRecurringMaster = true;
                         }
                     }
 
                     if (actionFunc.method == "REQUEST:UPDATE") {
                         if (isRecurringMaster) {
-                            data.label = _gs("imipBarUpdateSeriesText");
+                            data.label = cal.l10n.getLtnString("imipBarUpdateSeriesText");
                         } else if (itipItem.getItemList({}).length > 1) {
-                            data.label = _gs("imipBarUpdateMultipleText");
+                            data.label = cal.l10n.getLtnString("imipBarUpdateMultipleText");
                         } else {
-                            data.label = _gs("imipBarUpdateText");
+                            data.label = cal.l10n.getLtnString("imipBarUpdateText");
                         }
                     } else if (actionFunc.method == "REQUEST:NEEDS-ACTION") {
                         if (isRecurringMaster) {
-                            data.label = _gs("imipBarProcessedSeriesNeedsAction");
+                            data.label = cal.l10n.getLtnString("imipBarProcessedSeriesNeedsAction");
                         } else if (itipItem.getItemList({}).length > 1) {
-                            data.label = _gs("imipBarProcessedMultipleNeedsAction");
+                            data.label = cal.l10n.getLtnString("imipBarProcessedMultipleNeedsAction");
                         } else {
-                            data.label = _gs("imipBarProcessedNeedsAction");
+                            data.label = cal.l10n.getLtnString("imipBarProcessedNeedsAction");
                         }
                     }
 
                     if (itipItem.getItemList({}).length > 1 || isRecurringMaster) {
                         data.showItems.push("imipAcceptRecurrencesButton");
                         if (separateButtons) {
                             data.showItems.push("imipTentativeRecurrencesButton");
                             data.hideItems.push("imipAcceptRecurrencesButton_AcceptLabel");
@@ -448,28 +419,28 @@ var calitip = {
                     break;
                 }
                 case "REFRESH": {
                     data.showItems.push("imipReconfirmButton");
                     break;
                 }
                 case "COUNTER": {
                     if (disallowedCounter) {
-                        data.label = _gs("imipBarDisallowedCounterText");
+                        data.label = cal.l10n.getLtnString("imipBarDisallowedCounterText");
                     }
                     data.showItems.push("imipDeclineCounterButton");
                     data.showItems.push("imipRescheduleButton");
                     break;
                 }
                 default:
-                    data.label = _gs("imipBarUnsupportedText");
+                    data.label = cal.l10n.getLtnString("imipBarUnsupportedText");
                     break;
             }
         } else {
-            data.label = _gs("imipBarUnsupportedText");
+            data.label = cal.l10n.getLtnString("imipBarUnsupportedText");
         }
 
         return data;
     },
 
     /**
      * Scope: iTIP message receiver
      * Retrieves the message sender.
@@ -601,17 +572,17 @@ var calitip = {
                 let matchingCals = calendars.filter(calendar => calitip.getInvitedAttendee(item, calendar) != null);
                 // if there's none, we will show the whole list of calendars:
                 if (matchingCals.length > 0) {
                     calendars = matchingCals;
                 }
             }
 
             if (calendars.length == 0) {
-                let msg = cal.calGetString("lightning", "imipNoCalendarAvailable", null, "lightning");
+                let msg = cal.l10n.getLtnString("imipNoCalendarAvailable");
                 aWindow.alert(msg);
             } else if (calendars.length == 1) {
                 // There's only one calendar, so it's silly to ask what calendar
                 // the user wants to import into.
                 targetCalendar = calendars[0];
             } else {
                 // Ask what calendar to import into
                 let args = {};
--- a/calendar/base/src/calCalendarManager.js
+++ b/calendar/base/src/calCalendarManager.js
@@ -399,17 +399,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 calAppName = cal.calGetString("lightning", "brandShortName", null, "lightning");
+        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 *
                                   promptSvc.BUTTON_TITLE_IS_STRING +
--- a/calendar/itip/calItipEmailTransport.js
+++ b/calendar/itip/calItipEmailTransport.js
@@ -75,60 +75,39 @@ calItipEmailTransport.prototype = {
                     "calendar.itip.useInvitationSubjectPrefixes",
                     true
                 );
                 if (usePrefixes) {
                     let seq = item.getProperty("SEQUENCE");
                     let subjectKey = seq && seq > 0
                         ? "itipRequestUpdatedSubject"
                         : "itipRequestSubject";
-                    subject = cal.calGetString(
-                        "lightning",
-                        subjectKey,
-                        [summary],
-                        "lightning"
-                    );
+                    subject = cal.l10n.getLtnString(subjectKey, [summary]);
                 } else {
                     subject = summary;
                 }
-                body = cal.calGetString(
-                    "lightning",
+                body = cal.l10n.getLtnString(
                     "itipRequestBody",
-                    [item.organizer ? item.organizer.toString() : "", summary],
-                    "lightning"
+                    [item.organizer ? item.organizer.toString() : "", summary]
                 );
                 break;
             }
             case "CANCEL": {
-                subject = cal.calGetString(
-                    "lightning",
-                    "itipCancelSubject",
-                    [summary],
-                    "lightning"
-                );
-                body = cal.calGetString(
-                    "lightning",
+                subject = cal.l10n.getLtnString("itipCancelSubject", [summary]);
+                body = cal.l10n.getLtnString(
                     "itipCancelBody",
-                    [item.organizer ? item.organizer.toString() : "", summary],
-                    "lightning"
+                    [item.organizer ? item.organizer.toString() : "", summary]
                 );
                 break;
             }
             case "DECLINECOUNTER": {
-                subject = cal.calGetString(
-                    "lightning",
-                    "itipDeclineCounterSubject",
-                    [summary],
-                    "lightning"
-                );
-                body = cal.calGetString(
-                    "lightning",
+                subject = cal.l10n.getLtnString("itipDeclineCounterSubject", [summary]);
+                body = cal.l10n.getLtnString(
                     "itipDeclineCounterBody",
-                    [item.organizer ? item.organizer.toString() : "", summary],
-                    "lightning"
+                    [item.organizer ? item.organizer.toString() : "", summary]
                 );
                 break;
             }
             case "REPLY": {
                 // Get my participation status
                 let att = cal.itip.getInvitedAttendee(item, aItipItem.targetCalendar);
                 if (!att && aItipItem.identity) {
                     att = item.getAttendeeById(cal.email.prependMailTo(aItipItem.identity));
@@ -157,28 +136,18 @@ calItipEmailTransport.prototype = {
                         subjectKey = "itipReplySubjectDecline";
                         bodyKey = "itipReplyBodyDecline";
                         break;
                     default:
                         subjectKey = "itipReplySubject";
                         bodyKey = "itipReplyBodyAccept";
                         break;
                 }
-                subject = cal.calGetString(
-                    "lightning",
-                    subjectKey,
-                    [summary],
-                    "lightning"
-                );
-                body = cal.calGetString(
-                    "lightning",
-                    bodyKey,
-                    [name],
-                    "lightning"
-                );
+                subject = cal.l10n.getLtnString(subjectKey, [summary]);
+                body = cal.l10n.getLtnString(bodyKey, [name]);
                 break;
             }
         }
 
         return {
             subject: subject,
             body: body
         };
@@ -238,18 +207,18 @@ calItipEmailTransport.prototype = {
                 // We still need this as a last resort if a user just deletes or
                 //  drags an invitation related event
                 let parent = Services.wm.getMostRecentWindow(null);
                 if (parent.closed) {
                     parent = cal.window.getCalendarWindow();
                 }
                 let cancelled = Services.prompt.confirmEx(
                     parent,
-                    cal.calGetString("lightning", "imipSendMail.title", null, "lightning"),
-                    cal.calGetString("lightning", "imipSendMail.text", null, "lightning"),
+                    cal.l10n.getLtnString("imipSendMail.title"),
+                    cal.l10n.getLtnString("imipSendMail.text"),
                     Services.prompt.STD_YES_NO_BUTTONS,
                     null,
                     null,
                     null,
                     null,
                     {}
                 );
                 if (cancelled) {
--- a/calendar/lightning/content/imip-bar.js
+++ b/calendar/lightning/content/imip-bar.js
@@ -217,20 +217,20 @@ var ltnImipBar = {
             }
             return false;
         };
 
         // We override the bar label for sent out invitations and in case the event does not exist
         // anymore, we also clear the buttons if any to avoid e.g. accept/decline buttons
         if (isOutgoing(gMessageDisplay.displayedMessage)) {
             if (ltnImipBar.foundItems && ltnImipBar.foundItems[0]) {
-                data.label = ltn.getString("lightning", "imipBarSentText");
+                data.label = cal.l10n.getLtnString("imipBarSentText");
             } else {
                 data = {
-                    label: ltn.getString("lightning", "imipBarSentButRemovedText"),
+                    label: cal.l10n.getLtnString("imipBarSentButRemovedText"),
                     buttons: [],
                     hideMenuItems: []
                 };
             }
         }
 
         imipBar.setAttribute("label", data.label);
         // let's reset all buttons first
@@ -413,25 +413,25 @@ var ltnImipBar = {
                         counterProposal = {
                             attendee: proposingAttendee,
                             proposal: parsedProposal.differences,
                             oldVersion: parsedProposal.result == "OLDVERSION" ||
                                         parsedProposal.result == "NOTLATESTUPDATE",
                             onReschedule: () => {
                                 imipBar.setAttribute(
                                     "label",
-                                    ltn.getString("lightning", "imipBarCounterPreviousVersionText")
+                                    cal.l10n.getLtnString("imipBarCounterPreviousVersionText")
                                 );
                                 // TODO: should we hide the buttons in this case, too?
                             }
                         };
                     } else {
                         imipBar.setAttribute(
                             "label",
-                            ltn.getString("lightning", "imipBarCounterErrorText")
+                            cal.l10n.getLtnString("imipBarCounterErrorText")
                         );
                         ltnImipBar.resetButtons();
                         if (proposingAttendee) {
                             cal.LOG(parsedProposal.result.descr);
                         } else {
                             cal.LOG("Failed to identify the sending attendee of the counterproposal.");
                         }
 
@@ -459,18 +459,18 @@ var ltnImipBar = {
                 // Instead of a dialog, this might be implemented as a separate container inside the
                 // imip-overlay as proposed in bug 458578
             }
             let delmgr = Components.classes["@mozilla.org/calendar/deleted-items-manager;1"]
                                    .getService(Components.interfaces.calIDeletedItems);
             let items = ltnImipBar.itipItem.getItemList({});
             if (items && items.length) {
                 let delTime = delmgr.getDeletedDate(items[0].id);
-                let dialogText = ltnGetString("lightning", "confirmProcessInvitation");
-                let dialogTitle = ltnGetString("lightning", "confirmProcessInvitationTitle");
+                let dialogText = cal.l10n.getLtnString("confirmProcessInvitation");
+                let dialogTitle = cal.l10n.getLtnString("confirmProcessInvitationTitle");
                 if (delTime && !Services.prompt.confirm(window, dialogTitle, dialogText)) {
                     return false;
                 }
             }
 
             if (aParticipantStatus == "X-SAVECOPY") {
                 // we create and adopt copies of the respective events
                 let saveitems = ltnImipBar.itipItem.getItemList({}).map(cal.itip.getPublishLikeItemCopy.bind(cal));
--- a/calendar/lightning/content/lightning-utils.js
+++ b/calendar/lightning/content/lightning-utils.js
@@ -1,34 +1,19 @@
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
-/* exported ltnGetString, ltnInitMailIdentitiesRow,
- *          ltnGetMailIdentitySelection, ltnSaveMailIdentitySelection,
- *          ltnNotifyOnIdentitySelection
+/* exported ltnInitMailIdentitiesRow, ltnGetMailIdentitySelection,
+ *          ltnSaveMailIdentitySelection, ltnNotifyOnIdentitySelection
  */
 
 ChromeUtils.import("resource:///modules/iteratorUtils.jsm");
 ChromeUtils.import("resource:///modules/mailServices.js");
 ChromeUtils.import("resource://calendar/modules/calUtils.jsm");
-ChromeUtils.import("resource://calendar/modules/ltnUtils.jsm");
-
-/**
- * Gets a localized string in a .properties file from the lightning bundle
- *
- * @param   {String}  aBundleName  the name of the properties file.  It is assumed
- *                                 that the file lives in chrome://lightning/locale/
- * @param   {String}  aStringName  the name of the string within the properties file
- * @param   {Array}   aParams      optional array of parameters to format the string
- * @returns {String}               the localized string
- */
-function ltnGetString(aBundleName, aStringName, aParams) {
-    return cal.calGetString(aBundleName, aStringName, aParams, "lightning");
-}
 
 /**
  * Initializing the email identity row
  * (shared between calendar creation wizard and properties dialog)
  */
 function ltnInitMailIdentitiesRow() {
     if (!gCalendar) {
         collapseElement("calendar-email-identity-row");
@@ -52,17 +37,17 @@ function ltnInitMailIdentitiesRow() {
 
     // Remove all children from the email list to avoid duplicates if the list
     // has already been populated during a previous step in the calendar
     // creation wizard.
     while (menuPopup.hasChildNodes()) {
         menuPopup.lastChild.remove();
     }
 
-    addMenuItem(menuPopup, ltnGetString("lightning", "imipNoIdentity"), "none");
+    addMenuItem(menuPopup, cal.l10n.getLtnString("imipNoIdentity"), "none");
     let identities;
     if (gCalendar && gCalendar.aclEntry && gCalendar.aclEntry.hasAccessControl) {
         identities = gCalendar.aclEntry.getOwnerIdentities({});
     } else {
         identities = MailServices.accounts.allIdentities;
     }
     for (let identity of fixIterator(identities, Components.interfaces.nsIMsgIdentity)) {
         addMenuItem(menuPopup, identity.identityName, identity.key);
@@ -110,17 +95,17 @@ function ltnSaveMailIdentitySelection() 
 }
 
 /**
  * Displays a warning if the user doesn't assign an email identity to a calendar
  * (shared between calendar creation wizard and properties dialog)
  */
 function ltnNotifyOnIdentitySelection() {
     let notificationBox = document.getElementById("no-identity-notification");
-    let msg = ltn.getString("lightning", "noIdentitySelectedNotification");
+    let msg = cal.l10n.getLtnString("noIdentitySelectedNotification");
     let sel = ltnGetMailIdentitySelection();
 
     if (sel == "none") {
         notificationBox.appendNotification(
             msg,
             "noIdentitySelected",
             null,
             notificationBox.PRIORITY_WARNING_MEDIUM
--- a/calendar/lightning/content/messenger-overlay-sidebar.js
+++ b/calendar/lightning/content/messenger-overlay-sidebar.js
@@ -85,22 +85,22 @@ var calendarTabType = {
                 return {
                     // Since we do strange tab switching logic in ltnSwitch2Calendar,
                     // we should store the current tab state ourselves.
                     background: (aTab != tabmail.currentTabInfo)
                 };
             },
 
             restoreTab: function(aTabmail, aState) {
-                aState.title = ltnGetString("lightning", "tabTitleCalendar");
+                aState.title = cal.l10n.getLtnString("tabTitleCalendar");
                 aTabmail.openTab("calendar", aState);
             },
 
             onTitleChanged: function(aTab) {
-                aTab.title = ltnGetString("lightning", "tabTitleCalendar");
+                aTab.title = cal.l10n.getLtnString("tabTitleCalendar");
             },
 
             supportsCommand: (aCommand, aTab) => calendarController2.supportsCommand(aCommand),
             isCommandEnabled: (aCommand, aTab) => calendarController2.isCommandEnabled(aCommand),
             doCommand: (aCommand, aTab) => calendarController2.doCommand(aCommand),
             onEvent: (aEvent, aTab) => calendarController2.onEvent(aEvent)
         },
 
@@ -130,22 +130,22 @@ var calendarTabType = {
                 return {
                     // Since we do strange tab switching logic in ltnSwitch2Task,
                     // we should store the current tab state ourselves.
                     background: (aTab != tabmail.currentTabInfo)
                 };
             },
 
             restoreTab: function(aTabmail, aState) {
-                aState.title = ltnGetString("lightning", "tabTitleTasks");
+                aState.title = cal.l10n.getLtnString("tabTitleTasks");
                 aTabmail.openTab("tasks", aState);
             },
 
             onTitleChanged: function(aTab) {
-                aTab.title = ltnGetString("lightning", "tabTitleTasks");
+                aTab.title = cal.l10n.getLtnString("tabTitleTasks");
             },
 
             supportsCommand: (aCommand, aTab) => calendarController2.supportsCommand(aCommand),
             isCommandEnabled: (aCommand, aTab) => calendarController2.isCommandEnabled(aCommand),
             doCommand: (aCommand, aTab) => calendarController2.doCommand(aCommand),
             onEvent: (aEvent, aTab) => calendarController2.onEvent(aEvent)
         }
     },
@@ -423,18 +423,18 @@ function ltnIntegrationNotification() {
     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 ltnBrand = ltnGetString("lightning", "brandShortName");
-    let label = ltnGetString("lightning", "integrationLabel", [appBrand, ltnBrand]);
+    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) {
         aAddon.userDisabled = false;
     };
@@ -465,48 +465,48 @@ function ltnIntegrationNotification() {
     let cbKeepIt = function(aNotificationBar, aButton) {
         Preferences.set(kNotify, false);
     };
     let cbOptOut = function(aNotificationBar, aButton) {
         Preferences.set(kNotify, false);
         Preferences.set(kOptOut, true);
         AddonManager.getAddonByID(kLightningGuuid, cbRemoveLightning);
         // let the user know that removal will be applied after restart
-        let restartLabel = ltnGetString("lightning", "integrationRestartLabel", [ltnBrand, appBrand]);
+        let restartLabel = cal.l10n.getLtnString("integrationRestartLabel", [ltnBrand, appBrand]);
         let button = [{
-            label:     ltnGetString("lightning", "integrationUndoButton"),
-            accessKey: ltnGetString("lightning", "integrationUndoAccessKey"),
+            label:     cal.l10n.getLtnString("integrationUndoButton"),
+            accessKey: cal.l10n.getLtnString("integrationUndoAccessKey"),
             popup:     null,
             callback:  cbUndoOptOut
         }, {
-            label:     ltnGetString("lightning", "integrationRestartButton"),
-            accessKey: ltnGetString("lightning", "integrationRestartAccessKey"),
+            label:     cal.l10n.getLtnString("integrationRestartButton"),
+            accessKey: cal.l10n.getLtnString("integrationRestartAccessKey"),
             popup:     null,
             callback:  cbRestartNow
         }];
         notifyBox.appendNotification(restartLabel,
                                      "restart-required",
                                      null,
                                      notifyBox.PRIORITY_INFO_MEDIUM,
                                      button);
     };
 
     let buttons = [{
-        label:     ltnGetString("lightning", "integrationLearnMoreButton"),
-        accessKey: ltnGetString("lightning", "integrationLearnMoreAccessKey"),
+        label:     cal.l10n.getLtnString("integrationLearnMoreButton"),
+        accessKey: cal.l10n.getLtnString("integrationLearnMoreAccessKey"),
         popup:     null,
         callback:  cbLearnMore
     }, {
-        label:     ltnGetString("lightning", "integrationOptOutButton"),
-        accessKey: ltnGetString("lightning", "integrationOptOutAccessKey"),
+        label:     cal.l10n.getLtnString("integrationOptOutButton"),
+        accessKey: cal.l10n.getLtnString("integrationOptOutAccessKey"),
         popup:     null,
         callback:  cbOptOut
     }, {
-        label:     ltnGetString("lightning", "integrationKeepItButton"),
-        accessKey: ltnGetString("lightning", "integrationKeepItAccessKey"),
+        label:     cal.l10n.getLtnString("integrationKeepItButton"),
+        accessKey: cal.l10n.getLtnString("integrationKeepItAccessKey"),
         popup:     null,
         callback:  cbKeepIt
     }];
 
     // we use PRIORITY_INFO_MEDIUM to overrule notifications from specialTabs.js if any
     let notification = notifyBox.appendNotification(label,
                                                     "calendar-integration",
                                                     null,
@@ -658,17 +658,17 @@ var FIRST_DELAY_UNREGISTER = 0;
 
 var gInvitationsOperationListener = {
     mCount: 0,
 
     QueryInterface: XPCOMUtils.generateQI([Components.interfaces.calIOperationListener]),
     onOperationComplete: function(aCalendar, aStatus, aOperationType, aId, aDetail) {
         let invitationsBox = document.getElementById("calendar-invitations-panel");
         if (Components.isSuccessCode(aStatus)) {
-            let value = ltnGetString("lightning", "invitationsLink.label", [this.mCount]);
+            let value = cal.l10n.getLtnString("invitationsLink.label", [this.mCount]);
             document.getElementById("calendar-invitations-label").value = value;
             setElementValue(invitationsBox, this.mCount < 1 && "true", "hidden");
         } else {
             invitationsBox.setAttribute("hidden", "true");
         }
         this.mCount = 0;
     },
 
@@ -921,34 +921,34 @@ function checkCalendarBinaryComponent() 
     AddonManager.getAddonByID(LIGHTNING_GUID, (ext) => {
         if (!ext) {
             return;
         }
 
         let version;
         let appversion = Services.appinfo.version;
         let versionparts = appversion.split(".");
-        let extbrand = ltnGetString("lightning", "brandShortName");
+        let extbrand = cal.l10n.getLtnString("brandShortName");
 
         switch (Services.appinfo.ID) {
             case THUNDERBIRD_GUID: // e.g. 31.4.0 -> 3.3
                 version = ((parseInt(versionparts[0], 10) + 2) / 10).toFixed(1);
                 break;
             case SEAMONKEY_GUID: // e.g. 2.28.4 -> 3.3
                 version = ((parseInt(versionparts[1], 10) + 5) / 10).toFixed(1);
                 break;
         }
 
         let text;
         if (version && version != ext.version) {
             let args = [extbrand, ext.version, version];
-            text = ltnGetString("lightning", "binaryComponentKnown", args);
+            text = cal.l10n.getLtnString("binaryComponentKnown", args);
         } else {
             let brand = cal.calGetString("brand", "brandShortName", null, "branding");
             let args = [extbrand, brand, appversion, ext.version];
-            text = ltnGetString("lightning", "binaryComponentUnknown", args);
+            text = cal.l10n.getLtnString("binaryComponentUnknown", args);
         }
 
-        let title = ltnGetString("lightning", "binaryComponentTitle", [extbrand]);
+        let title = cal.l10n.getLtnString("binaryComponentTitle", [extbrand]);
         openAddonsMgr("addons://detail/" + encodeURIComponent(LIGHTNING_GUID));
         Services.prompt.alert(window, title, text);
     });
 }
--- a/calendar/lightning/modules/ltnInvitationUtils.jsm
+++ b/calendar/lightning/modules/ltnInvitationUtils.jsm
@@ -1,20 +1,21 @@
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 ChromeUtils.import("resource://calendar/modules/calUtils.jsm");
 ChromeUtils.import("resource://calendar/modules/calXMLUtils.jsm");
 ChromeUtils.import("resource://calendar/modules/calRecurrenceUtils.jsm");
 ChromeUtils.import("resource://gre/modules/Preferences.jsm");
-ChromeUtils.import("resource://calendar/modules/ltnUtils.jsm");
 ChromeUtils.import("resource:///modules/mailServices.js");
 
-this.EXPORTED_SYMBOLS = ["ltn"]; // even though it's defined in ltnUtils.jsm, import needs this
+this.EXPORTED_SYMBOLS = ["ltn"]; /* exported ltn */
+var ltn = {};
+
 ltn.invitation = {
     /**
      * Returns a header title for an ITIP item depending on the response method
      * @param  {calItipItem}     aItipItem  the itip item to check
      * @return {String}          the header title
      */
     getItipHeader: function(aItipItem) {
         let header;
@@ -23,59 +24,57 @@ ltn.invitation = {
             let item = aItipItem.getItemList({})[0];
             let summary = item.getProperty("SUMMARY") || "";
             let organizer = item.organizer;
             let organizerString = (organizer) ?
               (organizer.commonName || organizer.toString()) : "";
 
             switch (aItipItem.responseMethod) {
                 case "REQUEST":
-                    header = ltn.getString("lightning",
-                                           "itipRequestBody",
-                                           [organizerString, summary]);
+                    header = cal.l10n.getLtnString(
+                        "itipRequestBody",
+                        [organizerString, summary]
+                    );
                     break;
                 case "CANCEL":
-                    header = ltn.getString("lightning",
-                                           "itipCancelBody",
-                                           [organizerString, summary]);
+                    header = cal.l10n.getLtnString(
+                        "itipCancelBody",
+                        [organizerString, summary]
+                    );
                     break;
                 case "COUNTER":
                     // falls through
                 case "REPLY": {
                     let attendees = item.getAttendees({});
                     let sender = cal.itip.getAttendeesBySender(attendees, aItipItem.sender);
                     if (sender.length == 1) {
                         if (aItipItem.responseMethod == "COUNTER") {
-                            header = cal.calGetString("lightning",
-                                                      "itipCounterBody",
-                                                      [sender[0].toString(), summary],
-                                                      "lightning");
+                            header = cal.l10n.getLtnString("itipCounterBody",
+                                                           [sender[0].toString(), summary]);
                         } else {
                             let statusString = (sender[0].participationStatus == "DECLINED" ?
                                                 "itipReplyBodyDecline" : "itipReplyBodyAccept");
-                            header = cal.calGetString("lightning",
-                                                      statusString,
-                                                      [sender[0].toString()],
-                                                      "lightning");
+                            header = cal.l10n.getLtnString(statusString, [sender[0].toString()]);
                         }
                     } else {
                         header = "";
                     }
                     break;
                 }
                 case "DECLINECOUNTER":
-                    header = ltn.getString("lightning",
-                                           "itipDeclineCounterBody",
-                                           [organizerString, summary]);
+                    header = cal.l10n.getLtnString(
+                        "itipDeclineCounterBody",
+                        [organizerString, summary]
+                    );
                     break;
             }
         }
 
         if (!header) {
-            header = ltn.getString("lightning", "imipHtml.header", null);
+            header = cal.l10n.getLtnString("imipHtml.header");
         }
 
         return header;
     },
 
     /**
      * Returns the html representation of the event as a DOM document.
      *
@@ -89,17 +88,17 @@ ltn.invitation = {
         let formatter = cal.getDateFormatter();
 
         let linkConverter = Components.classes["@mozilla.org/txttohtmlconv;1"]
                                       .getService(Components.interfaces.mozITXTToHTMLConv);
 
         let field = function(aField, aContentText, aConvert) {
             let descr = doc.getElementById("imipHtml-" + aField + "-descr");
             if (descr) {
-                let labelText = ltn.getString("lightning", "imipHtml." + aField, null);
+                let labelText = cal.l10n.getLtnString("imipHtml." + aField);
                 descr.textContent = labelText;
             }
 
             if (aContentText) {
                 let content = doc.getElementById("imipHtml-" + aField + "-content");
                 doc.getElementById("imipHtml-" + aField + "-row").hidden = false;
                 if (aConvert) {
                     // we convert special characters first to not mix up html conversion
@@ -184,17 +183,17 @@ ltn.invitation = {
                     cal.data.binaryInsert(modifiedOccurrences, exc, dateComptor, true);
                 }
             }
 
             let stringifyOcc = function(occ) {
                 let formattedExc = formatter.formatItemInterval(occ);
                 let occLocation = occ.getProperty("LOCATION");
                 if (occLocation != aEvent.getProperty("LOCATION")) {
-                    let location = ltn.getString("lightning", "imipHtml.newLocation", [occLocation]);
+                    let location = cal.l10n.getLtnString("imipHtml.newLocation", [occLocation]);
                     formattedExc += " (" + location + ")";
                 }
                 return formattedExc;
             };
 
             if (modifiedOccurrences.length > 0) {
                 field("modifiedOccurrences", modifiedOccurrences.map(stringifyOcc).join("\n"));
             }
@@ -233,38 +232,38 @@ ltn.invitation = {
         let setupAttendee = function(aAttendee) {
             let row = attendeeTemplate.cloneNode(true);
             row.removeAttribute("id");
             row.removeAttribute("hidden");
 
             // resolve delegatees/delegators to display also the CN
             let del = cal.itip.resolveDelegation(aAttendee, attendees);
             if (del.delegators != "") {
-                del.delegators = " " + ltn.getString("lightning", "imipHtml.attendeeDelegatedFrom",
+                del.delegators = " " + cal.l10n.getLtnString("imipHtml.attendeeDelegatedFrom",
                                                      [del.delegators]);
             }
 
             // display itip icon
             let role = aAttendee.role || "REQ-PARTICIPANT";
             let partstat = aAttendee.participationStatus || "NEEDS-ACTION";
             let userType = aAttendee.userType || "INDIVIDUAL";
             let itipIcon = row.getElementsByClassName("itip-icon")[0];
             itipIcon.setAttribute("role", role);
             itipIcon.setAttribute("usertype", userType);
             itipIcon.setAttribute("partstat", partstat);
             let attName = aAttendee.commonName && aAttendee.commonName.length
                           ? aAttendee.commonName : aAttendee.toString();
-            let userTypeString = ltn.getString("lightning", "imipHtml.attendeeUserType2." + userType,
-                                               [aAttendee.toString()]);
-            let roleString = ltn.getString("lightning", "imipHtml.attendeeRole2." + role,
-                                           [userTypeString]);
-            let partstatString = ltn.getString("lightning", "imipHtml.attendeePartStat2." + partstat,
-                                               [attName, del.delegatees]);
-            let itipTooltip = ltn.getString("lightning", "imipHtml.attendee.combined",
-                                            [roleString, partstatString]);
+            let userTypeString = cal.l10n.getLtnString("imipHtml.attendeeUserType2." + userType,
+                                                       [aAttendee.toString()]);
+            let roleString = cal.l10n.getLtnString("imipHtml.attendeeRole2." + role,
+                                                   [userTypeString]);
+            let partstatString = cal.l10n.getLtnString("imipHtml.attendeePartStat2." + partstat,
+                                                       [attName, del.delegatees]);
+            let itipTooltip = cal.l10n.getLtnString("imipHtml.attendee.combined",
+                                                    [roleString, partstatString]);
             row.setAttribute("title", itipTooltip);
             // display attendee
             row.getElementsByClassName("attendee-name")[0].textContent = aAttendee.toString() +
                                                                          del.delegators;
             return row;
         };
 
         // Fill rows for attendees and organizer
deleted file mode 100644
--- a/calendar/lightning/modules/ltnUtils.jsm
+++ /dev/null
@@ -1,22 +0,0 @@
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this file,
- * You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-/* exported ltn */
-
-ChromeUtils.import("resource://calendar/modules/calUtils.jsm");
-
-this.EXPORTED_SYMBOLS = ["ltn"];
-var ltn = {
-    /**
-     * Gets the value of a string in a .properties file from the lightning bundle
-     *
-     * @param {String} aBundleName  the name of the properties file. It is assumed that the
-     *                              file lives in chrome://lightning/locale/
-     * @param {String} aStringName  the name of the string within the properties file
-     * @param {Array}  aParams      [optional] array of parameters to format the string
-     */
-    getString: function(aBundleName, aStringName, aParams) {
-        return cal.calGetString(aBundleName, aStringName, aParams, "lightning");
-    }
-};
--- a/calendar/lightning/modules/moz.build
+++ b/calendar/lightning/modules/moz.build
@@ -1,9 +1,8 @@
 # vim: set filetype=python:
 # This Source Code Form is subject to the terms of the Mozilla Public
 # License, v. 2.0. If a copy of the MPL was not distributed with this
 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
 
 EXTRA_JS_MODULES += [
     'ltnInvitationUtils.jsm',
-    'ltnUtils.jsm',
 ]