Add localized paths
This commit is contained in:
@@ -15,17 +15,19 @@ import {
|
||||
BattlesuitData,
|
||||
BattlesuitSkillGroup,
|
||||
} from '../../../lib/honkai3rd/battlesuits'
|
||||
import { getI18NProps } from '../../../lib/i18n'
|
||||
import { generateI18NPaths, getI18NProps } from '../../../lib/i18n'
|
||||
import {
|
||||
getBattlesuitById,
|
||||
listBattlesuits,
|
||||
} from '../../../server/data/honkai3rd/battlesuits'
|
||||
import { useTranslation } from 'next-i18next'
|
||||
|
||||
interface BattlesuitShowPageProps {
|
||||
battlesuit: BattlesuitData
|
||||
}
|
||||
|
||||
const BattlesuitShowPage = ({ battlesuit }: BattlesuitShowPageProps) => {
|
||||
const { t } = useTranslation()
|
||||
return (
|
||||
<Box>
|
||||
<Honkai3rdNavigator />
|
||||
@@ -33,8 +35,11 @@ const BattlesuitShowPage = ({ battlesuit }: BattlesuitShowPageProps) => {
|
||||
<Box p={3}>
|
||||
<Breadcrumb
|
||||
items={[
|
||||
{ href: '/honkai3rd', label: 'Honkai 3rd' },
|
||||
{ href: '/honkai3rd/battlesuits', label: 'Battlesuits' },
|
||||
{ href: '/honkai3rd', label: t('breadcrumb.honkai-3rd') },
|
||||
{
|
||||
href: '/honkai3rd/battlesuits',
|
||||
label: t('breadcrumb.battlesuits'),
|
||||
},
|
||||
{
|
||||
href: `/honkai3rd/battlesuits/${battlesuit.id}`,
|
||||
label: battlesuit.name,
|
||||
@@ -155,6 +160,7 @@ export async function getStaticProps({
|
||||
locale,
|
||||
}: NextPageContext & { params: { battlesuitId: string } }) {
|
||||
const battlesuit = getBattlesuitById(params.battlesuitId)
|
||||
|
||||
return {
|
||||
props: { battlesuit, ...(await getI18NProps(locale)) },
|
||||
}
|
||||
@@ -162,11 +168,13 @@ export async function getStaticProps({
|
||||
|
||||
export async function getStaticPaths() {
|
||||
return {
|
||||
paths: listBattlesuits().map((battlesuit) => {
|
||||
return {
|
||||
params: { battlesuitId: battlesuit.id },
|
||||
}
|
||||
}),
|
||||
paths: generateI18NPaths(
|
||||
listBattlesuits().map((battlesuit) => {
|
||||
return {
|
||||
params: { battlesuitId: battlesuit.id },
|
||||
}
|
||||
})
|
||||
),
|
||||
fallback: false,
|
||||
}
|
||||
}
|
||||
|
||||
@@ -8,7 +8,7 @@ import SecondaryLabel from '../../../components/atoms/SecondaryLabel'
|
||||
import Breadcrumb from '../../../components/organisms/Breadcrumb'
|
||||
import Honkai3rdNavigator from '../../../components/organisms/Honkai3rdNavigator'
|
||||
import { ElfData } from '../../../lib/honkai3rd/elfs'
|
||||
import { getI18NProps } from '../../../lib/i18n'
|
||||
import { generateI18NPaths, getI18NProps } from '../../../lib/i18n'
|
||||
import { capitalize } from '../../../lib/string'
|
||||
import { getElfById, listElfs } from '../../../server/data/honkai3rd/elfs'
|
||||
|
||||
@@ -116,11 +116,13 @@ export async function getStaticProps({
|
||||
|
||||
export async function getStaticPaths() {
|
||||
return {
|
||||
paths: listElfs().map((elf) => {
|
||||
return {
|
||||
params: { elfId: elf.id },
|
||||
}
|
||||
}),
|
||||
paths: generateI18NPaths(
|
||||
listElfs().map((elf) => {
|
||||
return {
|
||||
params: { elfId: elf.id },
|
||||
}
|
||||
})
|
||||
),
|
||||
fallback: false,
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,7 +6,7 @@ import SingleStigmataPage, {
|
||||
import StigmataSetPage, {
|
||||
StigmataSetProps,
|
||||
} from '../../../components/pages/StigmataSetPage'
|
||||
import { getI18NProps } from '../../../lib/i18n'
|
||||
import { generateI18NPaths, getI18NProps } from '../../../lib/i18n'
|
||||
import {
|
||||
listStigmata,
|
||||
getStigmataById,
|
||||
@@ -60,7 +60,7 @@ export async function getStaticProps({
|
||||
|
||||
export async function getStaticPaths() {
|
||||
return {
|
||||
paths: [
|
||||
paths: generateI18NPaths([
|
||||
...listStigmata().map((stigmata) => {
|
||||
return {
|
||||
params: { stigmataId: stigmata.id },
|
||||
@@ -71,7 +71,7 @@ export async function getStaticPaths() {
|
||||
params: { stigmataId: `${stigmataSet.id}-set` },
|
||||
}
|
||||
}),
|
||||
],
|
||||
]),
|
||||
fallback: false,
|
||||
}
|
||||
}
|
||||
|
||||
@@ -20,7 +20,7 @@ import { BattlesuitData } from '../../../lib/honkai3rd/battlesuits'
|
||||
import { WeaponData } from '../../../lib/honkai3rd/weapons'
|
||||
import { SupplyEventData } from '../../../lib/honkai3rd/supplyEvents'
|
||||
import { VersionData } from '../../../lib/honkai3rd/versions'
|
||||
import { getI18NProps } from '../../../lib/i18n'
|
||||
import { generateI18NPaths, getI18NProps } from '../../../lib/i18n'
|
||||
|
||||
interface VersionShowPageProps {
|
||||
versionData: VersionData
|
||||
@@ -213,13 +213,15 @@ export async function getStaticProps({
|
||||
|
||||
export async function getStaticPaths() {
|
||||
return {
|
||||
paths: listVersionData().map((versionData) => {
|
||||
return {
|
||||
params: {
|
||||
versionId: versionData.version.toString(),
|
||||
},
|
||||
}
|
||||
}),
|
||||
paths: generateI18NPaths(
|
||||
listVersionData().map((versionData) => {
|
||||
return {
|
||||
params: {
|
||||
versionId: versionData.version.toString(),
|
||||
},
|
||||
}
|
||||
})
|
||||
),
|
||||
fallback: false,
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,7 +5,7 @@ import SquareImageBox from '../../../components/atoms/SquareImageBox'
|
||||
import Breadcrumb from '../../../components/organisms/Breadcrumb'
|
||||
import Honkai3rdNavigator from '../../../components/organisms/Honkai3rdNavigator'
|
||||
import { WeaponData } from '../../../lib/honkai3rd/weapons'
|
||||
import { getI18NProps } from '../../../lib/i18n'
|
||||
import { generateI18NPaths, getI18NProps } from '../../../lib/i18n'
|
||||
import { capitalize } from '../../../lib/string'
|
||||
import {
|
||||
getWeaponById,
|
||||
@@ -94,11 +94,13 @@ export async function getStaticProps({
|
||||
|
||||
export async function getStaticPaths() {
|
||||
return {
|
||||
paths: listWeapons().map((weapon) => {
|
||||
return {
|
||||
params: { weaponId: weapon.id },
|
||||
}
|
||||
}),
|
||||
paths: generateI18NPaths(
|
||||
listWeapons().map((weapon) => {
|
||||
return {
|
||||
params: { weaponId: weapon.id },
|
||||
}
|
||||
})
|
||||
),
|
||||
fallback: false,
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user