Closed Bug 1550021 Opened 5 years ago Closed 5 years ago

l10n breaks when adding an ftl to DevTool's toolbox.xul

Categories

(DevTools :: Framework, defect, P2)

defect

Tracking

(Not tracked)

RESOLVED WONTFIX

People

(Reporter: miker, Assigned: miker)

References

Details

Attachments

(1 obsolete file)

STR

  • Run ./mach mochitest devtools/client/framework/test/browser_menu_api.js

Note that the test completes successfully.

  • Apply the attached patch.
  • Run ./mach mochitest devtools/client/framework/test/browser_menu_api.js

Now the test fails, reporting the following missing strings:

FAIL A promise chain failed to handle a rejection: [fluent] Missing translations in en-US: editmenu-undo.
FAIL A promise chain failed to handle a rejection: [fluent] Missing translations in en-US: editmenu-copy.

For the moment we can workaround this by manually loading the ftl at the start of the test:

/**
 * Lazily load strings for the edit menu.
 */
function loadEditMenuStrings(toolbox) {
  const win = toolbox.doc.ownerGlobal;

  if (win.MozXULElement) {
    win.MozXULElement.insertFTLIfNeeded("toolkit/main-window/editmenu.ftl");
  }
}

So maybe this is just a race condition?

Yeah, this is making the lazy localization non-lazy.

I guess there are two ways around this, either be at the same time of loadEditMenuStrings, or add both ftl files to the doc from the get-go.

Moving this over to Devtools, not sure if this is the right component.

Component: Fluent Migration → Framework
Product: Localization Infrastructure and Tools → DevTools

The obvious fix is to always load an FTL at the beginning of a test if we are going to be checking strings.

I will add this to our documentation.

Assignee: nobody → mratcliffe
Status: NEW → RESOLVED
Closed: 5 years ago
Resolution: --- → WONTFIX
Attachment #9063533 - Attachment is obsolete: true
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: