Closed Bug 1716664 Opened 4 months ago Closed 4 months ago

[fluent-dom] Skip applying async translation if `data-l10n-id` was removed before application

Categories

(Core :: Internationalization: Localization, enhancement)

enhancement

Tracking

()

RESOLVED FIXED
91 Branch
Tracking Status
firefox91 --- fixed

People

(Reporter: zbraniecki, Assigned: zbraniecki)

References

Details

Attachments

(1 file)

While working on bug 1613705 we identified additional case where we can short-circuit through applying translation if the l10n-id annotation is removed before the l10n frame completes.

An example:

  1. code sets data-l10n-id triggering L10nMutation
  2. At animation frame, we coalesce all pending translations
  3. TranslateElements is fired asynchronously for translations of elements scheduled in (1)
  4. While the async I/O is being executed, code removes the data-l10n-id
  5. ApplyTranslations is executed on all elements

Between (2) and (3) we remove from the list elements if data-l10n-id was removed immediately - https://searchfox.org/mozilla-central/rev/d97dca5907e2a0a77a2435b24ef980268cd3c4fe/dom/l10n/L10nMutations.cpp#137-139

but if FlushPendingTranslations has been called and the removal of the attribute happens between that and ApplyTranslations we will apply the translation.

We can use the same if/continue in ApplyTranslations to improve that.

Assignee: nobody → zbraniecki
Status: NEW → ASSIGNED
Attachment #9227292 - Attachment description: WIP: Bug 1716664 - Skip applying translations on elements that had their data-l10n-id removed. → Bug 1716664 - Skip applying translations on elements that had their data-l10n-id removed.
Pushed by zbraniecki@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/da56143c727a
Skip applying translations on elements that had their data-l10n-id removed. r=platform-i18n-reviewers,dminor
Blocks: 1613705
Status: ASSIGNED → RESOLVED
Closed: 4 months ago
Resolution: --- → FIXED
Target Milestone: --- → 91 Branch
You need to log in before you can comment on or make changes to this bug.