first prototype of i18n system

This commit is contained in:
thislight 2024-09-26 17:23:40 +08:00
parent d3a7602fb5
commit b4fa751345
No known key found for this signature in database
GPG key ID: A50F9451AC56A63E
9 changed files with 348 additions and 20 deletions

View file

@ -36,6 +36,7 @@ import Button from "../material/Button.js";
import MediaAttachmentGrid from "./MediaAttachmentGrid.js";
import { FastAverageColor } from "fast-average-color";
import Color from "colorjs.io";
import { useDateFnLocale } from "../platform/i18n";
type TootContentViewProps = {
source?: string;
@ -170,6 +171,7 @@ function TootActionGroup<T extends mastodon.v1.Status>(
function TootAuthorGroup(props: { status: mastodon.v1.Status; now: Date }) {
const toot = () => props.status;
const dateFnLocale = useDateFnLocale()
return (
<div class={tootStyle.tootAuthorGrp}>
@ -187,7 +189,7 @@ function TootAuthorGroup(props: { status: mastodon.v1.Status; now: Date }) {
}}
/>
<time datetime={toot().createdAt}>
{formatRelative(toot().createdAt, props.now)}
{formatRelative(toot().createdAt, props.now, {locale: dateFnLocale()})}
</time>
<span>
@{toot().account.username}@{new URL(toot().account.url).hostname}