Skip to content

Commit

Permalink
feat: localized title
Browse files Browse the repository at this point in the history
  • Loading branch information
KagamiChan committed Oct 3, 2024
1 parent e48b882 commit 16cdae6
Show file tree
Hide file tree
Showing 9 changed files with 72 additions and 13 deletions.
17 changes: 17 additions & 0 deletions src/app/[locale]/download/page.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { type Metadata } from 'next'
import { headers } from 'next/headers'

import { DownloadLinks } from './download-links'
Expand All @@ -11,6 +12,22 @@ import { detectTargetFromRequest } from '~/lib/target'

export const runtime = 'edge'

export const generateMetadata = async ({
params: { locale },
previousMetadata,
}: Readonly<{
params: {
locale: string
}
previousMetadata: Metadata
}>): Promise<Metadata> => {
const { t } = await initTranslations(locale, ['common'])
return {
...previousMetadata,
title: `poi | ${t('KanColle Browser')} | ${t('Download')}`,
}
}

export default async function DownloadPage({
params: { locale },
}: {
Expand Down
20 changes: 19 additions & 1 deletion src/app/[locale]/explore/page.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,28 @@
import { type Metadata } from 'next'
import { remark } from 'remark'
import html from 'remark-html'

import { Transition } from '~/components/transition'
import { initTranslations } from '~/i18n'

export const runtime = 'edge'

export const generateMetadata = async ({
params: { locale },
previousMetadata,
}: Readonly<{
params: {
locale: string
}
previousMetadata: Metadata
}>): Promise<Metadata> => {
const { t } = await initTranslations(locale, ['common'])
return {
...previousMetadata,
title: `poi | ${t('KanColle Browser')} | ${t('Explore')}`,
}
}

export default async function HomePage({
params: { locale },
}: {
Expand All @@ -18,7 +36,7 @@ export default async function HomePage({

return (
<Transition
className="prose dark:prose-invert w-full max-w-none grow"
className="prose w-full max-w-none grow dark:prose-invert"
dangerouslySetInnerHTML={{ __html: contentHtml }}
></Transition>
)
Expand Down
30 changes: 24 additions & 6 deletions src/app/[locale]/layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,16 +13,34 @@ import { initTranslations } from '~/i18n'
import { i18nConfig } from '~/i18n-config'
import { cn } from '~/lib/utils'

export const metadata: Metadata = {
title: 'Create T3 App',
description: 'Generated by create-t3-app',
icons: [{ rel: 'icon', url: '/favicon.ico' }],
}

export const generateStaticParams = async () => {
return i18nConfig.locales.map((locale) => ({ locale }))
}

export const generateMetadata = async ({
params: { locale },
}: Readonly<{
params: {
locale: string
}
}>): Promise<Metadata> => {
const { t } = await initTranslations(locale, ['common'])
return {
title: `poi | ${t('KanColle Browser')}`,
description:
'Scalable KanColle browser and tool, for Windows, macOS and Linux. 一个可扩展的舰队Collection浏览器。拡張可能な艦隊これくしょんブラウザ。',
icons: [{ rel: 'icon', url: '/favicon.ico' }],
keywords: [
'poi',
'kancolle',
'browser',
'艦これ',
'艦隊これくしょん',
'舰队Collection',
],
}
}

ReactDOM.preconnect('https://fonts.googleapis.com')
ReactDOM.preconnect('https://fonts.gstatic.com', { crossOrigin: 'anonymous' })

Expand Down
3 changes: 2 additions & 1 deletion src/locales/en/common.json
Original file line number Diff line number Diff line change
Expand Up @@ -52,5 +52,6 @@
"armPortable": "ARM portable",
"x64Portable": "64-bit portable",
"Sighted by skilled lookouts:": "Sighted by skilled lookouts:",
"Misc": "Misc"
"Misc": "Misc",
"KanColle Browser": "KanColle Browser"
}
3 changes: 2 additions & 1 deletion src/locales/fr/common.json
Original file line number Diff line number Diff line change
Expand Up @@ -52,5 +52,6 @@
"x64Setup": "64 bits",
"x64Portable": "Portable 64 bits",
"Sighted by skilled lookouts:": "Repéré par des guetteurs qualifiés :",
"Misc": "Divers"
"Misc": "Divers",
"KanColle Browser": "Navigateur KanColle"
}
3 changes: 2 additions & 1 deletion src/locales/ja/common.json
Original file line number Diff line number Diff line change
Expand Up @@ -52,5 +52,6 @@
"x64Setup": "64ビット",
"x64Portable": "64ビットポータブル",
"Sighted by skilled lookouts:": "熟練見張員が観察した:",
"Misc": "その他"
"Misc": "その他",
"KanColle Browser": "艦これ専ブラ"
}
3 changes: 2 additions & 1 deletion src/locales/ko/common.json
Original file line number Diff line number Diff line change
Expand Up @@ -52,5 +52,6 @@
"x64Setup": "64비트",
"x64Portable": "64비트 휴대용",
"Sighted by skilled lookouts:": "숙련된 견장원이 발견했습니다:",
"Misc": "기타"
"Misc": "기타",
"KanColle Browser": "칸콜레 브라우저"
}
3 changes: 2 additions & 1 deletion src/locales/zh-Hans/common.json
Original file line number Diff line number Diff line change
Expand Up @@ -52,5 +52,6 @@
"x64Setup": "64位",
"x64Portable": "64位便携版",
"Sighted by skilled lookouts:": "熟练见张员观察到了:",
"Misc": "杂项"
"Misc": "杂项",
"KanColle Browser": "舰娘专用浏览器"
}
3 changes: 2 additions & 1 deletion src/locales/zh-Hant/common.json
Original file line number Diff line number Diff line change
Expand Up @@ -52,5 +52,6 @@
"x64Setup": "64位元",
"x64Portable": "64位元便攜版",
"Sighted by skilled lookouts:": "熟練見張員觀察到了:",
"Misc": "雜項"
"Misc": "雜項",
"KanColle Browser": "艦娘專用瀏覽器"
}

0 comments on commit 16cdae6

Please sign in to comment.