Bug 445831 - /suite/.../contentAreaUtils.js: replace getStringBundle() by a <stringbundle>; (Bv1) Just replace it; r=neil
This commit is contained in:
Родитель
3e3c617432
Коммит
2484209eb6
|
@ -52,6 +52,11 @@
|
|||
<script type="application/x-javascript" src="chrome://communicator/content/nsContextMenu.js"/>
|
||||
<script type="application/x-javascript" src="chrome://communicator/content/contentAreaUtils.js"/>
|
||||
|
||||
<stringbundleset>
|
||||
<stringbundle id="contentAreaCommandsBundle"
|
||||
src="chrome://communicator/locale/contentAreaCommands.properties"/>
|
||||
</stringbundleset>
|
||||
|
||||
<popupset id="contentAreaContextSet">
|
||||
<!-- This is a generic context menu for a content area. It contains
|
||||
each and every possible menu choice. The appropriate items are
|
||||
|
|
|
@ -418,11 +418,9 @@ function internalSave(aURL, aDocument, aDefaultFileName, aContentDisposition,
|
|||
filesFolder = file.clone();
|
||||
|
||||
var nameWithoutExtension = getFileBaseName(filesFolder.leafName);
|
||||
var filesFolderLeafName = getStringBundle().formatStringFromName("filesFolder",
|
||||
[nameWithoutExtension],
|
||||
1);
|
||||
|
||||
filesFolder.leafName = filesFolderLeafName;
|
||||
filesFolder.leafName =
|
||||
document.getElementById("contentAreaCommandsBundle")
|
||||
.getFormattedString("filesFolder", [nameWithoutExtension]);
|
||||
}
|
||||
|
||||
var encodingFlags = 0;
|
||||
|
@ -576,8 +574,9 @@ function getTargetFile(aFpP)
|
|||
|
||||
var fp = makeFilePicker();
|
||||
var titleKey = aFpP.fpTitleKey || "SaveLinkTitle";
|
||||
var bundle = getStringBundle();
|
||||
fp.init(window, bundle.GetStringFromName(titleKey),
|
||||
fp.init(window,
|
||||
document.getElementById("contentAreaCommandsBundle")
|
||||
.getString(titleKey),
|
||||
Components.interfaces.nsIFilePicker.modeSave);
|
||||
|
||||
fp.displayDirectory = dir;
|
||||
|
@ -653,7 +652,6 @@ const SAVEMODE_COMPLETE_TEXT = 0x02;
|
|||
// filter must be the third filter appended.
|
||||
function appendFiltersForContentType(aFilePicker, aContentType, aFileExtension, aSaveMode)
|
||||
{
|
||||
var bundle = getStringBundle();
|
||||
// The bundle name for saving only a specific content type.
|
||||
var bundleName;
|
||||
// The corresponding filter string for a specific content type.
|
||||
|
@ -709,10 +707,11 @@ function appendFiltersForContentType(aFilePicker, aContentType, aFileExtension,
|
|||
}
|
||||
|
||||
if (aSaveMode & SAVEMODE_COMPLETE_DOM) {
|
||||
aFilePicker.appendFilter(bundle.GetStringFromName("WebPageCompleteFilter"), filterString);
|
||||
const bundle = document.getElementById("contentAreaCommandsBundle");
|
||||
aFilePicker.appendFilter(bundle.getString("WebPageCompleteFilter"), filterString);
|
||||
// We should always offer a choice to save document only if
|
||||
// we allow saving as complete.
|
||||
aFilePicker.appendFilter(bundle.GetStringFromName(bundleName), filterString);
|
||||
aFilePicker.appendFilter(bundle.getString(bundleName), filterString);
|
||||
}
|
||||
|
||||
if (aSaveMode & SAVEMODE_COMPLETE_TEXT)
|
||||
|
@ -738,13 +737,6 @@ function getPostData(aDocument)
|
|||
return null;
|
||||
}
|
||||
|
||||
function getStringBundle()
|
||||
{
|
||||
return Components.classes["@mozilla.org/intl/stringbundle;1"]
|
||||
.getService(Components.interfaces.nsIStringBundleService)
|
||||
.createBundle("chrome://communicator/locale/contentAreaCommands.properties");
|
||||
}
|
||||
|
||||
// Get the preferences branch ("browser.download." for normal 'save' mode)...
|
||||
function getPrefsBrowserDownload(branch)
|
||||
{
|
||||
|
@ -891,7 +883,8 @@ function getDefaultFileName(aDefaultFileName, aURI, aDocument,
|
|||
}
|
||||
try {
|
||||
// 7) Use the default file name
|
||||
return getStringBundle().GetStringFromName("DefaultSaveFileName");
|
||||
return document.getElementById("contentAreaCommandsBundle")
|
||||
.getString("DefaultSaveFileName");
|
||||
} catch (e) {
|
||||
//in case localized string cannot be found
|
||||
}
|
||||
|
|
|
@ -1074,13 +1074,12 @@ nsContextMenu.prototype = {
|
|||
searchSelectText = searchSelectText.substr(0, 15) + "...";
|
||||
|
||||
// Format "Search for <selection>" string to show in menu.
|
||||
// Use |getStringBundle()| from <contentAreaUtils.js>.
|
||||
var bundle = getStringBundle();
|
||||
searchSelectText = bundle.formatStringFromName("searchText",
|
||||
[searchSelectText], 1);
|
||||
const bundle = document.getElementById("contentAreaCommandsBundle");
|
||||
searchSelectText = bundle.getFormattedString("searchText",
|
||||
[searchSelectText]);
|
||||
this.setItemAttr("context-searchselect", "label", searchSelectText);
|
||||
this.setItemAttr("context-searchselect", "accesskey",
|
||||
bundle.GetStringFromName("searchText.accesskey"));
|
||||
bundle.getString("searchText.accesskey"));
|
||||
|
||||
return true;
|
||||
},
|
||||
|
|
|
@ -101,11 +101,10 @@
|
|||
.getService(nsIPermissionManager);
|
||||
if (permissionmanager.testPermission(uri, "image") == nsIPermissionManager.DENY_ACTION)
|
||||
action = "unblock";
|
||||
// Use |getStringBundle()| from <contentAreaUtils.js>.
|
||||
const bundle = getStringBundle();
|
||||
const bundle = document.getElementById("contentAreaCommandsBundle");
|
||||
var blockImageMenuItem = document.getElementById("context-" + action + "image");
|
||||
blockImageMenuItem.setAttribute("label", bundle.formatStringFromName(action + "Image", [serverLabel], 1));
|
||||
blockImageMenuItem.setAttribute("accesskey", bundle.GetStringFromName(action + "Image.accesskey"));
|
||||
blockImageMenuItem.setAttribute("label", bundle.getFormattedString(action + "Image", [serverLabel]));
|
||||
blockImageMenuItem.setAttribute("accesskey", bundle.getString(action + "Image.accesskey"));
|
||||
gContextMenu.showItem("context-" + action + "image", true);
|
||||
}
|
||||
} catch (e) {}
|
||||
|
|
Загрузка…
Ссылка в новой задаче