From d7b5b81b5d6ec55d0847b5171c3800a8f7b5c001 Mon Sep 17 00:00:00 2001 From: Pinapelz Date: Tue, 7 Oct 2025 17:25:43 -0700 Subject: feat: add i18n translation (initial JP and EN) --- site/src/pages/GameSelector.tsx | 11 ++++++----- site/src/pages/Homepage.tsx | 21 +++++++++++---------- site/src/pages/NotFound.tsx | 10 ++++++---- 3 files changed, 23 insertions(+), 19 deletions(-) (limited to 'site/src/pages') diff --git a/site/src/pages/GameSelector.tsx b/site/src/pages/GameSelector.tsx index 41551bc..5586cbf 100644 --- a/site/src/pages/GameSelector.tsx +++ b/site/src/pages/GameSelector.tsx @@ -1,5 +1,6 @@ import { Link, useSearchParams } from "react-router-dom"; import TitleBar from "../components/TitleBar"; +import { useTranslation } from "react-i18next"; interface GameCategory { name: string; @@ -67,18 +68,19 @@ const gameInfo: GameCategory[] = [ const GameSelector = () => { const [searchParams] = useSearchParams(); const isMoe = searchParams.has("moe"); + const { t } = useTranslation(); const renderCategory = (category: GameCategory) => (

- {category.name} + {t(`gameselector.categories.${category.name.toLowerCase().replace(' ', '_')}`)}

- {category.description} + {category.name === "COMMUNITY" ? t('gameselector.community_description') : category.description}

{category.games.map((game) => ( @@ -104,13 +106,12 @@ const GameSelector = () => {

- Select a Game + {t('gameselector.title')}

- Individual game feeds keep a longer history of news relating to that - game than the main feed. + {t('gameselector.subtitle')}

{gameInfo.map(renderCategory)}
diff --git a/site/src/pages/Homepage.tsx b/site/src/pages/Homepage.tsx index 4e04688..13ec4fd 100644 --- a/site/src/pages/Homepage.tsx +++ b/site/src/pages/Homepage.tsx @@ -5,6 +5,7 @@ import { getGameTitle } from "../utils.ts"; import TitleBar from "../components/TitleBar"; import { GameNotes } from "../components/GameNotes"; import NotificationButton from "../components/NotificationButton"; +import { useTranslation } from "react-i18next"; interface ArcadeNewsAPIData { fetch_time: number; @@ -12,6 +13,8 @@ interface ArcadeNewsAPIData { } export default function Home() { + const { t } = useTranslation(); + const { gameId } = useParams<{ gameId?: string }>(); const [searchParams] = useSearchParams(); const isMoe = searchParams.has("moe"); @@ -116,7 +119,7 @@ export default function Home() {

- News Not Found + {t('news_not_found')}

- Return Home + {t('return_home')}

@@ -218,7 +221,7 @@ export default function Home() {
-

Welcome to 573-UPDATES

+

{t('homepage.welcome')}

- News and Information for various arcade games is aggregated - here! + {t('homepage.news_aggregation_note')}

- RSS feeds are available on each game's individual page + {t('homepage.rss_feeds')}

- Please see the{" "} + {t('homepage.github_info').split('GitHub')[0]}{" "} GitHub {" "} - for API information + {t('homepage.github_info').split('GitHub')[1] || ''}

@@ -267,8 +269,7 @@ export default function Home() { } flex items-center gap-1 mx-auto transition-colors`} > - Subscribed to {subscribedGames.length} game - {subscribedGames.length !== 1 ? "s" : ""} + {`${t('subscribed_to_games_count')}`} {subscribedGames.length} {`${t('games')}`}

404

-

Page Not Found

+

{t('notFound.title')}

- The page you're looking for doesn't exist or has been moved. + {t('notFound.description')}

- Go to Homepage + {t('return_home')}
- View All Games + {t('notFound.view_all_games')}
-- cgit v1.2.3