mirror of
https://github.com/zen-browser/pdf.js.git
synced 2025-07-10 02:05:37 +02:00
[L10n] Don't try to connect the root element when it has already been done
In Firefox debug builds, there is an assertion to check that we don't connect a subelement of an already connected root. Thanks to this assertion, we can see that the root has already been added to Fluent, hence we don't need to do it a second time. We don't need to await anymore on the translation in order to update the toolbar: it'll be done by Fluent, so we can safely remove the "localized" event and avoid to wait for it.
This commit is contained in:
parent
c60401a765
commit
a0b9c937ae
2 changed files with 6 additions and 19 deletions
14
web/app.js
14
web/app.js
|
@ -272,14 +272,6 @@ const PDFViewerApplication = {
|
|||
this.bindEvents();
|
||||
this.bindWindowEvents();
|
||||
|
||||
// We can start UI localization now.
|
||||
const appContainer = appConfig.appContainer || document.documentElement;
|
||||
this.l10n.translate(appContainer).then(() => {
|
||||
// Dispatch the 'localized' event on the `eventBus` once the viewer
|
||||
// has been fully initialized and translated.
|
||||
this.eventBus.dispatch("localized", { source: this });
|
||||
});
|
||||
|
||||
this._initializedCapability.resolve();
|
||||
},
|
||||
|
||||
|
@ -375,6 +367,12 @@ const PDFViewerApplication = {
|
|||
: null
|
||||
);
|
||||
document.getElementsByTagName("html")[0].dir = this.l10n.getDirection();
|
||||
if (typeof PDFJSDev === "undefined" || !PDFJSDev.test("MOZCENTRAL")) {
|
||||
const appContainer =
|
||||
this.appConfig.appContainer || document.documentElement;
|
||||
// Connect Fluent and translate what we already have.
|
||||
this.l10n.translate(appContainer);
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue