[Pale Moon] Change button labels in cookies dialog

This commit is contained in:
adeshkp 2018-04-26 01:47:28 -04:00 • committed by Roy Tam
commit 1f7eb5a1f1
4 changed files with 48 additions and 22 deletions

View file

@ -5,6 +5,8 @@
const nsICookie = Components.interfaces.nsICookie; const nsICookie = Components.interfaces.nsICookie;
Components.utils.import("resource://gre/modules/PluralForm.jsm");
var gCookiesWindow = { var gCookiesWindow = {
_cm : Components.classes["@mozilla.org/cookiemanager;1"] _cm : Components.classes["@mozilla.org/cookiemanager;1"]
.getService(Components.interfaces.nsICookieManager), .getService(Components.interfaces.nsICookieManager),
@ -24,6 +26,11 @@ var gCookiesWindow = {
this._bundle = document.getElementById("bundlePreferences"); this._bundle = document.getElementById("bundlePreferences");
this._tree = document.getElementById("cookiesList"); this._tree = document.getElementById("cookiesList");
let removeAllCookies = document.getElementById("removeAllCookies");
removeAllCookies.setAttribute("accesskey", this._bundle.getString("removeAllCookies.accesskey"));
let removeSelectedCookies = document.getElementById("removeSelectedCookies");
removeSelectedCookies.setAttribute("accesskey", this._bundle.getString("removeSelectedCookies.accesskey"));
this._populateList(true); this._populateList(true);
document.getElementById("filter").focus(); document.getElementById("filter").focus();
@ -558,12 +565,12 @@ var gCookiesWindow = {
if (item && seln.count == 1 && item.container && item.open) if (item && seln.count == 1 && item.container && item.open)
selectedCookieCount += 2; selectedCookieCount += 2;
var removeCookie = document.getElementById("removeCookie"); let buttonLabel = this._bundle.getString("removeSelectedCookies.label");
var removeCookies = document.getElementById("removeCookies"); let removeSelectedCookies = document.getElementById("removeSelectedCookies");
removeCookie.parentNode.selectedPanel = removeSelectedCookies.label = PluralForm.get(selectedCookieCount, buttonLabel)
selectedCookieCount == 1 ? removeCookie : removeCookies; .replace("#1", selectedCookieCount);
removeCookie.disabled = removeCookies.disabled = !(seln.count > 0); removeSelectedCookies.disabled = !(seln.count > 0);
}, },
performDeletion: function gCookiesWindow_performDeletion(deleteItems) { performDeletion: function gCookiesWindow_performDeletion(deleteItems) {
@ -873,7 +880,17 @@ var gCookiesWindow = {
}, },
_updateRemoveAllButton: function gCookiesWindow__updateRemoveAllButton() { _updateRemoveAllButton: function gCookiesWindow__updateRemoveAllButton() {
document.getElementById("removeAllCookies").disabled = this._view._rowCount == 0; let removeAllCookies = document.getElementById("removeAllCookies");
removeAllCookies.disabled = this._view._rowCount == 0;
let labelStringID = "removeAllCookies.label";
let accessKeyStringID = "removeAllCookies.accesskey";
if (this._view._filtered) {
labelStringID = "removeAllShownCookies.label";
accessKeyStringID = "removeAllShownCookies.accesskey";
}
removeAllCookies.setAttribute("label", this._bundle.getString(labelStringID));
removeAllCookies.setAttribute("accesskey", this._bundle.getString(accessKeyStringID));
}, },
filter: function () { filter: function () {

View file

@ -91,16 +91,9 @@
</vbox> </vbox>
<hbox align="end"> <hbox align="end">
<hbox class="actionButtons" flex="1"> <hbox class="actionButtons" flex="1">
<deck oncommand="gCookiesWindow.deleteCookie();"> <button id="removeSelectedCookies" disabled="true" icon="clear"
<button id="removeCookie" disabled="true" icon="remove" oncommand="gCookiesWindow.deleteCookie();"/>
label="&button.removecookie.label;"
accesskey="&button.removecookie.accesskey;"/>
<button id="removeCookies" disabled="true" icon="remove"
label="&button.removecookies.label;"
accesskey="&button.removecookie.accesskey;"/>
</deck>
<button id="removeAllCookies" disabled="true" icon="clear" <button id="removeAllCookies" disabled="true" icon="clear"
label="&button.removeallcookies.label;" accesskey="&button.removeallcookies.accesskey;"
oncommand="gCookiesWindow.deleteAllCookies();"/> oncommand="gCookiesWindow.deleteAllCookies();"/>
<spacer flex="1"/> <spacer flex="1"/>
#ifndef XP_MACOSX #ifndef XP_MACOSX

View file

@ -7,11 +7,6 @@
<!ENTITY cookiesonsystem.label "The following cookies are stored on your computer:"> <!ENTITY cookiesonsystem.label "The following cookies are stored on your computer:">
<!ENTITY cookiename.label "Cookie Name"> <!ENTITY cookiename.label "Cookie Name">
<!ENTITY cookiedomain.label "Site"> <!ENTITY cookiedomain.label "Site">
<!ENTITY button.removecookies.label "Remove Cookies">
<!ENTITY button.removecookie.label "Remove Cookie">
<!ENTITY button.removecookie.accesskey "R">
<!ENTITY button.removeallcookies.label "Remove All Cookies">
<!ENTITY button.removeallcookies.accesskey "A">
<!ENTITY props.name.label "Name:"> <!ENTITY props.name.label "Name:">
<!ENTITY props.value.label "Content:"> <!ENTITY props.value.label "Content:">

View file

@ -93,6 +93,27 @@ noCookieSelected=<no cookie selected>
cookiesAll=The following cookies are stored on your computer: cookiesAll=The following cookies are stored on your computer:
cookiesFiltered=The following cookies match your search: cookiesFiltered=The following cookies match your search:
# LOCALIZATION NOTE (removeAllCookies, removeAllShownCookies):
# removeAllCookies and removeAllShownCookies are both used on the same one button,
# never displayed together and can share the same accesskey.
# When only partial cookies are shown as a result of keyword search,
# removeAllShownCookies is displayed as button label.
# removeAllCookies is displayed when no keyword search and all cookies are shown.
removeAllCookies.label=Remove All
removeAllCookies.accesskey=A
removeAllShownCookies.label=Remove All Shown
removeAllShownCookies.accesskey=A
# LOCALIZATION NOTE (removeSelectedCookies):
# Semicolon-separated list of plural forms. See:
# http://developer.mozilla.org/en/docs/Localization_and_Plurals
# If you need to display the number of selected elements in your language,
# you can use #1 in your localization as a placeholder for the number.
# For example this is the English string with numbers:
# removeSelectedCookied=Remove #1 Selected;Remove #1 Selected
removeSelectedCookies.label=Remove Selected;Remove Selected
removeSelectedCookies.accesskey=R
#### Offline apps #### Offline apps
offlineAppRemoveTitle=Remove offline website data offlineAppRemoveTitle=Remove offline website data
offlineAppRemovePrompt=After removing this data, %S will not be available offline. Are you sure you want to remove this offline website? offlineAppRemovePrompt=After removing this data, %S will not be available offline. Are you sure you want to remove this offline website?