Skip to content

Commit

Permalink
Merge pull request #19481 from Snuffleupagus/GenericL10n-fetch-bundle…
Browse files Browse the repository at this point in the history
…s-parallel

[GenericL10n] Fetch the language bundles in parallel to reduce load time
  • Loading branch information
Snuffleupagus authored Feb 14, 2025
2 parents c81a404 + 8d8e25c commit 6ad5613
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions web/genericl10n.js
Original file line number Diff line number Diff line change
Expand Up @@ -89,8 +89,14 @@ class GenericL10n extends L10n {
}
langs.push(defaultLang);
}
for (const lang of langs) {
const bundle = await this.#createBundle(lang, baseURL, paths);
// Trigger fetching of bundles in parallel, to reduce overall load time.
const bundles = langs.map(lang => [
lang,
this.#createBundle(lang, baseURL, paths),
]);

for (const [lang, bundlePromise] of bundles) {
const bundle = await bundlePromise;
if (bundle) {
yield bundle;
} else if (lang === "en-us") {
Expand Down

0 comments on commit 6ad5613

Please sign in to comment.