Bug 1717085 Comment 3 Edit History

Note: The actual edited comment in the bug view page will always show the original commenter’s name and original timestamp.

(In reply to Thomas D. (:thomas8) from comment #0)
> - Also our Fluent isn't quite fluent yet (see next comment).

https://searchfox.org/comm-central/rev/014b72575f40cf1d2e0cc1d997d8e4bebbd118f9/mail/components/compose/content/MsgComposeCommands.js#5147-5151
```
  msgText.setAttribute("data-l10n-id", "many-public-recipients-info");
  msgText.setAttribute(
    "data-l10n-args",
    JSON.stringify({ count: publicAddressPillsCount })
  );
```
When you need to use JSON.stringify, there's something wrong...
We're trying to localize the `msgText` element dynamically based on a JS variable.
Here's the standard way of achieving the same result with less and cleaner code:
```
  document.l10n.setAttributes(
    msgText,
    "many-public-recipients-info",
    { count: publicAddressPillsCount }
  );
```

Notably, that will even work when `msgText` element has been created, but not yet appended to the document.
(In reply to Thomas D. (:thomas8) from comment #0)
> - Also our Fluent isn't quite fluent yet (see comment 3).

https://searchfox.org/comm-central/rev/014b72575f40cf1d2e0cc1d997d8e4bebbd118f9/mail/components/compose/content/MsgComposeCommands.js#5147-5151
```
  msgText.setAttribute("data-l10n-id", "many-public-recipients-info");
  msgText.setAttribute(
    "data-l10n-args",
    JSON.stringify({ count: publicAddressPillsCount })
  );
```
When you need to use JSON.stringify, there's something wrong...
We're trying to localize the `msgText` element dynamically based on a JS variable.
Here's the standard way of achieving the same result with less and cleaner code:
```
  document.l10n.setAttributes(
    msgText,
    "many-public-recipients-info",
    { count: publicAddressPillsCount }
  );
```

Notably, that will even work when `msgText` element has been created, but not yet appended to the document.
(In reply to Thomas D. (:thomas8) from comment #0)
> - Also our Fluent isn't quite fluent yet (see comment 3).

https://searchfox.org/comm-central/rev/014b72575f40cf1d2e0cc1d997d8e4bebbd118f9/mail/components/compose/content/MsgComposeCommands.js#5147-5151
```
  msgText.setAttribute("data-l10n-id", "many-public-recipients-info");
  msgText.setAttribute(
    "data-l10n-args",
    JSON.stringify({ count: publicAddressPillsCount })
  );
```
**When you need to use JSON.stringify, there's something wrong...**
We're trying to localize the `msgText` element dynamically based on a JS variable.
Here's the standard way of achieving the same result with less and cleaner code:
```
  document.l10n.setAttributes(
    msgText,
    "many-public-recipients-info",
    { count: publicAddressPillsCount }
  );
```

Notably, that will even work when `msgText` element has been created, but not yet appended to the document.
(In reply to Thomas D. (:thomas8) from comment #0)
> - Also our Fluent isn't quite fluent yet (see comment 3).

https://searchfox.org/comm-central/rev/014b72575f40cf1d2e0cc1d997d8e4bebbd118f9/mail/components/compose/content/MsgComposeCommands.js#5147-5151
```
  msgText.setAttribute("data-l10n-id", "many-public-recipients-info");
  msgText.setAttribute(
    "data-l10n-args",
    JSON.stringify({ count: publicAddressPillsCount })
  );
```
**When you need to use JSON.stringify, there's something wrong...**
We're trying to localize the `msgText` element dynamically, based on a JS variable.
Here's the standard way of achieving the same result with less and cleaner code:
```
  document.l10n.setAttributes(
    msgText,
    "many-public-recipients-info",
    { count: publicAddressPillsCount }
  );
```

Notably, that will even work when `msgText` element has been created, but not yet appended to the document.

Back to Bug 1717085 Comment 3