[Project_owners] Accessing locale strings

Michael Vincent van Rantwijk, MultiZilla mv_van_rantwijk at yahoo.com
Tue Jul 10 10:35:04 PDT 2007


Pete wrote:
> Hi,
> 
> I'm having trouble accessing strings in my locale folders under
> certain circumstances:
> * When inside a "load" event listener
> * When inside a "setInterval" callback
> 
> I'm guessing that the problem is to do with "document" not being
> defined in these circumstances. Can anyone recommend a way of getting
> access to the locale strings in these cases? I've tried a few things
> with nsIWindowMediate, but with no luck.
> 
> Example below:
> 
> window.addEventListener("load", loadStatusbar, false);
> 
> function loadStatusbar()
> {
>    var str = document.getElementById("updatescanStrings");
>    var alertOneChange = str.getString("alertMessage");
> // Causes error "str has no properties"
> ...
> }

Hm, this rather looks like getElementById("updatescanStrings") is 
failing, otherwise you would probably have seen some JS error about 
document being undefined or what not, which is a lot harder to believe 
without proof.

-- 
Michael Vincent van Rantwijk
- MultiZilla Project Team Lead
- XUL Boot Camp Staff member
- iPhone Application Developer



More information about the Project_owners mailing list