Closed Bug 1793557 Opened 2 years ago Closed 1 years ago

Migrate extension permission strings from .properties to Fluent

Categories

(WebExtensions :: Frontend, task, P2)

task

Tracking

(firefox115 fixed)

RESOLVED FIXED
115 Branch
Tracking Status
firefox115 --- fixed

People

(Reporter: eemeli, Assigned: eemeli)

References

(Blocks 2 open bugs)

Details

Attachments

(3 files, 1 obsolete file)

Some of these messages currently use the legacy PluralForm API, which we'd like to drop.

The permission string formatting in Extension.jsm currently requires passing in a separately constructed StringBundle as an argument, so some API changes will be required.

Some of the tests for the extension strings are parameterised to work differently in Thunderbird, so will probably need a corresponding update there to work.

This changes the arguments of ExtensionData.formatPermissionStrings(). The second bundle arg is dropped, and a localization option is added. Call sites in m-c are updated, but this will also need a matching update for Thunderbird. A few Thunderbird test cases will also need to be updated, as they currently point to a non-existing localization file path "messenger/addons.ftl".

Severity: -- → N/A
Priority: -- → P2

As discussed at the addon workweek, this patch renames the Fluent l10n keys used for extension permissions to match the pattern:

webext-perms-description-{name}

where {name} is the permission's unmangled name. The intent is to reduce the work required in adding more permissions later, as their name -> l10n id mapping does not need to be updated. A fluent-lint exception is added for these generated names. Permissions with names that are not valid as Fluent keys and message updates (and key renames) are supported via a PERMISSION_L10N_IDS map.

Because Fluent localization keys are not enumerable and attempting to format a missing key is an error, this has a knock-on effect of needing to make ExtensionData.formatPermissionStrings() async, as it now relies on the async lazy.NO_PROMPT_PERMISSIONS value to skip some of the permissions. Accordingly, the l10n formatting calls are all made async, along with all callers of formatPermissionStrings().

Depends on D158663

Attachment #9332159 - Attachment is obsolete: true

The l10n migration shows a diff for addon-downloading-and-verifying and addon-confirm-install-message
due to the en-US source having 1 rather than one variants.
For addon-confirm-install-some-unsigned-message,
the en-US source has a single-variant plural selector for localization to new languages.

In addition to moving strings from browser.properties to the new addonNotifications.ftl,
there's some shuffling of strings to & from browser.ftl as well.
The intent is to collect the more rarely used strings out of files loaded during startup,
especially as many of the notification strings need to be formatted in a sync context.

For the most part, string keys are left roughly the same as they were in .properties.
With some guidance, some rationalisation might make sense as a part of this for the
rather wide selection of prefixes in this set:

  • addon-
  • site-permission-install-
  • webext-
  • xpinstall-

The addon-install-started and addon-install-failed notifications appear to need sync l10n formatting,
as using async format calls before their PopupNotifications.show() leads to test failures in
toolkit/mozapps/extensions/test/xpinstall/browser_doorhanger_installs.js.

Depends on D178107

Attachment #9334199 - Attachment description: Bug 1793557 - Migrate addon notification strings to Fluent. r=#extension-reviewers! → Bug 1793557 - Migrate add-on notification strings to Fluent. r=#extension-reviewers!

As mentioned in D178235, some of the add-on/webextension strings could be re-titled as a part of this change.

Rob, is this something that might be of interest?

Status: NEW → ASSIGNED
Flags: needinfo?(rob)
Blocks: 1834305
Blocks: 1834484
Pushed by earo@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/50f952ef9d20 Convert Extension.jsm strings to Fluent. r=mkmelin,geckoview-reviewers,robwu,flod,owlish https://hg.mozilla.org/integration/autoland/rev/c900208b3eaf Migrate add-on notification strings to Fluent. r=extension-reviewers,flod,robwu https://hg.mozilla.org/integration/autoland/rev/29a4c4bcd51d Convert ExtensionsUI.jsm strings to Fluent. r=extension-reviewers,fluent-reviewers,flod,robwu

(In reply to Eemeli Aro [:eemeli] from comment #5)

As mentioned in D178235, some of the add-on/webextension strings could be re-titled as a part of this change.

Rob, is this something that might be of interest?

Yes this is something that we'd be interested in, that can be done in a follow-up.

Flags: needinfo?(rob)
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: