Format list of supported projects with Intl
This commit is contained in:
parent
166d4fcc44
commit
a37470bf9c
2 changed files with 20 additions and 4 deletions
|
@ -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.lang = language;
|
||||||
document.documentElement.dir =
|
document.documentElement.dir =
|
||||||
languages[language as keyof typeof languages].dir;
|
languages[language as keyof typeof languages].dir;
|
||||||
|
|
|
@ -107,12 +107,16 @@ import package_ from "../../package.json";
|
||||||
<p><b data-translate="supportedProjects">Supported projects:</b></p>
|
<p><b data-translate="supportedProjects">Supported projects:</b></p>
|
||||||
<ul>
|
<ul>
|
||||||
<li>
|
<li>
|
||||||
Mastodon (<span data-translate="incl">incl.</span> Hometown, Fedibird,
|
Mastodon (<span data-translate="incl">incl.</span> <span
|
||||||
GlitchCafé)
|
data-enumerate="Hometown,Fedibird,GlitchCafé"
|
||||||
|
>Hometown, Fedibird, GlitchCafé</span
|
||||||
|
>)
|
||||||
</li>
|
</li>
|
||||||
<li>
|
<li>
|
||||||
Misskey (<span data-translate="incl">incl.</span> Firefish/Calckey,
|
Misskey (<span data-translate="incl">incl.</span> <span
|
||||||
FoundKey, Meisskey)
|
data-enumerate="Firefish,Calckey,FoundKey,Meisskey"
|
||||||
|
>Firefish, Calckey, FoundKey, Meisskey</span
|
||||||
|
>)
|
||||||
</li>
|
</li>
|
||||||
<li>Friendica</li>
|
<li>Friendica</li>
|
||||||
<li>Hubzilla</li>
|
<li>Hubzilla</li>
|
||||||
|
|
Reference in a new issue