Skip to content

Commit 7e0a012

Browse files
committed
i18n: Translate blog titles and read more links
1 parent 9bff362 commit 7e0a012

7 files changed

+30
-8
lines changed

blog_posts/2023-03-12-progress-report.markdown

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
title: "First post, progress report!"
2+
title: "blog.20230312.title"
33
date: 2023-03-12 01:23:00 +0100
44
author: nosamu
55
icon: /undraw/undraw_welcoming_re_x0qo.svg

blog_posts/2023-04-23-mozilla-extension-postmortem.markdown

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
title: "A post-mortem of Ruffle's removal from addons.mozilla.org"
2+
title: "blog.20230423.title"
33
date: 2023-04-23 04:07:00 -0400
44
author: kmeisthax
55
icon: /undraw/undraw_feeling_blue_-4-b7q.svg

blog_posts/2023-05-29-progress-report.markdown

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
title: "Ruffle News - May 2023"
2+
title: "blog.20230529.title"
33
date: 2023-05-09 00:00:01 +00:00
44
author: nosamu
55
icon: /undraw/undraw_percentages_re_a1ao.svg

blog_posts/2024-01-14-2023-in-review.markdown

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
title: "2023 in review"
2+
title: "blog.20240114.title"
33
date: 2024-01-14 08:28:00 +0100
44
author: Dinnerbone
55
icon: /undraw/undraw_new_year_2023_pfnc.svg

blog_posts/2024-09-12-optimisations-text-more.markdown

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
title: "Optimisations, Text Input, Tab Focusing and More!"
2+
title: "blog.20240912.title"
33
date: 2024-09-12 21:02:00 +0100
44
author: Dinnerbone
55
icon: /undraw/undraw_setup_analytics_re_foim.svg

src/app/blog/post.tsx

+7-3
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
"use client";
2+
13
import { PostMetadata } from "@/app/blog/utils";
24
import { Group, Stack, Text, Title } from "@mantine/core";
35
import classes from "@/app/blog/post.module.css";
@@ -6,6 +8,7 @@ import Markdown from "react-markdown";
68
import Image from "next/image";
79
import rehypeRaw from "rehype-raw";
810
import rehypeSlug from "rehype-slug";
11+
import { useTranslation } from "@/app/translate";
912

1013
export interface BlogPostProps {
1114
metadata: PostMetadata;
@@ -28,14 +31,15 @@ export function BlogPostAndIcon({ metadata, type }: BlogPostProps) {
2831
}
2932

3033
export function BlogPost({ metadata, type }: BlogPostProps) {
34+
const { t } = useTranslation();
3135
const url = `/blog/${metadata.year}/${metadata.month}/${metadata.day}/${metadata.slug}`;
3236
return (
3337
<Stack gap={0} className={classes.postInfo}>
3438
{type == "full" ? (
35-
<Title className={classes.title}>{metadata.title}</Title>
39+
<Title className={classes.title}>{t(metadata.title)}</Title>
3640
) : (
3741
<Link href={url} className={classes.title}>
38-
{metadata.title}
42+
{t(metadata.title)}
3943
</Link>
4044
)}
4145
<Group wrap="nowrap" gap="xs" className={classes.info}>
@@ -68,7 +72,7 @@ export function BlogPost({ metadata, type }: BlogPostProps) {
6872
</div>
6973
{type == "excerpt" && (
7074
<Text className={classes.readMore}>
71-
<Link href={url}>Read More...</Link>
75+
<Link href={url}>{t("blog.read-more")}</Link>
7276
</Text>
7377
)}
7478
</Stack>

src/i18n/translations.en.json

+18
Original file line numberDiff line numberDiff line change
@@ -142,5 +142,23 @@
142142
"spread-the-word-description": "Is your favourite Flash-based site shutting down? Let them know they can add one JavaScript file and keep it running! Feeling nostalgic for some old Flash games? Go play some on Newgrounds with Ruffle installed, and tell your friends about it! Maybe you're a streamer and looking for some silly content? There's literally decades worth, now unlocked and accessible once more.",
143143
"diamond": "Diamond Sponsors",
144144
"diamond-description": "We'd like to thank all of our sponsors, who help make this project possible. Below are our Diamond level sponsors, without whom we would not be here. Thank you."
145+
},
146+
"blog": {
147+
"read-more": "Read more...",
148+
"20230312": {
149+
"title": "First post, progress report!"
150+
},
151+
"20230423": {
152+
"title": "A post-mortem of Ruffle's removal from addons.mozilla.org"
153+
},
154+
"20230529": {
155+
"title": "Ruffle News - May 2023"
156+
},
157+
"20240114": {
158+
"title": "2023 in review"
159+
},
160+
"20240912": {
161+
"title": "Optimisations, Text Input, Tab Focusing and More!"
162+
}
145163
}
146164
}

0 commit comments

Comments
 (0)