Bug 1412230 - Replace the word "Company" with "Organization". r=lchang,flod draft
authorScott Wu <scottcwwu@gmail.com>
Fri, 27 Oct 2017 16:20:44 +0800
changeset 688573 08d56dbf08708834a630506d07d2e49055ddf2e3
parent 688337 d3910b7628b8066d3f30d58b17b5824b05768854
child 738106 5d1080a893c603c30100079eea378e98ebdd97e7
push id86790
push userbmo:scwwu@mozilla.com
push dateMon, 30 Oct 2017 09:29:54 +0000
reviewerslchang, flod
bugs1412230
milestone58.0a1
Bug 1412230 - Replace the word "Company" with "Organization". r=lchang,flod MozReview-Commit-ID: 6e8dm5QMbxk
browser/extensions/formautofill/FormAutofillUtils.jsm
browser/extensions/formautofill/content/editAddress.xhtml
browser/extensions/formautofill/content/formautofill.xml
browser/extensions/formautofill/locales/en-US/formautofill.properties
browser/extensions/formautofill/test/browser/browser_autocomplete_footer.js
--- a/browser/extensions/formautofill/FormAutofillUtils.jsm
+++ b/browser/extensions/formautofill/FormAutofillUtils.jsm
@@ -18,17 +18,17 @@ const ALTERNATIVE_COUNTRY_NAMES = {
 
 const ADDRESSES_COLLECTION_NAME = "addresses";
 const CREDITCARDS_COLLECTION_NAME = "creditCards";
 const ENABLED_AUTOFILL_ADDRESSES_PREF = "extensions.formautofill.addresses.enabled";
 const AUTOFILL_CREDITCARDS_AVAILABLE_PREF = "extensions.formautofill.creditCards.available";
 const ENABLED_AUTOFILL_CREDITCARDS_PREF = "extensions.formautofill.creditCards.enabled";
 const MANAGE_ADDRESSES_KEYWORDS = ["manageAddressesTitle", "addNewAddressTitle"];
 const EDIT_ADDRESS_KEYWORDS = [
-  "givenName", "additionalName", "familyName", "organization", "streetAddress",
+  "givenName", "additionalName", "familyName", "organization2", "streetAddress",
   "state", "province", "city", "country", "zip", "postalCode", "email", "tel",
 ];
 const MANAGE_CREDITCARDS_KEYWORDS = ["manageCreditCardsTitle", "addNewCreditCardTitle", "showCreditCardsBtnLabel"];
 const EDIT_CREDITCARD_KEYWORDS = ["cardNumber", "nameOnCard", "cardExpires"];
 
 // The maximum length of data to be saved in a single field for preventing DoS
 // attacks that fill the user's hard drive(s).
 const MAX_FIELD_VALUE_LENGTH = 200;
--- a/browser/extensions/formautofill/content/editAddress.xhtml
+++ b/browser/extensions/formautofill/content/editAddress.xhtml
@@ -21,17 +21,17 @@
       <span data-localization="additionalName"/>
       <input id="additional-name" type="text"/>
     </label>
     <label id="family-name-container">
       <span data-localization="familyName"/>
       <input id="family-name" type="text"/>
     </label>
     <label id="organization-container">
-      <span data-localization="organization"/>
+      <span data-localization="organization2"/>
       <input id="organization" type="text"/>
     </label>
     <label id="street-address-container">
       <span data-localization="streetAddress"/>
       <textarea id="street-address" rows="3"/>
     </label>
     <label id="address-level2-container">
       <span data-localization="city"/>
--- a/browser/extensions/formautofill/content/formautofill.xml
+++ b/browser/extensions/formautofill/content/formautofill.xml
@@ -186,32 +186,35 @@
            * 2. An address was selested: Show the additional categories that will also be filled.
            * 3. An address was selected, but the focused category is the same as the only one category: Only show
            * the exact category that we're going to fill in.
            *
            * @private
            * @param {string[]} data.categories
            *        The categories of all the fields contained in the selected address.
            */
-          const namespace = "category.";
           this._updateWarningNote = ({data} = {}) => {
             let categories = (data && data.categories) ? data.categories : this._allFieldCategories;
             // If the length of categories is 1, that means all the fillable fields are in the same
             // category. We will change the way to inform user according to this flag. When the value
             // is true, we show "Also autofills ...", otherwise, show "Autofills ..." only.
             let hasExtraCategories = categories.length > 1;
             // Show the categories in certain order to conform with the spec.
-            let orderedCategoryList = ["address", "name", "organization", "tel", "email"];
+            let orderedCategoryList = [{id: "address", l10nId: "category.address"},
+                                       {id: "name", l10nId: "category.name"},
+                                       {id: "organization", l10nId: "category.organization2"},
+                                       {id: "tel", l10nId: "category.tel"},
+                                       {id: "email", l10nId: "category.email"}];
             let showCategories = hasExtraCategories ?
-              orderedCategoryList.filter(category => categories.includes(category) && category != this._focusedCategory) :
-              [this._focusedCategory];
+              orderedCategoryList.filter(category => categories.includes(category.id) && category.id != this._focusedCategory) :
+              [orderedCategoryList.find(category => category.id == this._focusedCategory)];
 
             let separator = this._stringBundle.GetStringFromName("fieldNameSeparator");
             let warningTextTmplKey = hasExtraCategories ? "phishingWarningMessage" : "phishingWarningMessage2";
-            let categoriesText = showCategories.map(category => this._stringBundle.GetStringFromName(namespace + category)).join(separator);
+            let categoriesText = showCategories.map(category => this._stringBundle.GetStringFromName(category.l10nId)).join(separator);
 
             this._warningTextBox.textContent = this._stringBundle.formatStringFromName(warningTextTmplKey,
               [categoriesText], 1);
             this.parentNode.parentNode.adjustHeight();
           };
 
           this._adjustAcItem();
         ]]>
