Discussion:
Trouble with stringbundles and XULRunner
McKnight, Mark
17 years ago
Permalink
Hi all,



I am following the directions in the tutorial at:



http://developer.mozilla.org/en/docs/XUL_Tutorial:Property_Files



First I create a test.properties file in the content directory alongside
my .xul file with the following content:



message.helloWorld=Hello World.



Then I add the following code to my .xul file (copied and pasted from
the tutorial):



<stringbundleset id="strbundles">

<stringbundle id="strings"
src="test.properties"/>

</stringbundleset>



Finally, I add this code to my .js file (again pulled directly from the
tutorial):



var strbundle = document.getElementById("strings");

var helloWorld=strbundle.getString("message.helloWorld");

alert(helloWorld);



When I run the application with XULRunner (1.9b5pre - 2008031309) I
receive the following error message in the Error Console:



Error: uncaught exception: [Exception... "Component returned failure
code: 0x804b000a (NS_ERROR_MALFORMED_URI)
[nsIStringBundle.GetStringFromName]" nsresult: "0x804b000a
(NS_ERROR_MALFORMED_URI)" location: "JS frame :: XStringBundle ::
getString :: line 17" data: no]



Any ideas would be greatly appreciated.



Thanks in advance,



Mark.
Question
17 years ago
Permalink
src="test.properties"
Try a chrome:// absolute path instead.
Hope it helps.

On Tue, Mar 18, 2008 at 10:01 PM, McKnight, Mark <
...
--
Post by McKnight, Mark
: ~
McKnight, Mark
17 years ago
Permalink
Thanks everyone!



Changing "test.properties" to
"chrome://test_application/content/test.properties" solved the issue.



Regards,



Mark.



_____

From: Question [mailto:***@gmail.com]
Sent: Tuesday, March 18, 2008 11:37 AM
To: McKnight, Mark
Cc: dev-tech-***@lists.mozilla.org
Subject: Re: Trouble with stringbundles and XULRunner



src="test.properties"
Try a chrome:// absolute path instead.
Hope it helps.

On Tue, Mar 18, 2008 at 10:01 PM, McKnight, Mark
<***@hcp.med.harvard.edu> wrote:

Hi all,



I am following the directions in the tutorial at:



http://developer.mozilla.org/en/docs/XUL_Tutorial:Property_Files



First I create a test.properties file in the content directory alongside
my .xul file with the following content:



message.helloWorld=Hello World.



Then I add the following code to my .xul file (copied and pasted from
the tutorial):



<stringbundleset id="strbundles">

<stringbundle id="strings"
src="test.properties"/>

</stringbundleset>



Finally, I add this code to my .js file (again pulled directly from the
tutorial):



var strbundle = document.getElementById("strings");

var helloWorld=strbundle.getString("message.helloWorld");

alert(helloWorld);



When I run the application with XULRunner (1.9b5pre - 2008031309) I
receive the following error message in the Error Console:



Error: uncaught exception: [Exception... "Component returned failure
code: 0x804b000a (NS_ERROR_MALFORMED_URI)
[nsIStringBundle.GetStringFromName]" nsresult: "0x804b000a
(NS_ERROR_MALFORMED_URI)" location: "JS frame :: XStringBundle ::
getString :: line 17" data: no]



Any ideas would be greatly appreciated.



Thanks in advance,



Mark.

_______________________________________________
dev-tech-xul mailing list
dev-tech-***@lists.mozilla.org
https://lists.mozilla.org/listinfo/dev-tech-xul
--
: ~
Neil
17 years ago
Permalink
Changing "test.properties" to "chrome://test_application/content/test.properties" solved the issue.
The point of .properties files is that they live in /locale/ rather than
/content/ ...
--
Warning: May contain traces of nuts.
Tom
17 years ago
Permalink
Post by Neil
Changing "test.properties" to "chrome://test_application/content/test.properties" solved the issue.
The point of .properties files is that they live in /locale/ rather than
/content/ ...
--
Warning: May contain traces of nuts.
Even then it wants a chrome URl. Either the code or docs need
correcting.

Tom
17 years ago
Permalink
Post by McKnight, Mark
<stringbundleset id="strbundles">
<stringbundle id="strings"
src="test.properties"/>
</stringbundleset>
Use the full chrome URL to test.properties.
Loading...