feat: update user translation

This commit is contained in:
lleohao
2024-09-03 03:11:35 +00:00
parent eea185c87b
commit a5cc03bcff
13 changed files with 88 additions and 125 deletions

View File

@ -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"
}
}

View File

@ -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"
}

View File

@ -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": "切换全页宽度"
}
}

View File

@ -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": "切换全页宽度"
}

View File

@ -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);

View File

@ -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 (
<Group justify="space-between" wrap="nowrap" gap="xl">
@ -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);

View File

@ -19,9 +19,7 @@ type FormValues = z.infer<typeof formSchema>;
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);

View File

@ -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 (
<Group justify="space-between" wrap="nowrap" gap="xl">
@ -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) => {

View File

@ -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<typeof formSchema>;
function ChangeEmailForm() {
const { t } = useTranslation("settings", {
keyPrefix: "account",
});
const { t } = useTranslation("user");
const [isLoading, setIsLoading] = useState(false);
const form = useForm<FormValues>({

View File

@ -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<FormValues>({

View File

@ -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 (
<Group justify="space-between" wrap="nowrap" gap="xl">
@ -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,

View File

@ -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 (
<>

View File

@ -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 (
<>