Background
PRs #369 and #378 fixed user-visible bugs where the suggestion form / sidebar rendered literal `{{changeFrom}}` placeholders. The fix in both cases was to split the original sentence
Suggested change from "{{changeFrom}}" to "{{changeTo}}"
into three pieces — a `_from_label` key ("Suggested change from"), the value span, a `_to_label` key ("to"), and the second value span — because html10n's `data-l10n-args` substitution wasn't reliably replacing `{{…}}` placeholders.
Why this is suboptimal
Splitting the sentence costs translator flexibility. Languages with verb-final word order, RTL flow, or different "from … to …" idioms can no longer reorder the values relative to the surrounding text — the DOM order is fixed.
Root cause to investigate
`vendors/html10n.ts` line ~631 does `JSON.parse(node.getAttribute('data-l10n-args'))` with no try/catch. If the selected text contains a quote or backslash, jquery.tmpl's `${changeFrom}` substitution produces invalid JSON and the parse throws — html10n then renders the unsubstituted `{{changeFrom}}` (or fails silently depending on the call site).
Suggested fix
- Wrap the `JSON.parse` in a try/catch with a console.warn fallback so a single broken element doesn't break the whole element list.
- Build `data-l10n-args` from JS rather than from the template (e.g. `$el.attr('data-l10n-args', JSON.stringify({changeFrom: selectedText}))` after tmpl render) so the values are always valid JSON-encoded strings.
- Once that's reliable, reunify the split keys back into the original single-string translations and delete the `_from_label` / `_to_label` workaround keys.
Scope
- `templates/comments.html` — display-suggestion + new-comment-form blocks
- `static/js/index.js`, `static/js/newComment.js`, `static/js/index.js#displayNewCommentForm` — set data-l10n-args at runtime
- `locales/en.json` — restore single-string keys, deprecate split keys
- Coordinate with translatewiki sweep so existing translations of the original `suggested_change_from` / `suggest_change_from` keys are reused
Background
PRs #369 and #378 fixed user-visible bugs where the suggestion form / sidebar rendered literal `{{changeFrom}}` placeholders. The fix in both cases was to split the original sentence
into three pieces — a `_from_label` key ("Suggested change from"), the value span, a `_to_label` key ("to"), and the second value span — because html10n's `data-l10n-args` substitution wasn't reliably replacing `{{…}}` placeholders.
Why this is suboptimal
Splitting the sentence costs translator flexibility. Languages with verb-final word order, RTL flow, or different "from … to …" idioms can no longer reorder the values relative to the surrounding text — the DOM order is fixed.
Root cause to investigate
`vendors/html10n.ts` line ~631 does `JSON.parse(node.getAttribute('data-l10n-args'))` with no try/catch. If the selected text contains a quote or backslash, jquery.tmpl's `${changeFrom}` substitution produces invalid JSON and the parse throws — html10n then renders the unsubstituted `{{changeFrom}}` (or fails silently depending on the call site).
Suggested fix
Scope