Skip to content

Commit

Permalink
chore: i18n
Browse files Browse the repository at this point in the history
  • Loading branch information
JohnsonMao committed Nov 17, 2024
1 parent effe685 commit 7d9e17d
Show file tree
Hide file tree
Showing 8 changed files with 18 additions and 16 deletions.
2 changes: 1 addition & 1 deletion features/room/components/CreateRoomForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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<InputOTPRef>(null);
const gameNameInputRef = useRef<HTMLInputElement>(null);
Expand Down
2 changes: 1 addition & 1 deletion features/room/components/JoinLockRoomForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ interface JoinLockRoomFormProps extends PropsWithChildren {
}

function JoinLockRoomForm({ id, children }: Readonly<JoinLockRoomFormProps>) {
const { t } = useTranslation("rooms");
const { t } = useTranslation();
const { handleJoinRoom } = useJoinRoom(id);
const [password, setPassword] = useState("");
const [errorMessage, setErrorMessage] = useState("");
Expand Down
2 changes: 1 addition & 1 deletion features/room/hooks/useJoinRoom.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
2 changes: 1 addition & 1 deletion pages/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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")),
},
};
};
2 changes: 1 addition & 1 deletion pages/login.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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")),
},
};
};
4 changes: 2 additions & 2 deletions pages/rooms/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ function TabPaneContent({ tabKey }: Readonly<TabItemType<RoomType>>) {
}

const Rooms = () => {
const { t } = useTranslation("rooms");
const { t } = useTranslation();

const tabs: TabItemType<RoomType>[] = [
{
Expand All @@ -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")),
},
};
};
Expand Down
11 changes: 11 additions & 0 deletions public/locales/zh_TW/common.json
Original file line number Diff line number Diff line change
@@ -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": "暱稱已重複"
}
9 changes: 0 additions & 9 deletions public/locales/zh_TW/rooms.json

This file was deleted.

0 comments on commit 7d9e17d

Please sign in to comment.