Skip to content

Commit b66b63d

Browse files
committed
i18n: Translate installers, downloads, and 404 page
1 parent 65f9684 commit b66b63d

File tree

7 files changed

+150
-80
lines changed

7 files changed

+150
-80
lines changed

src/app/downloads/config.tsx

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -115,41 +115,41 @@ export interface DownloadLink {
115115
export const desktopLinks: DownloadLink[] = [
116116
{
117117
key: "windows_64",
118-
shortName: "Windows (64-bit)",
119-
longName: "Windows Executable",
118+
shortName: "installers.windows-64-short-name",
119+
longName: "installers.windows-long-name",
120120
icon: IconBrandWindows,
121121
isRecommended: true,
122122
isDeviceRelevant: (device) => device.desktop && device.windows,
123123
},
124124
{
125125
key: "windows_32",
126-
shortName: "Windows (32-bit)",
127-
longName: "Windows Executable",
126+
shortName: "installers.windows-32-short-name",
127+
longName: "installers.windows-long-name",
128128
icon: IconBrandWindows,
129129
isRecommended: false,
130130
isDeviceRelevant: () => false,
131131
},
132132
{
133133
key: "macos",
134-
shortName: "macOS",
135-
longName: "Mac Application",
134+
shortName: "installers.macos-short-name",
135+
longName: "installers.macos-long-name",
136136
icon: IconBrandApple,
137137
isRecommended: true,
138138
isDeviceRelevant: (device) => device.desktop && device.mac,
139139
},
140140
{
141141
key: "flatpak",
142-
shortName: "Flatpak",
143-
longName: "Flatpak App",
142+
shortName: "installers.flatpak-short-name",
143+
longName: "installers.flatpak-long-name",
144144
icon: IconBox,
145145
isRecommended: true,
146146
recommendedUrl: flathubUrl,
147147
isDeviceRelevant: (device) => device.linux,
148148
},
149149
{
150150
key: "linux",
151-
shortName: "Linux",
152-
longName: "Linux Executable",
151+
shortName: "installers.linux-short-name",
152+
longName: "installers.linux-long-name",
153153
icon: IconBrandLinux,
154154
isRecommended: true,
155155
isDeviceRelevant: (device) => device.desktop && device.linux,
@@ -159,8 +159,8 @@ export const desktopLinks: DownloadLink[] = [
159159
export const extensionLinks: DownloadLink[] = [
160160
{
161161
key: "chromium",
162-
shortName: "Chrome",
163-
longName: "Chrome Extension",
162+
shortName: "installers.chrome-short-name",
163+
longName: "installers.chrome-long-name",
164164
icon: IconBrandChrome,
165165
isDeviceRelevant: (device) => device.desktop && device.chrome,
166166
isRecommended: true,
@@ -169,8 +169,8 @@ export const extensionLinks: DownloadLink[] = [
169169
},
170170
{
171171
key: "chromium",
172-
shortName: "Edge",
173-
longName: "Edge Extension",
172+
shortName: "installers.edge-short-name",
173+
longName: "installers.edge-long-name",
174174
icon: IconBrandEdge,
175175
isDeviceRelevant: (device) => device.desktop && device.edge,
176176
isRecommended: true,
@@ -179,8 +179,8 @@ export const extensionLinks: DownloadLink[] = [
179179
},
180180
{
181181
key: "firefox",
182-
shortName: "Firefox",
183-
longName: "Firefox Extension",
182+
shortName: "installers.firefox-short-name",
183+
longName: "installers.firefox-long-name",
184184
icon: IconBrandFirefox,
185185
isDeviceRelevant: (device) =>
186186
(device.desktop || device.android) && device.firefox,
@@ -189,8 +189,8 @@ export const extensionLinks: DownloadLink[] = [
189189
},
190190
{
191191
key: "macos",
192-
shortName: "Safari",
193-
longName: "Safari Extension",
192+
shortName: "installers.safari-short-name",
193+
longName: "installers.safari-long-name",
194194
icon: IconBrandSafari,
195195
isRecommended: true,
196196
isDeviceRelevant: () => false,
@@ -200,8 +200,8 @@ export const extensionLinks: DownloadLink[] = [
200200
export const webLinks: DownloadLink[] = [
201201
{
202202
key: "web",
203-
shortName: "Self Hosted",
204-
longName: "Website Package",
203+
shortName: "installers.selfhosted-short-name",
204+
longName: "installers.selfhosted-long-name",
205205
icon: IconBrandJavascript,
206206
isRecommended: true,
207207
isDeviceRelevant: () => false,

src/app/downloads/extensions.tsx

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,11 @@
1+
"use client";
2+
13
import { Group, Stack, Text, Title } from "@mantine/core";
24
import classes from "./extensions.module.css";
35
import React from "react";
46
import Image from "next/image";
57
import Link from "next/link";
8+
import { useTranslation } from "@/app/translate";
69

710
interface Extension {
811
image: string;
@@ -14,26 +17,27 @@ const extensions: Extension[] = [
1417
{
1518
image: "/extension_badges/chrome.svg",
1619
url: "https://chromewebstore.google.com/detail/ruffle-flash-emulator/donbcfbmhbcapadipfkeojnmajbakjdc",
17-
alt: "Available in the Chrome Web Store",
20+
alt: "downloads.chrome-extension-alt",
1821
},
1922
{
2023
image: "/extension_badges/firefox.svg",
2124
url: "https://addons.mozilla.org/firefox/addon/ruffle_rs",
22-
alt: "Get the Add-On for Firefox",
25+
alt: "downloads.firefox-extension-alt",
2326
},
2427
{
2528
image: "/extension_badges/edge.svg",
2629
url: "https://microsoftedge.microsoft.com/addons/detail/ruffle/pipjjbgofgieknlpefmcckdmgaaegban",
27-
alt: "Get it from Microsoft for Edge",
30+
alt: "downloads.edge-extension-alt",
2831
},
2932
];
3033

3134
function ExtensionBadge(info: Extension) {
35+
const { t } = useTranslation();
3236
return (
3337
<Link href={info.url} target="_blank">
3438
<Image
3539
src={info.image}
36-
alt={info.alt}
40+
alt={t(info.alt)}
3741
width={0} // set by css to 100% width
3842
height={66}
3943
priority
@@ -44,17 +48,13 @@ function ExtensionBadge(info: Extension) {
4448
}
4549

4650
export function ExtensionList() {
51+
const { t } = useTranslation();
4752
return (
4853
<Stack>
4954
<Title id="extension" className={classes.title}>
50-
Browser Extension
55+
{t("downloads.browser-extension")}
5156
</Title>
52-
<Text>
53-
If you visit websites that have Flash content but aren't using Ruffle,
54-
or you want to ensure you're using the latest and greatest version of
55-
Ruffle on every website, then our browser extension is the perfect thing
56-
for you!
57-
</Text>
57+
<Text>{t("downloads.browser-extension-description")}</Text>
5858
<Group>
5959
{extensions.map((extension, i) => (
6060
<ExtensionBadge key={i} {...extension} />

src/app/downloads/nightlies.tsx

Lines changed: 23 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ import {
2424
githubReleasesUrl,
2525
webLinks,
2626
} from "@/app/downloads/config";
27+
import { useTranslation } from "@/app/translate";
2728

2829
function DownloadLink({
2930
link,
@@ -32,6 +33,7 @@ function DownloadLink({
3233
link: DownloadLink;
3334
release: GithubRelease;
3435
}) {
36+
const { t } = useTranslation();
3537
const url = release.downloads[link.key];
3638
if (!url) {
3739
return <></>;
@@ -49,7 +51,7 @@ function DownloadLink({
4951
title={url ? "" : "Unavailable"}
5052
>
5153
<link.icon />
52-
{link.shortName}
54+
{t(link.shortName)}
5355
</Button>
5456
);
5557
}
@@ -90,24 +92,25 @@ function NightlyRow(release: GithubRelease) {
9092
}
9193

9294
function NightlyCompactBox(release: GithubRelease) {
95+
const { t } = useTranslation();
9396
return (
9497
<>
9598
<Link href={release.url} className={classes.nameAsHeader} target="_blank">
9699
{release.name}
97100
</Link>
98-
<Title order={5}>Desktop Application</Title>
101+
<Title order={5}>{t("downloads.desktop-app")}</Title>
99102
<Group>
100103
{desktopLinks.map((link, index) => (
101104
<DownloadLink key={index} link={link} release={release} />
102105
))}
103106
</Group>
104-
<Title order={5}>Browser Extension</Title>
107+
<Title order={5}>{t("downloads.browser-extension")}</Title>
105108
<Group>
106109
{extensionLinks.map((link, index) => (
107110
<DownloadLink key={index} link={link} release={release} />
108111
))}
109112
</Group>
110-
<Title order={5}>Web Package</Title>
113+
<Title order={5}>{t("downloads.web-package")}</Title>
111114
<Group>
112115
{webLinks.map((link, index) => (
113116
<DownloadLink key={index} link={link} release={release} />
@@ -117,23 +120,25 @@ function NightlyCompactBox(release: GithubRelease) {
117120
);
118121
}
119122

120-
export function NightlyList({ nightlies }: { nightlies: GithubRelease[] }) {
123+
export function NightlyList({
124+
nightlies,
125+
}: {
126+
nightlies: GithubRelease[] | null;
127+
}) {
128+
const { t } = useTranslation();
121129
return (
122130
<Stack>
123-
<Title id="nightly-releases">Nightly Releases</Title>
131+
<Title id="nightly-releases">{t("downloads.nightly-releases")}</Title>
124132
<Text>
125-
If none of the above are suitable for you, you can manually download the
126-
latest Nightly release. These are automatically built every day
127-
(approximately midnight UTC), unless there are no changes on that day.{" "}
128-
Older nightly releases are available on{" "}
133+
{t("downloads.nightly-releases-description")}{" "}
129134
<Link
130135
href={githubReleasesUrl}
131136
className={classes.moreNightlies}
132137
target="_blank"
133138
>
134-
GitHub
139+
{t("footer.github")}
135140
</Link>
136-
.
141+
{t("common.line-ender")}
137142
</Text>
138143
<Table
139144
horizontalSpacing="md"
@@ -144,22 +149,22 @@ export function NightlyList({ nightlies }: { nightlies: GithubRelease[] }) {
144149
>
145150
<TableThead className={classes.header}>
146151
<TableTr>
147-
<TableTh>Version</TableTh>
148-
<TableTh>Desktop Application</TableTh>
149-
<TableTh>Browser Extension</TableTh>
150-
<TableTh>Web Package</TableTh>
152+
<TableTh>{t("downloads.version")}</TableTh>
153+
<TableTh>{t("downloads.desktop-app")}</TableTh>
154+
<TableTh>{t("downloads.browser-extension")}</TableTh>
155+
<TableTh>{t("downloads.web-package")}</TableTh>
151156
</TableTr>
152157
</TableThead>
153158
<TableTbody className={classes.body}>
154-
{nightlies.map((nightly) => (
159+
{nightlies?.map((nightly) => (
155160
<NightlyRow key={nightly.id} {...nightly} />
156161
))}
157162
</TableTbody>
158163
</Table>
159164

160165
<Stack hiddenFrom="sm">
161166
{/*Compact mobile view, because a table is far too wide*/}
162-
{nightlies.map((nightly) => (
167+
{nightlies?.map((nightly) => (
163168
<NightlyCompactBox key={nightly.id} {...nightly} />
164169
))}
165170
</Stack>

0 commit comments

Comments
 (0)