diff --git a/src/i18n/engine.ts b/src/i18n/engine.ts index 3321f28..19ba847 100644 --- a/src/i18n/engine.ts +++ b/src/i18n/engine.ts @@ -72,6 +72,18 @@ export function applyTranslations(language: string) { } } + if (Intl.ListFormat) { + const formatter = new Intl.ListFormat(language, { + style: "short", + type: "conjunction", + }); + + for (const node of document.querySelectorAll("[data-enumerate]")) { + const dataset = (node as HTMLElement).dataset; + node.innerHTML = formatter.format(dataset.enumerate!.split(",")); + } + } + document.documentElement.lang = language; document.documentElement.dir = languages[language as keyof typeof languages].dir; diff --git a/src/layouts/layout.astro b/src/layouts/layout.astro index 34e64ca..e79f581 100644 --- a/src/layouts/layout.astro +++ b/src/layouts/layout.astro @@ -107,12 +107,16 @@ import package_ from "../../package.json";
Supported projects: