Workaround for bug 26265, to handle failure to load string bundle at startup. r=ben, a=leaf

This commit is contained in:
sfraser%netscape.com 2000-02-03 23:04:50 +00:00
parent f318953848
commit b67f60eec2
4 changed files with 43 additions and 10 deletions

View File

@ -6,12 +6,20 @@ function Startup()
var okButton = document.getElementById("ok");
var Button2 = document.getElementById("Button2");
var cancelButton = document.getElementById("cancel");
okButton.setAttribute( "value", bundle.GetStringFromName("dontDeleteFiles") );
try {
okButton.setAttribute( "value", bundle.GetStringFromName("dontDeleteFiles") );
Button2.setAttribute( "value", bundle.GetStringFromName("deleteFiles") );
cancelButton.setAttribute( "value", bundle.GetStringFromName("cancel") );
} catch(e) {
okButton.setAttribute( "value", "Don't Delete Files Yah" );
Button2.setAttribute( "value", "Delete Files Yah" );
cancelButton.setAttribute( "value", "Cancel Yah" );
}
okButton.setAttribute( "class", ( okButton.getAttribute("class") + " padded" ) );
Button2.setAttribute( "value", bundle.GetStringFromName("deleteFiles") );
Button2.setAttribute( "class", ( okButton.getAttribute("class") + " padded" ) );
Button2.setAttribute( "style", "display: inherit;" );
cancelButton.setAttribute( "value", bundle.GetStringFromName("cancel") );
cancelButton.setAttribute( "class", ( cancelButton.getAttribute("class") + " padded" ) );
}

View File

@ -159,7 +159,13 @@ function SwitchProfileManagerMode()
if( profileManagerMode == "selection" )
{
prattleIndex = 1; // need to switch to manager's index
captionLine = bundle.GetStringFromName( "pm_title" ); // get manager's caption
try {
captionLine = bundle.GetStringFromName( "pm_title" ); // get manager's caption
} catch(e) {
captionLine = "Manage Profiles Yah";
}
buttonDisplay = "display: inherit;"; // display the manager's buttons
var manage = document.getElementById( "manage" ); // hide the manage profiles button...
var manageParent = manage.parentNode;
@ -169,7 +175,11 @@ function SwitchProfileManagerMode()
}
else {
prattleIndex = 0;
captionLine = bundle.GetStringFromName( "ps_title" );
try {
captionLine = bundle.GetStringFromName( "ps_title" );
} catch(e) {
captionLine = "Select Profile Yah";
}
buttonDisplay = "display: none;";
profileManagerMode = "selection";
PersistAndLoadElements( selItems );

View File

@ -28,7 +28,6 @@ var currProfile = "";
var profile = Components.classes["component://netscape/profile/manager"].createInstance();
if (profile)
profile = profile.QueryInterface(Components.interfaces.nsIProfile);
var bundle = null;
var unset = true;
function StartUp()
@ -37,7 +36,7 @@ function StartUp()
centerWindowOnScreen();
if(window.location && window.location.search && window.location.search == "?manage=true" )
SwitchProfileManagerMode();
// bundle = srGetStrBundle("chrome://profile/locale/profileSelection.properties");
loadElements();
highlightCurrentProfile();
DoEnabling();
@ -226,7 +225,19 @@ function SetUpOKCancelButtons()
doSetOKCancel( onStart, onExit, null, null );
var okButton = document.getElementById("ok");
var cancelButton = document.getElementById("cancel");
okButton.setAttribute( "value", bundle.GetStringFromName("startButton") );
var okButtonString;
var cancelButtonString;
try {
okButtonString = bundle.GetStringFromName("startButton");
cancelButtonString = bundle.GetStringFromName("exitButton");
} catch (e) {
okButtonString = "Start Yah";
cancelButtonString = "Exit Yah";
}
okButton.setAttribute( "value", okButtonString );
okButton.setAttribute( "class", ( okButton.getAttribute("class") + " padded" ) );
cancelButton.setAttribute( "value", bundle.GetStringFromName("exitButton") );
cancelButton.setAttribute( "value", cancelButtonString );
}

View File

@ -164,7 +164,11 @@ function WM_ProgressUpdate( currentPageNumber )
}
var string = "";
string += (currentPageNumber + 1);
string += ( " " + this.bundle.GetStringFromName("oflabel") + " " );
try {
string += ( " " + this.bundle.GetStringFromName("oflabel") + " " );
} catch (e) {
string += "of";
}
string += this.GetMapLength();
var textNode = document.createTextNode ( string );
div.appendChild ( textNode );