3 years ago
15 days ago


(Reporter: stas, Assigned: stas)


(Depends on 1 bug)


(Whiteboard: [gecko-l20n])

User Story

L20n in Gecko should be able to localize XUL documents.
L20n in Gecko should be able to localize XUL documents.
Depends on: 1280671
The first PoC of this used to take advantage of XBL bindings:

In XUL, you could do:

    <localization id="browser-l10n">
        <source src="chrome://branding/locale/brand.ftl"/>
        <source src="chrome://browser/locale/browser.ftl"/>

And then:

    <textbox id="urlbar"

The value of data-l10n-bundle would be used to look up a <localization> element by the id.  This had a number of problems:

  - we don't have the <localization> elements in l20n-chrome-html at all, but we need to make XUL/XBL embeddable in HTML documents,
  - <localization> elements can't have ids because they might be part of the anonymous content bound by XBL more than once,
  - some bindings currently use <stringbundles> defined in different bindings and they refer to them from the XBL code.

Re. the last point, here's an example:  tabbrowser-tabs uses the tabs-empty-tab-title string which comes from the <localization> defined in the tabbrowser binding.  Furthermore, the <tab> which uses the binding is not part of the anonymous content and doesn't have easy access to tabbrowser's anonymous content (other than hardcoding it).

If this doesn't make sense the recap is:  it's not easy to find the appropriate <localization> element by id or other attribute because they might be hidden in anonymous content.  To mitigate this the next iteration of the implementation stored the Localization elements in a global map (document.l10n) where they can be easily retrieved from by name (document.l10n.get('main')):

Finally, the third iteration moved away from defining resources in <localization> elements.  Instead, the XUL API has been unified with the HTML API, i.e. <link rel="localizaton"> elements are used.
Assignee: nobody → stas
Depends on: 1288443
Depends on: 1288639
Depends on: 1288689
Depends on: 1288690
Mass change dependency tree for bug 1279002 into a whiteboard keyword.
No longer blocks: gecko-l20n
Whiteboard: [gecko-l20n]
No longer blocks: 1288406
Similar to bug 1288406, this shouldn't block bug 1280668 either.  We have basic XUL support on larch already.  This bug will track improving this support.
No longer blocks: 1280668

This is now fixed.

You need to log in before you can comment on or make changes to this bug.