!import
(0 calls, 0 incl. v-uS, 0 excl. v-uS)
1 <?xml version="1.0"?>
2
3 <bindings id="stringBundleBindings"
4 xmlns="http://www.mozilla.org/xbl"
5 xmlns:xul="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
6
7 <binding id="stringbundleset" extends="xul:box"/>
8
9 <binding id="stringbundle" extends="xul:spacer">
10 <implementation name="XStringBundle">
11
12 <method name="getString">
13 <parameter name="aStringKey"/>
getString
(0 calls, 0 incl. v-uS, 0 excl. v-uS)
14 <body>
15 <![CDATA[
16 try {
17 return this.stringBundle.GetStringFromName(aStringKey);
18 }
19 catch (e) {
20 dump("*** Failed to get string " + aStringKey + " in bundle: " + this.src + "\n");
21 throw e;
22 }
23 ]]>
24 </body>
25 </method>
26
27 <method name="getFormattedString">
28 <parameter name="aStringKey"/>
29 <parameter name="aStringsArray"/>
getFormattedString
(0 calls, 0 incl. v-uS, 0 excl. v-uS)
30 <body>
31 <![CDATA[
32 try {
33 return this.stringBundle.formatStringFromName(aStringKey, aStringsArray, aStringsArray.length);
34 }
35 catch (e) {
36 dump("*** Failed to format string " + aStringKey + " in bundle: " + this.src + "\n");
37 throw e;
38 }
39 ]]>
40 </body>
41 </method>
42
43 <property name="stringBundle" readonly="true">
get_stringBundle
(0 calls, 0 incl. v-uS, 0 excl. v-uS)
44 <getter>
45 <![CDATA[
46 if (!this._bundle) {
47 try {
48 var stringBundleService = Components.classes["@mozilla.org/intl/stringbundle;1"]
49 .getService(Components.interfaces.nsIStringBundleService);
50 this._bundle = stringBundleService.createBundle(this.src, this.appLocale);
51 }
52 catch (e) {
53 dump("Failed to get stringbundle:\n");
54 dump(e + "\n");
55 }
56 }
57 return this._bundle;
58 ]]>
59 </getter>
60 </property>
61
62 <property name="src">
get_src
(0 calls, 0 incl. v-uS, 0 excl. v-uS)
63 <getter>
64 <![CDATA[
65 return this.getAttribute("src");
66 ]]>
67 </getter>
set_src
(0 calls, 0 incl. v-uS, 0 excl. v-uS)
68 <setter>
69 <![CDATA[
70 this._bundle = null;
71 this.setAttribute("src", val);
72 return val;
73 ]]>
74 </setter>
75 </property>
76
77 <property name="appLocale">
get_appLocale
(0 calls, 0 incl. v-uS, 0 excl. v-uS)
78 <getter>
79 <![CDATA[
80 try {
81 var localeService = Components.classes["@mozilla.org/intl/nslocaleservice;1"]
82 .getService(Components.interfaces.nsILocaleService);
83 return localeService.getApplicationLocale();
84 }
85 catch (ex) {
86 return null;
87 }
88 ]]>
89 </getter>
90 </property>
91
92 <property name="strings">
get_strings
(0 calls, 0 incl. v-uS, 0 excl. v-uS)
93 <getter>
94 <![CDATA[
95 // Note: this is a sucky method name! Should be:
96 // readonly attribute nsISimpleEnumerator strings;
97 return this.stringBundle.getSimpleEnumeration();
98 ]]>
99 </getter>
100 </property>
101
field__bundle
(0 calls, 0 incl. v-uS, 0 excl. v-uS)
102 <field name="_bundle">null</field>
103
104 </implementation>
105 </binding>
106
107 </bindings>