Add locale to object unit components
This commit is contained in:
parent
9ec157359b
commit
34bd98856a
3 changed files with 15 additions and 3 deletions
|
|
@ -1,4 +1,5 @@
|
||||||
import React, { useEffect, useState } from 'react'
|
import React, { useEffect, useState } from 'react'
|
||||||
|
import { useRouter } from 'next/router'
|
||||||
import classnames from 'classnames'
|
import classnames from 'classnames'
|
||||||
|
|
||||||
import SearchModal from '~components/SearchModal'
|
import SearchModal from '~components/SearchModal'
|
||||||
|
|
@ -18,6 +19,9 @@ interface Props {
|
||||||
}
|
}
|
||||||
|
|
||||||
const CharacterUnit = (props: Props) => {
|
const CharacterUnit = (props: Props) => {
|
||||||
|
const router = useRouter()
|
||||||
|
const locale = (router.locale && ['en', 'ja'].includes(router.locale)) ? router.locale : 'en'
|
||||||
|
|
||||||
const [imageUrl, setImageUrl] = useState('')
|
const [imageUrl, setImageUrl] = useState('')
|
||||||
|
|
||||||
const classes = classnames({
|
const classes = classnames({
|
||||||
|
|
@ -88,7 +92,7 @@ const CharacterUnit = (props: Props) => {
|
||||||
updateUncap={passUncapData}
|
updateUncap={passUncapData}
|
||||||
special={character.special}
|
special={character.special}
|
||||||
/> : '' }
|
/> : '' }
|
||||||
<h3 className="CharacterName">{character?.name.en}</h3>
|
<h3 className="CharacterName">{character?.name[locale]}</h3>
|
||||||
</div>
|
</div>
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,5 @@
|
||||||
import React, { useEffect, useState } from 'react'
|
import React, { useEffect, useState } from 'react'
|
||||||
|
import { useRouter } from 'next/router'
|
||||||
import classnames from 'classnames'
|
import classnames from 'classnames'
|
||||||
|
|
||||||
import SearchModal from '~components/SearchModal'
|
import SearchModal from '~components/SearchModal'
|
||||||
|
|
@ -20,6 +21,9 @@ interface Props {
|
||||||
const SummonUnit = (props: Props) => {
|
const SummonUnit = (props: Props) => {
|
||||||
const [imageUrl, setImageUrl] = useState('')
|
const [imageUrl, setImageUrl] = useState('')
|
||||||
|
|
||||||
|
const router = useRouter()
|
||||||
|
const locale = (router.locale && ['en', 'ja'].includes(router.locale)) ? router.locale : 'en'
|
||||||
|
|
||||||
const classes = classnames({
|
const classes = classnames({
|
||||||
SummonUnit: true,
|
SummonUnit: true,
|
||||||
'main': props.unitType == 0,
|
'main': props.unitType == 0,
|
||||||
|
|
@ -97,7 +101,7 @@ const SummonUnit = (props: Props) => {
|
||||||
special={false}
|
special={false}
|
||||||
/> : ''
|
/> : ''
|
||||||
}
|
}
|
||||||
<h3 className="SummonName">{summon?.name.en}</h3>
|
<h3 className="SummonName">{summon?.name[locale]}</h3>
|
||||||
</div>
|
</div>
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,5 @@
|
||||||
import React, { useEffect, useState } from 'react'
|
import React, { useEffect, useState } from 'react'
|
||||||
|
import Router, { useRouter } from 'next/router'
|
||||||
import classnames from 'classnames'
|
import classnames from 'classnames'
|
||||||
|
|
||||||
import SearchModal from '~components/SearchModal'
|
import SearchModal from '~components/SearchModal'
|
||||||
|
|
@ -24,6 +25,9 @@ interface Props {
|
||||||
const WeaponUnit = (props: Props) => {
|
const WeaponUnit = (props: Props) => {
|
||||||
const [imageUrl, setImageUrl] = useState('')
|
const [imageUrl, setImageUrl] = useState('')
|
||||||
|
|
||||||
|
const router = useRouter()
|
||||||
|
const locale = (router.locale && ['en', 'ja'].includes(router.locale)) ? router.locale : 'en'
|
||||||
|
|
||||||
const classes = classnames({
|
const classes = classnames({
|
||||||
WeaponUnit: true,
|
WeaponUnit: true,
|
||||||
'mainhand': props.unitType == 0,
|
'mainhand': props.unitType == 0,
|
||||||
|
|
@ -108,7 +112,7 @@ const WeaponUnit = (props: Props) => {
|
||||||
special={false}
|
special={false}
|
||||||
/> : ''
|
/> : ''
|
||||||
}
|
}
|
||||||
<h3 className="WeaponName">{weapon?.name.en}</h3>
|
<h3 className="WeaponName">{weapon?.name[locale]}</h3>
|
||||||
</div>
|
</div>
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue