diff --git a/src/timelines/toots/TootContent.tsx b/src/timelines/toots/TootContent.tsx index f81478b..7a2286d 100644 --- a/src/timelines/toots/TootContent.tsx +++ b/src/timelines/toots/TootContent.tsx @@ -11,6 +11,7 @@ import { resolveCustomEmoji } from "../../masto/toot.js"; import { makeAcctText, useDefaultSession } from "../../masto/clients.js"; import "./TootContent.css"; import { Button } from "@suid/material"; +import { createTranslator } from "../../platform/i18n.jsx"; function preventDefault(event: Event) { event.preventDefault(); @@ -27,6 +28,15 @@ export type TootContentProps = JSX.HTMLAttributes & { }; const TootContent: Component = (oprops) => { + const [t] = createTranslator( + (code) => + import(`./i18n/${code}.json`) as Promise<{ + default: { + cw: string; + }; + }>, + ); + const session = useDefaultSession(); const [props, rest] = splitProps(oprops, [ "source", @@ -81,7 +91,7 @@ const TootContent: Component = (oprops) => { }); }} > - + diff --git a/src/timelines/toots/i18n/en.json b/src/timelines/toots/i18n/en.json new file mode 100644 index 0000000..3d75ddd --- /dev/null +++ b/src/timelines/toots/i18n/en.json @@ -0,0 +1,3 @@ +{ + "cw": "\"Content Warning\"" +} \ No newline at end of file diff --git a/src/timelines/toots/i18n/zh-Hans.json b/src/timelines/toots/i18n/zh-Hans.json new file mode 100644 index 0000000..0e64a62 --- /dev/null +++ b/src/timelines/toots/i18n/zh-Hans.json @@ -0,0 +1,3 @@ +{ + "cw": "“内容警告”" +} \ No newline at end of file