Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
async function* generateMessages(resourceIds) {
const locales = negotiateLanguages(
navigator.languages,
meta.available,
{
defaultLocale: meta.default,
},
);
for (const locale of locales) {
yield createContext(locale, resourceIds);
}
}
const resourceIds = getResourceLinks(document.head);
document.l10n = new DOMLocalization(
resourceIds, generateMessages,
);
window.addEventListener("languagechange", document.l10n);
document.l10n.ready = documentReady().then(() => {
document.l10n.connectRoot(document.documentElement);
return document.l10n.translateRoots();
});