Skip to content

Commit

Permalink
Bug 1587046, fix mistakes in Fluent markup l10n doc, r=stas
Browse files Browse the repository at this point in the history
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)

Differential Revision: https://phabricator.services.mozilla.com/D55831

--HG--
extra : moz-landing-system : lando
  • Loading branch information
Pike committed Dec 4, 2019
1 parent 99cffc7 commit 074c50b
Showing 1 changed file with 9 additions and 13 deletions.
22 changes: 9 additions & 13 deletions intl/l10n/docs/fluent/tutorial.rst
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ a more complex example like:
### These messages correspond to security and privacy user interface.
###
### Please, choose simple and non-threatening language when localizing
### Please choose simple and non-threatening language when localizing
### to help user feel in control when interacting with the UI.
## General Section
Expand All @@ -127,7 +127,7 @@ a more complex example like:
update-application-info =
You are using { -brand-short-name } Version: { $version }.
<span>Please, read the <a>privacy policy</a>.</span>
Please read the <a>privacy policy</a>.
The above, of course, is a particular selection of complex strings intended to exemplify
the new features and concepts introduced by Fluent.
Expand Down Expand Up @@ -200,18 +200,16 @@ The value can be a whole fragment of DOM:

.. code-block:: html

<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 data-l10n-id="update-application-info" data-l10n-args='{"version": "60.0"}'>
<a data-l10n-name="privacy-url" href="http://www.mozilla.org/privacy" />
</p>

.. code-block:: fluent
-brand-short-name = Firefox
update-application-info =
You are using { -brand-short-name } Version: { $version }.
<span>Please, read the <a>privacy policy</a>.</span>
Please read the <a data-l10n-name="privacy-url">privacy policy</a>.
Fluent will overlay the translation onto the source fragment preserving attributes like
Expand All @@ -220,11 +218,9 @@ inside. The resulting localized content will look like this:

.. code-block:: html

<p data-l10n-id="update-application-info" data-l10n-args="{'version': '60.0'}">
<p data-l10n-id="update-application-info" data-l10n-args='{"version": "60.0"}'">
You are using Firefox Version: 60.0.
<span class="bold">
Please, read the <a href="http://www.mozilla.org/privacy">privacy policy</a>.
</span>
Please read the <a href="http://www.mozilla.org/privacy">privacy policy</a>.
</p>
Expand Down Expand Up @@ -287,9 +283,9 @@ facilitates encoding l10n arguments as JSON:
.. code-block:: javascript
document.l10n.setAttributes(element "containers-disable-alert-ok-button", {
document.l10n.setAttributes(element, "containers-disable-alert-ok-button", {
tabCount: 5
}
});
__ https://github.com/projectfluent/fluent/wiki/Good-Practices-for-Developers
Expand Down

0 comments on commit 074c50b

Please sign in to comment.