Add static checking to i18n and improve types
This commit is contained in:
parent
f8ac450ab5
commit
579e5879e1
16 changed files with 126 additions and 82 deletions
|
|
@ -1,7 +1,7 @@
|
|||
---
|
||||
import { type CollectionEntry, getEntry } from "astro:content";
|
||||
import { t } from "../i18n";
|
||||
import { type Lang } from "../content/config";
|
||||
import { getUsernameForLang } from "../utils/get_username_for_lang";
|
||||
|
||||
type Props = {
|
||||
lang: Lang;
|
||||
|
|
@ -12,7 +12,7 @@ let { user, lang } = Astro.props;
|
|||
if (user.data.isAnonymous) {
|
||||
user = await getEntry("users", "anonymous");
|
||||
}
|
||||
const username = t(lang, user.data.nameLang as any) || user.data.name;
|
||||
const username = getUsernameForLang(user, lang);
|
||||
let link: string | null = null;
|
||||
if (user.data.preferredLink) {
|
||||
const preferredLink = user.data.links[user.data.preferredLink] as string | [string, string];
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue