Closed Bug 1729738 Opened 3 years ago Closed 3 years ago

Migrate usages of extension.(.*)@mozilla.org.* from properties to Fluent

Categories

(Toolkit :: Form Autofill, task, P3)

task
Points:
1

Tracking

()

RESOLVED FIXED
94 Branch
Tracking Status
firefox94 --- fixed

People

(Reporter: nordzilla, Assigned: kpatenio)

References

Details

(Whiteboard: [fidefe-theme])

Attachments

(1 file)

As part of the M2 milestone for arewefluentyet, there are many usages of properties that should be moved to Fluent.

There are many that are of the following form:

extension.doh-rollout@mozilla.org.description
extension.doh-rollout@mozilla.org.name
extension.doh-rollout@mozilla.org.name
extension.formautofill@mozilla.org.description
extension.formautofill@mozilla.org.name
extension.pictureinpicture@mozilla.org.description
extension.pictureinpicture@mozilla.org.name
extension.screenshots@mozilla.org.description
extension.screenshots@mozilla.org.name
extension.webcompat-reporter@mozilla.org.description
extension.webcompat-reporter@mozilla.org.name
extension.webcompat@mozilla.org.description
extension.webcompat@mozilla.org.name

Many of these are generated [here] as an attempt hopefully match on a string and localize something, though many of these strings do not exist.

We should look at the actual sources of the LOCALE_BUNDLES for this file [here]:

And move those properties to fluent to use them explicitly.

The Bugbug bot thinks this bug should belong to the 'Toolkit::Form Autofill' component, and is moving the bug to that component. Please revert this change in case you think the bot is wrong.

Component: General → Form Autofill
Product: Firefox → Toolkit

And move those properties to fluent to use them explicitly.

In particular, we should not request localization of IDs we don't have, because it triggers deep fallback in Fluent.

So the code should look like this:

const LOCALIZED_EXTENSION_NAMES = [
  "default-theme",
  "firefox-compact-light",
  "firefox-compact-dark",
  "firefox-alpenglow",
];

function chooseValue(aAddon, aObj, aProp) {
  let repositoryAddon = aAddon._repositoryAddon;
  let objValue = aObj[aProp];

  // ...

  if (!aAddon.id in LOCALIZED_EXTENSION_NAMES) {
    return [objValue, false];
  }

  let l10nId = `extension-meta-${aAddon.id}`;
  let msg = l10n.formatMessagesSync([{id: l10nId}]); // XXX: can we do async here?
  
  if (aProp == "title") {
    return [msg.title, false];
  } else if (aProp == "description") {
    return [msg.description, false];
  } else {
    throw new Exception("This should never happen");
  }
}

And l10n is probably a custom const l10n = new Localization(); here if I'm not mistaken.

Assignee: nobody → kpatenio
Status: NEW → ASSIGNED
Blocks: 1731652
Whiteboard: [fidefe-theme]
Blocks: 1722078
Points: --- → 1
Depends on: 1732797
Blocks: 1733210
Pushed by mtigley@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/4a72ff9328e5
Migrate extension.(.*)@mozilla.org.* from properties to Fluent. r=mtigley,fluent-reviewers,robwu,flod
See Also: → 1733280
Status: ASSIGNED → RESOLVED
Closed: 3 years ago
Resolution: --- → FIXED
Target Milestone: --- → 94 Branch
See Also: → 1733466

This change introduced a dependency of toolkit/mozapps/extensions/internal/XPIDatabase.jsm on browser/locales/en-US/browser/appExtensionFields.ftl which causes issues on non-Firefox products.

I'm not sure what the best way to deal with that is, but the extension-default-theme-* strings should move back under toolkit.

:fabrice - :robwu is looking for a better solution in bug 1733466.

(In reply to Zibi Braniecki [:zbraniecki][:gandalf] from comment #8)

:fabrice - :robwu is looking for a better solution in bug 1733466.

thanks!

You need to log in before you can comment on or make changes to this bug.