Skip to content

Commit

Permalink
chore: i18n
Browse files Browse the repository at this point in the history
  • Loading branch information
JohnsonMao committed Nov 2, 2024
1 parent 6d3db27 commit ed44add
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
4 changes: 3 additions & 1 deletion features/room/components/CreateRoomForm/CreateRoomForm.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { useState, FormEvent, useRef, useEffect } from "react";
import { useRouter } from "next/router";
import { useTranslation } from "react-i18next";
import useRequest from "@/hooks/useRequest";
import Button from "@/components/shared/Button/v2";
import Input from "@/components/shared/Input";
Expand Down Expand Up @@ -55,6 +56,7 @@ function CreateRoomForm({
});
const { fetch } = useRequest();
const router = useRouter();
const { t } = useTranslation("rooms");
const [isLockRoom, setIsLockRoom] = useState(false);
const passwordInputRef = useRef<InputOTPRef>(null);
const gameNameInputRef = useRef<HTMLInputElement>(null);
Expand All @@ -77,7 +79,7 @@ function CreateRoomForm({

if (isLockRoom && roomForm.password?.length !== 4) {
passwordInputRef.current?.focus();
newErrors.password = "請輸入遊戲密碼";
newErrors.password = t("enter_game_password");
}
if (!roomForm.name) {
gameNameInputRef.current?.focus();
Expand Down
3 changes: 2 additions & 1 deletion public/locales/zh_TW/rooms.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,6 @@
"you_can_only_join_1_room": "一人只能進入一間房!",
"rooms_list": "查看房間列表",
"rooms_waiting": "正在等待玩家配對",
"rooms_playing": "遊戲已開始"
"rooms_playing": "遊戲已開始",
"enter_game_password": "請輸入遊戲密碼"
}

0 comments on commit ed44add

Please sign in to comment.