Add i18n module and fix missing CopyrightedCharacters

This commit is contained in:
Bad Manners 2024-03-29 22:48:36 -03:00
parent 7ca6f52cc2
commit 4f83ae8802
11 changed files with 270 additions and 196 deletions

View file

@ -1,7 +1,7 @@
---
import { type CollectionEntry } from "astro:content";
import { type CollectionEntry, getEntry } from "astro:content";
import { t } from "../i18n";
import { type Lang } from "../content/config";
import { getEntry } from "astro:content";
type Props = {
lang: Lang;
@ -12,7 +12,7 @@ let { user, lang } = Astro.props;
if (user.data.isAnonymous) {
user = await getEntry("users", "anonymous");
}
const username = user.data.nameLang[lang] || user.data.name;
const username = t(lang, user.data.nameLang as any) || user.data.name;
let link: string | null = null;
if (user.data.preferredLink) {
if (user.data.preferredLink in user.data.links) {