From 0fbbb45c80c90a1c5d485444127e9a3e32c51007 Mon Sep 17 00:00:00 2001 From: Sakura Knoll Date: Sat, 8 Jan 2022 20:20:46 +0900 Subject: [PATCH] Translate weapon list page --- public/locales/en-US/common.json | 7 ++++- public/locales/ko-KR/common.json | 7 ++++- src/components/molecules/WeaponCard.tsx | 11 ++++++-- src/lib/honkai3rd/weapons.ts | 3 ++ src/pages/honkai3rd/weapons/index.tsx | 37 +++++++++++++------------ src/server/data/honkai3rd/weapons.ts | 35 ++++++++++++++++++++++- 6 files changed, 77 insertions(+), 23 deletions(-) diff --git a/public/locales/en-US/common.json b/public/locales/en-US/common.json index 31ecea2d..87ca314c 100644 --- a/public/locales/en-US/common.json +++ b/public/locales/en-US/common.json @@ -10,7 +10,8 @@ "breadcrumb": { "honkai-3rd": "Honkai 3rd", "battlesuits": "Battlesuits", - "stigmata": "Stigmata" + "stigmata": "Stigmata", + "weapons": "Weapons" }, "battlesuits-list": { "heading": "Battlesuits", @@ -34,5 +35,9 @@ "top": "Top", "mid": "Mid", "bot": "Bot" + }, + "weapons-list": { + "weapons": "Weapons", + "filter-by-category": "Filter by Category" } } diff --git a/public/locales/ko-KR/common.json b/public/locales/ko-KR/common.json index 2e93a218..facc07a6 100644 --- a/public/locales/ko-KR/common.json +++ b/public/locales/ko-KR/common.json @@ -13,7 +13,8 @@ "stigmata": "성흔", "top": "(상)", "mid": "(중)", - "bot": "(하)" + "bot": "(하)", + "weapons": "무기" }, "battlesuits-list": { "heading": "발키리", @@ -37,5 +38,9 @@ "top": "(상)", "mid": "(중)", "bot": "(하)" + }, + "weapons-list": { + "weapons": "무기", + "filter-by-category": "카테고리 필터" } } diff --git a/src/components/molecules/WeaponCard.tsx b/src/components/molecules/WeaponCard.tsx index 9ac7cf56..eabfce79 100644 --- a/src/components/molecules/WeaponCard.tsx +++ b/src/components/molecules/WeaponCard.tsx @@ -1,15 +1,20 @@ /** @jsxImportSource theme-ui */ import { Box, Card, Text } from '@theme-ui/components' +import { useRouter } from 'next/router' import { WeaponData } from '../../lib/honkai3rd/weapons' +import { translate } from '../../lib/i18n' import PageLink from '../atoms/PageLink' import SquareImageBox from '../atoms/SquareImageBox' interface WeaponCardProps { - weapon: Pick + weapon: Pick hidden?: boolean } const WeaponCard = ({ weapon, hidden }: WeaponCardProps) => { + const { locale } = useRouter() + const weaponName = translate(locale, { 'ko-KR': weapon.krName }, weapon.name) + return (