diff --git a/features/room/components/CreateRoomForm.tsx b/features/room/components/CreateRoomForm.tsx index b6242505..e77de09b 100644 --- a/features/room/components/CreateRoomForm.tsx +++ b/features/room/components/CreateRoomForm.tsx @@ -55,7 +55,7 @@ function CreateRoomForm({ }); const { fetch } = useRequest(); const router = useRouter(); - const { t } = useTranslation("rooms"); + const { t } = useTranslation(); const [isLockRoom, setIsLockRoom] = useState(false); const passwordInputRef = useRef(null); const gameNameInputRef = useRef(null); diff --git a/features/room/components/JoinLockRoomForm.tsx b/features/room/components/JoinLockRoomForm.tsx index 4f9f1136..e797b882 100644 --- a/features/room/components/JoinLockRoomForm.tsx +++ b/features/room/components/JoinLockRoomForm.tsx @@ -11,7 +11,7 @@ interface JoinLockRoomFormProps extends PropsWithChildren { } function JoinLockRoomForm({ id, children }: Readonly) { - const { t } = useTranslation("rooms"); + const { t } = useTranslation(); const { handleJoinRoom } = useJoinRoom(id); const [password, setPassword] = useState(""); const [errorMessage, setErrorMessage] = useState(""); diff --git a/features/room/hooks/useJoinRoom.ts b/features/room/hooks/useJoinRoom.ts index 4da7503b..2da0e9e2 100644 --- a/features/room/hooks/useJoinRoom.ts +++ b/features/room/hooks/useJoinRoom.ts @@ -9,7 +9,7 @@ import useUser from "@/hooks/useUser"; import { useToast } from "@/components/shared/Toast"; function useJoinRoom(id: string) { - const { t } = useTranslation("rooms"); + const { t } = useTranslation(); const { fetch } = useRequest(); const { updateRoomId } = useUser(); const toast = useToast(); diff --git a/pages/index.tsx b/pages/index.tsx index 9bd84dec..c806e954 100644 --- a/pages/index.tsx +++ b/pages/index.tsx @@ -86,7 +86,7 @@ export default function Home() { export const getStaticProps: GetStaticProps = async ({ locale }) => { return { props: { - ...(await serverSideTranslations(locale ?? "zh-TW", ["rooms"])), + ...(await serverSideTranslations(locale ?? "zh-TW")), }, }; }; diff --git a/pages/login.tsx b/pages/login.tsx index de926aeb..04e0c1f4 100644 --- a/pages/login.tsx +++ b/pages/login.tsx @@ -107,7 +107,7 @@ export default Login; export const getStaticProps: GetStaticProps = async ({ locale }) => { return { props: { - ...(await serverSideTranslations(locale ?? "zh-TW", ["rooms"])), + ...(await serverSideTranslations(locale ?? "zh-TW")), }, }; }; diff --git a/pages/rooms/index.tsx b/pages/rooms/index.tsx index 4ef2bc59..080981fe 100644 --- a/pages/rooms/index.tsx +++ b/pages/rooms/index.tsx @@ -73,7 +73,7 @@ function TabPaneContent({ tabKey }: Readonly>) { } const Rooms = () => { - const { t } = useTranslation("rooms"); + const { t } = useTranslation(); const tabs: TabItemType[] = [ { @@ -100,7 +100,7 @@ const Rooms = () => { export const getStaticProps: GetStaticProps = async ({ locale }) => { return { props: { - ...(await serverSideTranslations(locale ?? "zh-TW", ["rooms"])), + ...(await serverSideTranslations(locale ?? "zh-TW")), }, }; }; diff --git a/public/locales/zh_TW/common.json b/public/locales/zh_TW/common.json index e69de29b..1d7c88ad 100644 --- a/public/locales/zh_TW/common.json +++ b/public/locales/zh_TW/common.json @@ -0,0 +1,11 @@ +{ + "room_is_full": "房間人數已滿! R003", + "wrong_password": "密碼錯誤", + "you_can_only_join_1_room": "一人只能進入一間房! P003", + "P005": "不在這個房間中 P005", + "rooms_list": "查看房間列表", + "rooms_waiting": "玩家募集中", + "rooms_playing": "進行中", + "enter_game_password": "請輸入遊戲密碼", + "U003": "暱稱已重複" +} diff --git a/public/locales/zh_TW/rooms.json b/public/locales/zh_TW/rooms.json deleted file mode 100644 index 87a64d39..00000000 --- a/public/locales/zh_TW/rooms.json +++ /dev/null @@ -1,9 +0,0 @@ -{ - "room_is_full": "房間人數已滿!", - "wrong_password": "密碼錯誤", - "you_can_only_join_1_room": "一人只能進入一間房!", - "rooms_list": "查看房間列表", - "rooms_waiting": "正在等待玩家配對", - "rooms_playing": "遊戲已開始", - "enter_game_password": "請輸入遊戲密碼" -}