From 6e2615b0ec4b1bd8538f0a171557345d3909315c Mon Sep 17 00:00:00 2001 From: "1157649934@qq.com" <1157649934@qq.com> Date: Mon, 24 Jul 2023 14:40:47 +0900 Subject: [PATCH] =?UTF-8?q?New=20homepage=20for=20ja=201.=E5=A2=9E?= =?UTF-8?q?=E5=8A=A0=E4=BA=86Download=20WebGAL=E9=A1=B5=E9=9D=A2=E7=9A=84"?= =?UTF-8?q?readFirst"=E5=92=8C"license"=E9=83=A8=E5=88=86=E7=9A=84?= =?UTF-8?q?=E6=97=A5=E6=96=87=E7=BF=BB=E8=AF=91=E3=80=82=202.=E5=9C=A8?= =?UTF-8?q?=E6=A0=B9=E7=9B=AE=E5=BD=95=E4=B8=8B=E5=88=9B=E5=BB=BA=E4=BA=86?= =?UTF-8?q?docsRedirect.ts=E6=96=87=E4=BB=B6=EF=BC=8C=E8=83=BD=E5=A4=9F?= =?UTF-8?q?=E6=A0=B9=E6=8D=AE=E5=BD=93=E5=89=8D=E6=B5=8F=E8=A7=88=E5=99=A8?= =?UTF-8?q?=E7=9A=84=E8=AF=AD=E8=A8=80=E7=89=88=E6=9C=AC=EF=BC=8C=E8=BE=93?= =?UTF-8?q?=E5=87=BA=E9=87=8D=E5=AE=9A=E5=90=91=E5=90=8E=E7=9A=84=E6=96=87?= =?UTF-8?q?=E6=A1=A3=E9=93=BE=E6=8E=A5=E3=80=82=203.=E5=88=A9=E7=94=A8?= =?UTF-8?q?=E7=AC=AC=E4=BA=8C=E6=9D=A1=E4=B8=AD=E5=AF=BC=E5=87=BA=E7=9A=84?= =?UTF-8?q?docsRedirect=E5=87=BD=E6=95=B0=EF=BC=8C=E5=AF=B9=E5=BD=93?= =?UTF-8?q?=E5=89=8D=E9=A1=B5=E9=9D=A2=E4=B8=AD=E7=9A=84=E6=89=80=E6=9C=89?= =?UTF-8?q?=E6=96=87=E6=A1=A3=E9=93=BE=E6=8E=A5=E9=83=BD=E5=81=9A=E4=BA=86?= =?UTF-8?q?=E8=AF=AD=E8=A8=80=E7=89=88=E6=9C=AC=E9=87=8D=E5=AE=9A=E5=90=91?= =?UTF-8?q?=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/[locale]/components/Footer/Footer.tsx | 9 ++-- app/[locale]/components/Navbar/Nav.tsx | 3 +- .../components/TopVisual/TopVisual.tsx | 8 +--- .../components/WebGALGames/WebGALGames.tsx | 8 +--- .../download/components/ReadFirst.tsx | 3 +- docsRedirect.ts | 10 ++++ locales/ja.json | 46 +++++++++---------- 7 files changed, 46 insertions(+), 41 deletions(-) create mode 100644 docsRedirect.ts diff --git a/app/[locale]/components/Footer/Footer.tsx b/app/[locale]/components/Footer/Footer.tsx index 31f9ee8..eddacbc 100644 --- a/app/[locale]/components/Footer/Footer.tsx +++ b/app/[locale]/components/Footer/Footer.tsx @@ -3,6 +3,7 @@ import Link from 'next/link' import styles from './Footer.module.css' import { useTranslations } from 'next-intl' +import { docsRedirect } from '@/docsRedirect' const Footer = () => { const t = useTranslations('footer') @@ -18,9 +19,9 @@ const Footer = () => { { title: t('development'), links: [ - { href: 'https://docs.openwebgal.com/', label: t('gameDevelopDoc') }, - { href: 'https://docs.openwebgal.com/developers', label: t('contribute') }, - { href: 'https://docs.openwebgal.com/tech', label: t('technical') } + { href: docsRedirect('/'), label: t('gameDevelopDoc') }, + { href: docsRedirect('/developers'), label: t('contribute') }, + { href: docsRedirect('/tech'), label: t('technical') } ], }, { @@ -40,7 +41,7 @@ const Footer = () => { { title: t('sponsor'), links: [ - { href: 'https://docs.openwebgal.com/sponsor/', label: t('sponsor') }, + { href: docsRedirect('/sponsor'), label: t('sponsor') }, ], }, ] diff --git a/app/[locale]/components/Navbar/Nav.tsx b/app/[locale]/components/Navbar/Nav.tsx index 5ffe3fd..4071847 100644 --- a/app/[locale]/components/Navbar/Nav.tsx +++ b/app/[locale]/components/Navbar/Nav.tsx @@ -2,6 +2,7 @@ import { RiMenuFill } from 'react-icons/ri' import styles from './Nav.module.css' import Link from 'next/link' import { useTranslations } from 'next-intl' +import { docsRedirect } from '@/docsRedirect' const Nav = ({ locale, pathname }: { locale: string, pathname: string }) => { @@ -11,7 +12,7 @@ const Nav = ({ locale, pathname }: { locale: string, pathname: string }) => { { label: t('home'), href: `/${locale}/` }, { label: t('download'), href: `/${locale}/download/` }, { label: t('demo'), href: 'https://demo.openwebgal.com/' }, - { label: t('document'), href: 'https://docs.openwebgal.com/' }, + { label: t('document'), href: docsRedirect('/') }, { label: t('games'), href: `/${locale}/games/` } ] diff --git a/app/[locale]/components/TopVisual/TopVisual.tsx b/app/[locale]/components/TopVisual/TopVisual.tsx index afd35dd..da71d83 100644 --- a/app/[locale]/components/TopVisual/TopVisual.tsx +++ b/app/[locale]/components/TopVisual/TopVisual.tsx @@ -4,6 +4,7 @@ import Link from 'next/link' import styles from './TopVisual.module.css' import Image from 'next/image' import { useEffect, useState } from 'react' +import { docsRedirect } from '@/docsRedirect' const TopVisual = () => { const t = useTranslations('home') @@ -20,11 +21,6 @@ const TopVisual = () => { }, ] - // Depending on the language type of the browser, get the URL of docs - const docsURL = () => { - return `https://docs.openwebgal.com${ locale === 'zh-cn' ? '' : `/${locale}/` }` - } - const [topVisualImageIndex, setTopVisualImageIndex] = useState(0) useEffect(() => { @@ -55,7 +51,7 @@ const TopVisual = () => { {t('nowDownload')} diff --git a/app/[locale]/components/WebGALGames/WebGALGames.tsx b/app/[locale]/components/WebGALGames/WebGALGames.tsx index 12dc212..0fbf463 100644 --- a/app/[locale]/components/WebGALGames/WebGALGames.tsx +++ b/app/[locale]/components/WebGALGames/WebGALGames.tsx @@ -1,6 +1,7 @@ import Button from '@/app/components/Button/Button' import GameCard from '@/app/components/GameCard/GameCard' import { gamesData, homeGamesId } from '@/data/gamesData' +import { docsRedirect } from '@/docsRedirect' import { gamesDataSort } from '@/utils' import { useLocale, useTranslations } from 'next-intl' import Link from 'next/link' @@ -9,11 +10,6 @@ const WebGALGames = () => { const t = useTranslations('games') const locale = useLocale() - // Depending on the language type of the browser, get the URL of showcase-your-game - const showcaseYourGameURL = () => { - return `https://docs.openwebgal.com${ locale === 'zh-cn' ? '' : `/${locale}` }/guide/showcase-your-game` - } - return (
@@ -31,7 +27,7 @@ const WebGALGames = () => {