--- a/browser/extensions/formautofill/locales/en-US/formautofill.properties
+++ b/browser/extensions/formautofill/locales/en-US/formautofill.properties
@@ -42,29 +42,29 @@ openAutofillMessagePanel = Open Form Aut
 # displayed at the bottom of the drop down suggestion, to open Form Autofill browser preferences.
 autocompleteFooterOption = Form Autofill Options
 autocompleteFooterOptionOSX = Form Autofill Preferences
 # LOCALIZATION NOTE (autocompleteFooterOptionShort, autocompleteFooterOptionOSXShort): Used as a label for the button,
 # displayed at the bottom of the drop down suggestion, to open Form Autofill browser preferences. This version is used
 # instead of autocompleteFooterOption* when the menu width is below 185px.
 autocompleteFooterOptionShort = More Options
 autocompleteFooterOptionOSXShort = Preferences
-# LOCALIZATION NOTE (category.address, category.name, category.organization, category.tel, category.email):
+# LOCALIZATION NOTE (category.address, category.name, category.organization2, category.tel, category.email):
 # Used in autofill drop down suggestion to indicate what other categories Form Autofill will attempt to fill.
 category.address = address
 category.name = name
-category.organization = company
+category.organization2 = organization
 category.tel = phone
 category.email = email
 # LOCALIZATION NOTE (fieldNameSeparator): This is used as a separator between categories.
 fieldNameSeparator = ,\u0020
 # LOCALIZATION NOTE (phishingWarningMessage, phishingWarningMessage2): The warning
 # text that is displayed for informing users what categories are about to be filled.
 # "%S" will be replaced with a list generated from the pre-defined categories.
-# The text would be e.g. Also autofills company, phone, email.
+# The text would be e.g. Also autofills organization, phone, email.
 phishingWarningMessage = Also autofills %S
 phishingWarningMessage2 = Autofills %S
 # LOCALIZATION NOTE (insecureFieldWarningDescription): %S is brandShortName. This string is used in drop down
 # suggestion when users try to autofill credit card on an insecure website (without https).
 insecureFieldWarningDescription = %S has detected an insecure site. Form Autofill is temporarily disabled.
 
 # LOCALIZATION NOTE (autofillAddressesCheckbox): Label for the checkbox that enables autofilling addresses.
 autofillAddressesCheckbox = Autofill addresses
@@ -95,17 +95,17 @@ editBtnLabel = Edit…
 
 # LOCALIZATION NOTE (addNewAddressTitle, editAddressTitle): The dialog title for creating or editing addresses
 # in browser preferences.
 addNewAddressTitle = Add New Address
 editAddressTitle = Edit Address
 givenName = First Name
 additionalName = Middle Name
 familyName = Last Name
-organization = Company
+organization2 = Organization
 streetAddress = Street Address
 city = City
 province = Province
 state = State
 postalCode = Postal Code
 zip = Zip Code
 country = Country or Region
 tel = Phone
--- a/browser/extensions/formautofill/test/browser/browser_autocomplete_footer.js
+++ b/browser/extensions/formautofill/test/browser/browser_autocomplete_footer.js
@@ -68,20 +68,20 @@ add_task(async function test_phishing_wa
     await closePopup(browser);
   });
 });
 
 add_task(async function test_phishing_warning_complex_categories() {
   await BrowserTestUtils.withNewTab({gBrowser, url: URL}, async function(browser) {
     await openPopupOn(browser, "#street-address");
 
-    await expectWarningText(browser, "Also autofills company, email");
+    await expectWarningText(browser, "Also autofills organization, email");
     await BrowserTestUtils.synthesizeKey("VK_DOWN", {}, browser);
     await expectWarningText(browser, "Autofills address");
     await BrowserTestUtils.synthesizeKey("VK_DOWN", {}, browser);
     await BrowserTestUtils.synthesizeKey("VK_DOWN", {}, browser);
-    await expectWarningText(browser, "Also autofills company, email");
+    await expectWarningText(browser, "Also autofills organization, email");
     await BrowserTestUtils.synthesizeKey("VK_DOWN", {}, browser);
-    await expectWarningText(browser, "Also autofills company, email");
+    await expectWarningText(browser, "Also autofills organization, email");
 
     await closePopup(browser);
   });
 });