Introduce i18n
This commit is contained in:
@@ -15,6 +15,7 @@ import {
|
||||
BattlesuitData,
|
||||
BattlesuitSkillGroup,
|
||||
} from '../../../lib/honkai3rd/battlesuits'
|
||||
import { getI18NProps } from '../../../lib/i18n'
|
||||
import {
|
||||
getBattlesuitById,
|
||||
listBattlesuits,
|
||||
@@ -149,12 +150,13 @@ const BattlesuitShowPage = ({ battlesuit }: BattlesuitShowPageProps) => {
|
||||
|
||||
export default BattlesuitShowPage
|
||||
|
||||
export function getStaticProps(
|
||||
context: NextPageContext & { params: { battlesuitId: string } }
|
||||
) {
|
||||
const battlesuit = getBattlesuitById(context.params.battlesuitId)
|
||||
export async function getStaticProps({
|
||||
params,
|
||||
locale,
|
||||
}: NextPageContext & { params: { battlesuitId: string } }) {
|
||||
const battlesuit = getBattlesuitById(params.battlesuitId)
|
||||
return {
|
||||
props: { battlesuit },
|
||||
props: { battlesuit, ...(await getI18NProps(locale)) },
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -14,6 +14,8 @@ import {
|
||||
} from '../../../lib/honkai3rd/battlesuits'
|
||||
import BattlesuitCard from '../../../components/molecules/BattlesuitCard'
|
||||
import { useRouter } from 'next/router'
|
||||
import { NextPageContext } from 'next'
|
||||
import { getI18NProps } from '../../../lib/i18n'
|
||||
|
||||
type BattlesuitListItemData = Pick<
|
||||
BattlesuitData,
|
||||
@@ -117,12 +119,13 @@ const BattlesuitListPage = ({ battlesuits }: BattlesuitListPageProps) => {
|
||||
|
||||
export default BattlesuitListPage
|
||||
|
||||
export async function getStaticProps() {
|
||||
export async function getStaticProps({ locale }: NextPageContext) {
|
||||
return {
|
||||
props: {
|
||||
battlesuits: listBattlesuits().map((battlesuit) =>
|
||||
pick(['id', 'name', 'features', 'type', 'valkyrie'], battlesuit)
|
||||
),
|
||||
...(await getI18NProps(locale)),
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user