Closed Bug 1830425 Opened 2 years ago Closed 2 years ago

Cache detected langTags

Categories

(Firefox :: Translations, enhancement)

enhancement

Tracking

()

RESOLVED FIXED
114 Branch
Tracking Status
firefox114 --- fixed

People

(Reporter: nordzilla, Assigned: nordzilla)

References

Details

Attachments

(1 file)

When doing in-page translations, we end up calling getLangTagsForTranslation() twice.

Once to determine if the translations icon should appear on the page, and once again to populate the dropdown menus in the translations panel:

https://searchfox.org/mozilla-central/rev/566f69826b829767d0373169eef6c50cc7d2241b/browser/components/translations/content/translationsPanel.js#234

Computing this value is very fast when we are able to pull the langTag from the document's markup, but there is a delay on websites which need to utilize the language identification engine to detect the language. The behavior when using the language identification engine is such that the panel opens with blank dropdowns, and then they populate after a noticeable delay.

We already have a data member for #langTags but it is not being set when we call the getLangTagsForTranslation() function.

We should update this function to cache the tags upon first retrieval so that there is no delay in populating the language dropdowns when using the language identification engine.

Caches the detected langTags to ensure that the language
identification engine does not need to run twice when
populating the languag dropdowns in the translations panel.

Pushed by enordin@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/cccc747d88b1 Cache detected langTags for translations r=gregtatum
Status: NEW → RESOLVED
Closed: 2 years ago
Resolution: --- → FIXED
Target Milestone: --- → 114 Branch
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: