Translate stigmata set page

This commit is contained in:
Sakura Knoll
2022-01-09 08:54:55 +09:00 Unverified
parent 273794b3d8
commit 38ca73f06c
+56 -13
View File
@@ -6,8 +6,9 @@ import StigmataCard from '../../components/molecules/StigmataCard'
import Breadcrumb from '../../components/organisms/Breadcrumb' import Breadcrumb from '../../components/organisms/Breadcrumb'
import Honkai3rdNavigator from '../../components/organisms/Honkai3rdNavigator' import Honkai3rdNavigator from '../../components/organisms/Honkai3rdNavigator'
import { StigmataData, StigmataSet } from '../../lib/honkai3rd/stigmata' import { StigmataData, StigmataSet } from '../../lib/honkai3rd/stigmata'
import { capitalize } from '../../lib/string'
import SecondaryLabel from '../atoms/SecondaryLabel' import SecondaryLabel from '../atoms/SecondaryLabel'
import { translate, useTranslation } from '../../lib/i18n'
import { useRouter } from 'next/router'
export interface StigmataSetProps { export interface StigmataSetProps {
type: 'set' type: 'set'
@@ -19,6 +20,20 @@ const StigmataSetPage = ({
stigmataSet, stigmataSet,
stigmataSetList, stigmataSetList,
}: StigmataSetProps) => { }: StigmataSetProps) => {
const { t } = useTranslation()
const { locale } = useRouter()
const stigmataSetName = translate(
locale,
{ 'ko-KR': stigmataSet.krName },
stigmataSet.name
)
const stigmataSetAltName = translate(
locale,
{ 'ko-KR': stigmataSet.krAltName },
stigmataSet.altName
)
return ( return (
<Box> <Box>
<Honkai3rdNavigator /> <Honkai3rdNavigator />
@@ -26,26 +41,26 @@ const StigmataSetPage = ({
<Box p={3}> <Box p={3}>
<Breadcrumb <Breadcrumb
items={[ items={[
{ href: '/honkai3rd', label: 'Honkai 3rd' }, { href: '/honkai3rd', label: t('breadcrumb.honkai-3rd') },
{ {
href: { href: {
pathname: `/honkai3rd/stigmata`, pathname: `/honkai3rd/stigmata`,
query: { list: 'set' }, query: { list: 'set' },
}, },
label: 'Stigmata', label: t('breadcrumb.stigmata'),
}, },
{ {
href: `/honkai3rd/stigmata/${stigmataSet.id}-set`, href: `/honkai3rd/stigmata/${stigmataSet.id}-set`,
label: `${stigmataSet.name}`, label: stigmataSetName,
}, },
]} ]}
/> />
<Box mb={3}> <Box mb={3}>
<Heading as='h1' mb={0}> <Heading as='h1' mb={0}>
{stigmataSet.name} {stigmataSetName}
</Heading> </Heading>
<SecondaryLabel>{stigmataSet.altName}</SecondaryLabel> <SecondaryLabel>{stigmataSetAltName}</SecondaryLabel>
</Box> </Box>
<Card mb={3}> <Card mb={3}>
@@ -67,6 +82,16 @@ const StigmataSetPage = ({
})} })}
</Flex> </Flex>
{stigmataSetList.map((stigmataSetItem) => { {stigmataSetList.map((stigmataSetItem) => {
const stigmataName = translate(
locale,
{ 'ko-KR': stigmataSetItem.krName },
stigmataSetItem.name
)
const stigmataSkillDescrpition = translate(
locale,
{ 'ko-KR': stigmataSetItem.skill.krDescription },
stigmataSetItem.skill.description
)
return ( return (
<React.Fragment key={stigmataSetItem.id}> <React.Fragment key={stigmataSetItem.id}>
<Box sx={{ p: 2, borderBottom: 'default' }}> <Box sx={{ p: 2, borderBottom: 'default' }}>
@@ -74,11 +99,11 @@ const StigmataSetPage = ({
<PageLink <PageLink
href={`/honkai3rd/stigmata/${stigmataSetItem.id}`} href={`/honkai3rd/stigmata/${stigmataSetItem.id}`}
> >
{stigmataSetItem.name} {stigmataName}
</PageLink> </PageLink>
</Heading> </Heading>
<SecondaryLabel> <SecondaryLabel>
{capitalize(stigmataSetItem.type)} {t(`stigmata-show.${stigmataSetItem.type}`)}
</SecondaryLabel> </SecondaryLabel>
</Box> </Box>
<Box p={2} sx={{ borderBottom: 'default' }}> <Box p={2} sx={{ borderBottom: 'default' }}>
@@ -93,7 +118,7 @@ const StigmataSetPage = ({
'&:last-child': { borderBottom: 'none' }, '&:last-child': { borderBottom: 'none' },
}} }}
> >
{stigmataSetItem.skill.description} {stigmataSkillDescrpition}
</Paragraph> </Paragraph>
</React.Fragment> </React.Fragment>
) )
@@ -102,16 +127,34 @@ const StigmataSetPage = ({
<Card> <Card>
<Heading as='h2' m={0} p={2} sx={{ borderBottom: 'default' }}> <Heading as='h2' m={0} p={2} sx={{ borderBottom: 'default' }}>
{stigmataSet.twoSetSkill.name} {translate(
locale,
{ 'ko-KR': stigmataSet.twoSetSkill.krName },
stigmataSet.twoSetSkill.name
)}
</Heading> </Heading>
<Paragraph m={0} p={2} sx={{ borderBottom: 'default' }}> <Paragraph m={0} p={2} sx={{ borderBottom: 'default' }}>
{stigmataSet.twoSetSkill.description} {translate(
locale,
{ 'ko-KR': stigmataSet.twoSetSkill.krDescription },
stigmataSet.twoSetSkill.description
)}
</Paragraph> </Paragraph>
<Heading as='h2' m={0} p={2} sx={{ borderBottom: 'default' }}> <Heading as='h2' m={0} p={2} sx={{ borderBottom: 'default' }}>
{stigmataSet.threeSetSkill.name} {translate(
locale,
{
'ko-KR': stigmataSet.threeSetSkill.krName,
},
stigmataSet.threeSetSkill.name
)}
</Heading> </Heading>
<Paragraph m={0} p={2}> <Paragraph m={0} p={2}>
{stigmataSet.threeSetSkill.description} {translate(
locale,
{ 'ko-KR': stigmataSet.threeSetSkill.krDescription },
stigmataSet.threeSetSkill.description
)}
</Paragraph> </Paragraph>
</Card> </Card>
</Box> </Box>