firefox addon - How to use locale entity in js-code -
is possible value of entity
<!entity gatwayerror "gateway error">
using javascript? reference them in xul file using
&gatewayerror;
update: in ff-sidebar.xul
within <page>
have
<stringbundleset id="stringbundleset"> <stringbundle id="strings" src="chrome://myaddon/locale/de/sidebar.properties"/> </stringbundleset>
in ff-sidebar.js
on click:
var strbundle = document.getelementbyid("strings"); var localizedstring = strbundle.getstring("test");
this gives me following error
should not
var strbundle = document.getelementbyid("stringbundleset");
this gives me no error no result too.
basically neil posted there need (minus first paragraph rant :p )
here's example (basically digest neil's links):
your xul file:
<stringbundleset id="strbundles"> <stringbundle id="strings" src="chrome://yourextension/locale/something.properties"/> </stringbundleset>
your something.properties (there define localized strings key=value). of course can have many files want/need:
something=some text localization something2=some more text
your js file:
var strbundle = document.getelementbyid("strings"); var localizedstring = strbundle.getstring("something");
hope helps.
Comments
Post a Comment