Closed Bug 1587046 Opened 5 years ago Closed 4 years ago

Fluent documentation is wrong for Markup Localization

Categories

(Localization Infrastructure and Tools :: General, task)

task
Not set
normal

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: standard8, Assigned: Pike)

Details

Attachments

(1 file)

Currently the Markup Localization section of the Fluent documentation appears to be incorrect. The example it gives is:

<p data-l10n-id="update-application-info" data-l10n-args="{'version': '60.0'}">
  <span class="bold">
    <a href="http://www.mozilla.org/privacy" />
  </span>
</p>
-brand-short-name = Firefox
update-application-info =
    You are using { -brand-short-name } Version: { $version }.
    <span>Please, read the <a>privacy policy</a>.</span>

However, for this to work, it appears you need to specify data-l10n-name as an attribute in the <a> of both the html definition and the string definition.

I only worked that out after looking at other examples.

I'm not sure in this case, if you'd have to specify the name on the span as well.

Two more things on that page:

  • In the example I duplicated in comment 0 it shows data-l10n-args="{'version': '60.0'}". This is unparsable JSON and should be data-l10n-args='{"version": "60.0"}'
  • (not significant) Further down, the document.l10n.setAttributes example is missing the final );
Assignee: nobody → l10n

There's a few mistakes in the Fluent markup docs, most found
by standard8:

  • data-l10n-name is missing
  • data-l10n-args needs to be valid JSON
  • setAttributes lacks closing );
  • No nested DOM support (that's not mentioned in the bug)
Pushed by axel@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/a57107b92da0
fix mistakes in Fluent markup l10n doc, r=stas
Status: NEW → RESOLVED
Closed: 4 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: