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/components/NewsFeed.tsx | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'site/src/components/NewsFeed.tsx') diff --git a/site/src/components/NewsFeed.tsx b/site/src/components/NewsFeed.tsx index 7cf5a08..2e08b16 100644 --- a/site/src/components/NewsFeed.tsx +++ b/site/src/components/NewsFeed.tsx @@ -1,6 +1,7 @@ import { useState, useEffect } from "react"; import { getGameTitle, getShortenedGameName } from "../utils.ts"; import { useSearchParams } from "react-router-dom"; +import { useTranslation } from "react-i18next"; export interface NewsData { date: string; @@ -24,6 +25,7 @@ interface NewsFeedProps { } export const NewsFeed: React.FC = ({ newsItems }) => { + const { t } = useTranslation(); const [showEnglish, setShowEnglish] = useState>({}); const [expanded, setExpanded] = useState>({}); const [currentImageIndex, setCurrentImageIndex] = useState< @@ -168,7 +170,7 @@ export const NewsFeed: React.FC = ({ newsItems }) => { onClick={() => toggleLanguage(newsId)} className={`${isMoe ? "bg-pink-200 hover:bg-pink-300" : "bg-gray-800 hover:bg-gray-700"} text-xs py-1 px-2 rounded`} > - {isEnglish ? "View Original" : "View in English"} + {isEnglish ? t("view_in_original_text") : t("view_in_english_text")} )} @@ -233,13 +235,13 @@ export const NewsFeed: React.FC = ({ newsItems }) => { : `${window.location.origin}${pathname === "/news" ? "" : pathname}#${newsId}`; navigator.clipboard.writeText(url); alert( - "Copied Direct Link to Post (Older news are automatically culled after some time)", + `${t('copy_link_notif')}` ); }} title="Copy permalink" className="text-xs text-blue-400 hover:underline cursor-pointer" > - 🔗 Copy Link to Post + 🔗 {`${t('copy_link_to_post')}`} @@ -248,8 +250,7 @@ export const NewsFeed: React.FC = ({ newsItems }) => {
- The information above is written by AI / - 上記の情報はAIによって生成されました。 + {`${t('ai_summary_note')}`}
)} @@ -258,8 +259,7 @@ export const NewsFeed: React.FC = ({ newsItems }) => {
- The information above is machine translated and may contain - inaccuracies + {`${t('machine_tl_note')}`}
)} -- cgit v1.2.3