diff --git a/en/index.html b/en/index.html index 317a75d..26cd7aa 100644 --- a/en/index.html +++ b/en/index.html @@ -197,7 +197,7 @@ -FR +FR diff --git a/en/results.html b/en/results.html index a25fbc3..b53e93f 100644 --- a/en/results.html +++ b/en/results.html @@ -80,7 +80,7 @@ -FR +FR diff --git a/index.html b/index.html index 33b3ef1..c712232 100644 --- a/index.html +++ b/index.html @@ -210,7 +210,7 @@ -EN +EN diff --git a/results.html b/results.html index 5023c67..2585fd3 100644 --- a/results.html +++ b/results.html @@ -93,7 +93,7 @@ -EN +EN diff --git a/scripts/check-seo.mjs b/scripts/check-seo.mjs index 1eb3033..b07205c 100644 --- a/scripts/check-seo.mjs +++ b/scripts/check-seo.mjs @@ -413,7 +413,7 @@ async function lot1(browser) { const { page } = await openTracked(jsCtx, from + hash); const link = await page.evaluate(() => { const a = document.getElementById("langToggle"); - return a ? { tag: a.tagName, hreflang: a.getAttribute("hreflang"), lang: a.getAttribute("lang"), href: a.getAttribute("href") } : null; + return a ? { tag: a.tagName, hreflang: a.getAttribute("hreflang"), lang: a.getAttribute("lang"), href: a.getAttribute("href"), label: a.getAttribute("aria-label") } : null; }); let arrived = ""; if (link && link.tag === "A") { @@ -423,7 +423,9 @@ async function lot1(browser) { } await page.close(); const other = from.startsWith("/en/") ? "fr" : "en"; - check(1, "1.7", `lien de langue ${from + hash} → ${to} ()`, link && link.tag === "A" && link.hreflang === other && link.lang === other && arrived === to, link ? `<${link.tag.toLowerCase()} href="${link.href}" hreflang=${link.hreflang} lang=${link.lang}> → ${arrived}` : "pas de #langToggle"); + // Libellé accessible dans la langue de la cible (nav.langToggleLabel). + const label = other === "en" ? "Switch to English" : "Passer en français"; + check(1, "1.7", `lien de langue ${from + hash} → ${to} ()`, link && link.tag === "A" && link.hreflang === other && link.lang === other && link.label === label && arrived === to, link ? `<${link.tag.toLowerCase()} href="${link.href}" hreflang=${link.hreflang} lang=${link.lang} aria-label="${link.label}"> → ${arrived}` : "pas de #langToggle"); } // Critère 8 — liens internes dans la langue de la page (rendu avec JS). diff --git a/scripts/generate-static.js b/scripts/generate-static.js index 3a60c31..68be437 100644 --- a/scripts/generate-static.js +++ b/scripts/generate-static.js @@ -244,6 +244,7 @@ function langLinksHtml(page, lang) { // langue de sa cible (hreflang, lang). Le libellé accessible vient d'i18n.js. function langToggleHtml(page, lang, dict) { const other = lang === "fr" ? "en" : "fr"; + if (!dict["nav.langToggleLabel"]) throw new Error(`${page.out[lang]} : libellé nav.langToggleLabel introuvable dans i18n.js`); const href = new URL(page.urls[other]).pathname; return `${other.toUpperCase()}`; } @@ -380,7 +381,8 @@ function englishShell(frHtml, file) { for (const page of PAGES) { const template = fs.readFileSync(path.join(ROOT, page.template), "utf8"); - const keys = i18nKeys(template); + // + le libellé du lien FR/EN, que le gabarit ne cite pas (zone calculée). + const keys = [...i18nKeys(template), "nav.langToggleLabel"]; const fr = await renderPage(browser, page, "fr", { slug: slugs[0], keys }); const frOut = applyRender(template, page, "fr", fr);