diff --git a/apps/client/public/locales/en/settings.json b/apps/client/public/locales/en/settings.json deleted file mode 100644 index 48e5929a..00000000 --- a/apps/client/public/locales/en/settings.json +++ /dev/null @@ -1,41 +0,0 @@ -{ - "account": { - "My Profile": "My Profile", - "Change photo": "Change photo", - "Name": "Name", - "Your name": "Your name", - "Save": "Save", - "Updated successfully": "Updated successfully", - "Failed to update data": "Failed to update data", - "Email": "Email", - "Change email": "Change email", - "To change your email, you have to enter your password and new email.": "To change your email, you have to enter your password and new email.", - "Password": "Password", - "Enter your password": "Enter your password", - "Enter your new preferred email": "Enter your new preferred email", - "New email": "New email", - "You can change your password here.": "You can change your password here.", - "Change password": "Change password", - "Your password must be a minimum of 8 characters.": "Your password must be a minimum of 8 characters.", - "Current password": "Current password", - "Enter your current password": "Enter your current password", - "New password": "New password", - "Enter your new password": "Enter your new password", - "Password changed successfully": "Password changed successfully" - }, - "preference": { - "Preferences": "Preferences", - "Theme": "Theme", - "Choose your preferred color scheme.": "Choose your preferred color scheme.", - "Select theme": "Select theme", - "Light": "Light", - "Dark": "Dark", - "System settings": "System settings", - "Language": "Language", - "Choose your preferred interface language.": "Choose your preferred interface language.", - "Select language": "Select language", - "Full page width": "Full page width", - "Choose your preferred page width.": "Choose your preferred page width.", - "Toggle full page width": "Toggle full page width" - } -} diff --git a/apps/client/public/locales/en/user.json b/apps/client/public/locales/en/user.json new file mode 100644 index 00000000..f976f75f --- /dev/null +++ b/apps/client/public/locales/en/user.json @@ -0,0 +1,37 @@ +{ + "My Profile": "My Profile", + "Change photo": "Change photo", + "Name": "Name", + "Your name": "Your name", + "Save": "Save", + "Updated successfully": "Updated successfully", + "Failed to update data": "Failed to update data", + "Email": "Email", + "Change email": "Change email", + "To change your email, you have to enter your password and new email.": "To change your email, you have to enter your password and new email.", + "Password": "Password", + "Enter your password": "Enter your password", + "Enter your new preferred email": "Enter your new preferred email", + "New email": "New email", + "You can change your password here.": "You can change your password here.", + "Change password": "Change password", + "Your password must be a minimum of 8 characters.": "Your password must be a minimum of 8 characters.", + "Current password": "Current password", + "Enter your current password": "Enter your current password", + "New password": "New password", + "Enter your new password": "Enter your new password", + "Password changed successfully": "Password changed successfully", + "Preferences": "Preferences", + "Theme": "Theme", + "Choose your preferred color scheme.": "Choose your preferred color scheme.", + "Select theme": "Select theme", + "Light": "Light", + "Dark": "Dark", + "System settings": "System settings", + "Language": "Language", + "Choose your preferred interface language.": "Choose your preferred interface language.", + "Select language": "Select language", + "Full page width": "Full page width", + "Choose your preferred page width.": "Choose your preferred page width.", + "Toggle full page width": "Toggle full page width" +} diff --git a/apps/client/public/locales/zh/settings.json b/apps/client/public/locales/zh/settings.json deleted file mode 100644 index 76a4fbbb..00000000 --- a/apps/client/public/locales/zh/settings.json +++ /dev/null @@ -1,41 +0,0 @@ -{ - "account": { - "My Profile": "我的个人资料", - "Change photo": "更改照片", - "Name": "姓名", - "Your name": "您的姓名", - "Save": "保存", - "Updated successfully": "更新成功", - "Failed to update data": "数据更新失败", - "Email": "电子邮箱", - "Change email": "更改电子邮箱", - "To change your email, you have to enter your password and new email.": "要更改您的电子邮箱,您需要输入密码和新的电子邮箱地址。", - "Password": "密码", - "Enter your password": "输入您的密码", - "Enter your new preferred email": "输入您新的首选电子邮箱", - "New email": "新电子邮箱", - "You can change your password here.": "您可以在这里更改密码。", - "Change password": "更改密码", - "Your password must be a minimum of 8 characters.": "您的密码必须至少包含8个字符。", - "Current password": "当前密码", - "Enter your current password": "输入您的当前密码", - "New password": "新密码", - "Enter your new password": "输入您的新密码", - "Password changed successfully": "密码更改成功" - }, - "preference": { - "Preferences": "偏好设置", - "Theme": "主题", - "Choose your preferred color scheme.": "选择您喜欢的配色方案。", - "Select theme": "选择主题", - "Light": "浅色", - "Dark": "深色", - "System settings": "系统设置", - "Language": "语言", - "Choose your preferred interface language.": "选择您喜欢的界面语言。", - "Select language": "选择语言", - "Full page width": "全页宽度", - "Choose your preferred page width.": "选择您喜欢的页面宽度。", - "Toggle full page width": "切换全页宽度" - } -} diff --git a/apps/client/public/locales/zh/user.json b/apps/client/public/locales/zh/user.json new file mode 100644 index 00000000..a2ea78ce --- /dev/null +++ b/apps/client/public/locales/zh/user.json @@ -0,0 +1,37 @@ +{ + "My Profile": "我的个人资料", + "Change photo": "更改照片", + "Name": "姓名", + "Your name": "您的姓名", + "Save": "保存", + "Updated successfully": "更新成功", + "Failed to update data": "数据更新失败", + "Email": "电子邮箱", + "Change email": "更改电子邮箱", + "To change your email, you have to enter your password and new email.": "要更改您的电子邮箱,您需要输入密码和新的电子邮箱地址。", + "Password": "密码", + "Enter your password": "输入您的密码", + "Enter your new preferred email": "输入您新的首选电子邮箱", + "New email": "新电子邮箱", + "You can change your password here.": "您可以在这里更改密码。", + "Change password": "更改密码", + "Your password must be a minimum of 8 characters.": "您的密码必须至少包含8个字符。", + "Current password": "当前密码", + "Enter your current password": "输入您的当前密码", + "New password": "新密码", + "Enter your new password": "输入您的新密码", + "Password changed successfully": "密码更改成功", + "Preferences": "偏好设置", + "Theme": "主题", + "Choose your preferred color scheme.": "选择您喜欢的配色方案。", + "Select theme": "选择主题", + "Light": "浅色", + "Dark": "深色", + "System settings": "系统设置", + "Language": "语言", + "Choose your preferred interface language.": "选择您喜欢的界面语言。", + "Select language": "选择语言", + "Full page width": "全页宽度", + "Choose your preferred page width.": "选择您喜欢的页面宽度。", + "Toggle full page width": "切换全页宽度" +} diff --git a/apps/client/src/features/user/components/account-avatar.tsx b/apps/client/src/features/user/components/account-avatar.tsx index dad4c345..4fb6964e 100644 --- a/apps/client/src/features/user/components/account-avatar.tsx +++ b/apps/client/src/features/user/components/account-avatar.tsx @@ -10,9 +10,7 @@ import { useTranslation } from "react-i18next"; const userAtom = focusAtom(currentUserAtom, (optic) => optic.prop("user")); export default function AccountAvatar() { - const { t } = useTranslation("settings", { - keyPrefix: "account", - }); + const { t } = useTranslation("user"); const [isLoading, setIsLoading] = useState(false); const [currentUser] = useAtom(currentUserAtom); const [, setUser] = useAtom(userAtom); diff --git a/apps/client/src/features/user/components/account-languate.tsx b/apps/client/src/features/user/components/account-languate.tsx index 673f095c..eb33f870 100644 --- a/apps/client/src/features/user/components/account-languate.tsx +++ b/apps/client/src/features/user/components/account-languate.tsx @@ -2,9 +2,7 @@ import { Group, Text, Select } from "@mantine/core"; import { useTranslation } from "react-i18next"; export default function AccountLanguage() { - const { t } = useTranslation("settings", { - keyPrefix: "preference", - }); + const { t } = useTranslation("user"); return ( @@ -20,9 +18,7 @@ export default function AccountLanguage() { } function LanguageSwitcher() { - const { t, i18n } = useTranslation("settings", { - keyPrefix: "preference", - }); + const { t } = useTranslation("user"); const handleChange = (value: string) => { i18n.changeLanguage(value); diff --git a/apps/client/src/features/user/components/account-name-form.tsx b/apps/client/src/features/user/components/account-name-form.tsx index 613902ea..d39e4c33 100644 --- a/apps/client/src/features/user/components/account-name-form.tsx +++ b/apps/client/src/features/user/components/account-name-form.tsx @@ -19,9 +19,7 @@ type FormValues = z.infer; const userAtom = focusAtom(currentUserAtom, (optic) => optic.prop("user")); export default function AccountNameForm() { - const { t } = useTranslation("settings", { - keyPrefix: "account", - }); + const { t } = useTranslation("user"); const [isLoading, setIsLoading] = useState(false); const [currentUser] = useAtom(currentUserAtom); const [, setUser] = useAtom(userAtom); diff --git a/apps/client/src/features/user/components/account-theme.tsx b/apps/client/src/features/user/components/account-theme.tsx index 7fbd5c2a..d59cfd63 100644 --- a/apps/client/src/features/user/components/account-theme.tsx +++ b/apps/client/src/features/user/components/account-theme.tsx @@ -8,9 +8,7 @@ import { import { useTranslation } from "react-i18next"; export default function AccountTheme() { - const { t } = useTranslation("settings", { - keyPrefix: "preference", - }); + const { t } = useTranslation("user"); return ( @@ -27,10 +25,7 @@ export default function AccountTheme() { } function ThemeSwitcher() { - const { t } = useTranslation("settings", { - keyPrefix: "preference", - }); - + const { t } = useTranslation("user"); const { colorScheme, setColorScheme } = useMantineColorScheme(); const handleChange = (value: MantineColorScheme) => { diff --git a/apps/client/src/features/user/components/change-email.tsx b/apps/client/src/features/user/components/change-email.tsx index 459c959c..726d2464 100644 --- a/apps/client/src/features/user/components/change-email.tsx +++ b/apps/client/src/features/user/components/change-email.tsx @@ -16,9 +16,7 @@ import { useForm, zodResolver } from "@mantine/form"; import { useTranslation } from "react-i18next"; export default function ChangeEmail() { - const { t } = useTranslation("settings", { - keyPrefix: "account", - }); + const { t } = useTranslation("user"); const [currentUser] = useAtom(currentUserAtom); const [opened, { open, close }] = useDisclosure(false); @@ -59,9 +57,7 @@ const formSchema = z.object({ type FormValues = z.infer; function ChangeEmailForm() { - const { t } = useTranslation("settings", { - keyPrefix: "account", - }); + const { t } = useTranslation("user"); const [isLoading, setIsLoading] = useState(false); const form = useForm({ diff --git a/apps/client/src/features/user/components/change-password.tsx b/apps/client/src/features/user/components/change-password.tsx index ee01e933..5639af54 100644 --- a/apps/client/src/features/user/components/change-password.tsx +++ b/apps/client/src/features/user/components/change-password.tsx @@ -9,9 +9,7 @@ import { notifications } from "@mantine/notifications"; import { useTranslation } from "react-i18next"; export default function ChangePassword() { - const { t } = useTranslation("settings", { - keyPrefix: "account", - }); + const { t } = useTranslation("user"); const [opened, { open, close }] = useDisclosure(false); return ( @@ -55,9 +53,7 @@ interface ChangePasswordFormProps { onClose?: () => void; } function ChangePasswordForm({ onClose }: ChangePasswordFormProps) { - const { t } = useTranslation("settings", { - keyPrefix: "account", - }); + const { t } = useTranslation("user"); const [isLoading, setIsLoading] = useState(false); const form = useForm({ diff --git a/apps/client/src/features/user/components/page-width-pref.tsx b/apps/client/src/features/user/components/page-width-pref.tsx index 5bbf4215..d185c1f3 100644 --- a/apps/client/src/features/user/components/page-width-pref.tsx +++ b/apps/client/src/features/user/components/page-width-pref.tsx @@ -6,9 +6,7 @@ import React, { useState } from "react"; import { useTranslation } from "react-i18next"; export default function PageWidthPref() { - const { t } = useTranslation("settings", { - keyPrefix: "preference", - }); + const { t } = useTranslation("user"); return ( @@ -29,9 +27,7 @@ interface PageWidthToggleProps { label?: string; } export function PageWidthToggle({ size, label }: PageWidthToggleProps) { - const { t } = useTranslation("settings", { - keyPrefix: "preference", - }); + const { t } = useTranslation("user"); const [user, setUser] = useAtom(userAtom); const [checked, setChecked] = useState( user.settings?.preferences?.fullPageWidth, diff --git a/apps/client/src/pages/settings/account/account-preferences.tsx b/apps/client/src/pages/settings/account/account-preferences.tsx index 753938b0..01d4aa36 100644 --- a/apps/client/src/pages/settings/account/account-preferences.tsx +++ b/apps/client/src/pages/settings/account/account-preferences.tsx @@ -6,9 +6,7 @@ import { Divider } from "@mantine/core"; import { useTranslation } from "react-i18next"; export default function AccountPreferences() { - const { t } = useTranslation("settings", { - keyPrefix: "preference", - }); + const { t } = useTranslation("user"); return ( <> diff --git a/apps/client/src/pages/settings/account/account-settings.tsx b/apps/client/src/pages/settings/account/account-settings.tsx index 9d1a3d29..9b3f03fe 100644 --- a/apps/client/src/pages/settings/account/account-settings.tsx +++ b/apps/client/src/pages/settings/account/account-settings.tsx @@ -7,9 +7,7 @@ import SettingsTitle from "@/components/settings/settings-title.tsx"; import { useTranslation } from "react-i18next"; export default function AccountSettings() { - const { t } = useTranslation("settings", { - keyPrefix: "account", - }); + const { t } = useTranslation("user"); return ( <>