Labs/JS Modules: Difference between revisions

(describe the new StringBundle module)
Line 127: Line 127:
Note: in addition to the API described above, the StringBundle object supports the API for the <code>stringbundle</code> XBL binding to make it easier to switch from the binding to the module:
Note: in addition to the API described above, the StringBundle object supports the API for the <code>stringbundle</code> XBL binding to make it easier to switch from the binding to the module:


  <strike>let strings = document.getElementById("myStringBundleElement");</strike>
  let strings = <strike>document.getElementById("myStringBundleElement");</strike>
let strings = new StringBundle("chrome://example/locale/strings.properties");
              new StringBundle("chrome://example/locale/strings.properties");
  let foo = strings.getString("foo");
  let foo = strings.getString("foo");
  let barFormatted = strings.getFormattedString("bar", [arg1, arg2]);
  let barFormatted = strings.getFormattedString("bar", [arg1, arg2]);
Line 136: Line 136:
   dump (string.key + " = " + string.value + "\n");
   dump (string.key + " = " + string.value + "\n");
  }
  }


== URI ==
== URI ==
canmove, Confirmed users
2,056

edits