Open Bug 1824794 Opened 2 years ago Updated 2 years ago

Remove fluent async l10n hacks from browser/components/preferences dialogs

Categories

(Firefox :: Settings UI, task, P3)

Desktop
All
task

Tracking

()

Tracking Status
firefox113 --- affected

People

(Reporter: Gijs, Unassigned)

References

(Blocks 1 open bug)

Details

This is:

	browser/components/preferences/dialogs/applicationManager.js
71	await document.l10n.translateElements([
	browser/components/preferences/dialogs/clearSiteData.js
48	await document.l10n.translateElements([
	browser/components/preferences/dialogs/permissions.js
108	await document.l10n.translateElements([
	browser/components/preferences/dialogs/sitePermissions.js
190	await document.l10n.translateElements([

AFAIK we can scrap most of this.

Instead, just assign the l10n ID, and make sure that all the relevant init methods run off DOMContentLoaded (not onload).

clearSiteData.js unfortunately can't be much simpler than it is today, but IMO would still benefit from having the initialization moved to an init that runs on DOMContentLoaded, and using a separate async function to fetch the quota size etc. and then translate that. The return value of calling that separate function (ie a promise) can then be assigned into mozSubdialogReady.

applicationManager.js can also stop doing special things, except for the (apparently untested 🙃) case where typeDescription.id exists and we need to do a fluent pass to get typeStr at all. We could either (a) use a separate function for that case that gets assigned into mozSubdialogReady again, or (b) create a separate l10n object that supports sync querying and get that one object sync. That should be fast because all the l10n bits should already exist because of the calling page being the prefs which has already loaded all this information anyway (and arguably should be passing it in - that'd be another way of resolving this).

permissions.js is straightforward and can just have a bunch of async stuff removed.

In sitePermissions.js this will mean also cleaning up buildAutoplayMenulist() which also doesn't need to be async - but that's just more cleanup, nothing complicated.

Component: General → Settings UI
Summary: Remove fluent async l10n hacks from browser/components/preferences → Remove fluent async l10n hacks from browser/components/preferences dialogs
Severity: -- → S4
Priority: -- → P3
You need to log in before you can comment on or make changes to this bug.