37 changed files with 922 additions and 268 deletions
@ -0,0 +1,44 @@ |
|||||
|
import { Button, Text } from "@chakra-ui/react"; |
||||
|
import { useTranslation } from "react-i18next"; |
||||
|
import { FiGlobe } from "react-icons/fi"; |
||||
|
import { MenuContent, MenuItem, MenuRoot, MenuTrigger } from "../ui/menu"; |
||||
|
|
||||
|
const LanguageSwitcher = () => { |
||||
|
const { i18n, t } = useTranslation(); |
||||
|
|
||||
|
const changeLanguage = (lng: string) => { |
||||
|
i18n.changeLanguage(lng); |
||||
|
}; |
||||
|
|
||||
|
const currentLanguage = |
||||
|
i18n.language === "zh" ? t("language.chinese") : t("language.english"); |
||||
|
|
||||
|
return ( |
||||
|
<MenuRoot> |
||||
|
<MenuTrigger asChild> |
||||
|
<Button variant="ghost" size="sm" gap={2}> |
||||
|
<FiGlobe /> |
||||
|
<Text fontSize="sm">{currentLanguage}</Text> |
||||
|
</Button> |
||||
|
</MenuTrigger> |
||||
|
<MenuContent> |
||||
|
<MenuItem |
||||
|
value="en" |
||||
|
onClick={() => changeLanguage("en")} |
||||
|
style={{ cursor: "pointer" }} |
||||
|
> |
||||
|
{t("language.english")} |
||||
|
</MenuItem> |
||||
|
<MenuItem |
||||
|
value="zh" |
||||
|
onClick={() => changeLanguage("zh")} |
||||
|
style={{ cursor: "pointer" }} |
||||
|
> |
||||
|
{t("language.chinese")} |
||||
|
</MenuItem> |
||||
|
</MenuContent> |
||||
|
</MenuRoot> |
||||
|
); |
||||
|
}; |
||||
|
|
||||
|
export default LanguageSwitcher; |
@ -1,35 +1,40 @@ |
|||||
import { Table } from "@chakra-ui/react" |
import { Table } from "@chakra-ui/react" |
||||
|
import { useTranslation } from "react-i18next" |
||||
import { SkeletonText } from "../ui/skeleton" |
import { SkeletonText } from "../ui/skeleton" |
||||
|
|
||||
const PendingItems = () => ( |
const PendingItems = () => { |
||||
<Table.Root size={{ base: "sm", md: "md" }}> |
const { t } = useTranslation() |
||||
<Table.Header> |
|
||||
<Table.Row> |
return ( |
||||
<Table.ColumnHeader w="sm">ID</Table.ColumnHeader> |
<Table.Root size={{ base: "sm", md: "md" }}> |
||||
<Table.ColumnHeader w="sm">Title</Table.ColumnHeader> |
<Table.Header> |
||||
<Table.ColumnHeader w="sm">Description</Table.ColumnHeader> |
<Table.Row> |
||||
<Table.ColumnHeader w="sm">Actions</Table.ColumnHeader> |
<Table.ColumnHeader w="sm">{t("common.id")}</Table.ColumnHeader> |
||||
</Table.Row> |
<Table.ColumnHeader w="sm">{t("common.title")}</Table.ColumnHeader> |
||||
</Table.Header> |
<Table.ColumnHeader w="sm">{t("common.description")}</Table.ColumnHeader> |
||||
<Table.Body> |
<Table.ColumnHeader w="sm">{t("common.actions")}</Table.ColumnHeader> |
||||
{[...Array(5)].map((_, index) => ( |
|
||||
<Table.Row key={index}> |
|
||||
<Table.Cell> |
|
||||
<SkeletonText noOfLines={1} /> |
|
||||
</Table.Cell> |
|
||||
<Table.Cell> |
|
||||
<SkeletonText noOfLines={1} /> |
|
||||
</Table.Cell> |
|
||||
<Table.Cell> |
|
||||
<SkeletonText noOfLines={1} /> |
|
||||
</Table.Cell> |
|
||||
<Table.Cell> |
|
||||
<SkeletonText noOfLines={1} /> |
|
||||
</Table.Cell> |
|
||||
</Table.Row> |
</Table.Row> |
||||
))} |
</Table.Header> |
||||
</Table.Body> |
<Table.Body> |
||||
</Table.Root> |
{[...Array(5)].map((_, index) => ( |
||||
) |
<Table.Row key={index}> |
||||
|
<Table.Cell> |
||||
|
<SkeletonText noOfLines={1} /> |
||||
|
</Table.Cell> |
||||
|
<Table.Cell> |
||||
|
<SkeletonText noOfLines={1} /> |
||||
|
</Table.Cell> |
||||
|
<Table.Cell> |
||||
|
<SkeletonText noOfLines={1} /> |
||||
|
</Table.Cell> |
||||
|
<Table.Cell> |
||||
|
<SkeletonText noOfLines={1} /> |
||||
|
</Table.Cell> |
||||
|
</Table.Row> |
||||
|
))} |
||||
|
</Table.Body> |
||||
|
</Table.Root> |
||||
|
) |
||||
|
} |
||||
|
|
||||
export default PendingItems |
export default PendingItems |
||||
|
@ -0,0 +1,35 @@ |
|||||
|
import i18n from 'i18next' |
||||
|
import { initReactI18next } from 'react-i18next' |
||||
|
import LanguageDetector from 'i18next-browser-languagedetector' |
||||
|
|
||||
|
import en from './locales/en.json' |
||||
|
import zh from './locales/zh.json' |
||||
|
|
||||
|
const resources = { |
||||
|
en: { |
||||
|
translation: en |
||||
|
}, |
||||
|
zh: { |
||||
|
translation: zh |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
i18n |
||||
|
.use(LanguageDetector) |
||||
|
.use(initReactI18next) |
||||
|
.init({ |
||||
|
resources, |
||||
|
fallbackLng: 'en', |
||||
|
debug: false, |
||||
|
|
||||
|
interpolation: { |
||||
|
escapeValue: false |
||||
|
}, |
||||
|
|
||||
|
detection: { |
||||
|
order: ['localStorage', 'navigator', 'htmlTag'], |
||||
|
caches: ['localStorage'] |
||||
|
} |
||||
|
}) |
||||
|
|
||||
|
export default i18n |
@ -0,0 +1,193 @@ |
|||||
|
{ |
||||
|
"dashboard": { |
||||
|
"greeting": "Hi, {{name}} 👋🏼", |
||||
|
"welcomeBack": "Welcome back, nice to see you again!" |
||||
|
}, |
||||
|
"common": { |
||||
|
"save": "Save", |
||||
|
"cancel": "Cancel", |
||||
|
"delete": "Delete", |
||||
|
"edit": "Edit", |
||||
|
"add": "Add", |
||||
|
"create": "Create", |
||||
|
"update": "Update", |
||||
|
"confirm": "Confirm", |
||||
|
"back": "Back", |
||||
|
"next": "Next", |
||||
|
"previous": "Previous", |
||||
|
"submit": "Submit", |
||||
|
"reset": "Reset", |
||||
|
"search": "Search", |
||||
|
"filter": "Filter", |
||||
|
"sort": "Sort", |
||||
|
"loading": "Loading...", |
||||
|
"error": "Error", |
||||
|
"success": "Success", |
||||
|
"warning": "Warning", |
||||
|
"info": "Info", |
||||
|
"yes": "Yes", |
||||
|
"no": "No", |
||||
|
"ok": "OK", |
||||
|
"close": "Close", |
||||
|
"logo": "Logo", |
||||
|
"actions": "Actions", |
||||
|
"continue": "Continue", |
||||
|
"id": "ID", |
||||
|
"notAvailable": "N/A", |
||||
|
"title": "Title", |
||||
|
"description": "Description" |
||||
|
}, |
||||
|
"navigation": { |
||||
|
"dashboard": "Dashboard", |
||||
|
"items": "Items", |
||||
|
"userSettings": "User Settings", |
||||
|
"admin": "Admin", |
||||
|
"menu": "Menu", |
||||
|
"logout": "Log Out", |
||||
|
"login": "Login", |
||||
|
"signup": "Sign Up" |
||||
|
}, |
||||
|
"auth": { |
||||
|
"login": "Login", |
||||
|
"signup": "Sign Up", |
||||
|
"logout": "Log Out", |
||||
|
"email": "Email", |
||||
|
"password": "Password", |
||||
|
"confirmPassword": "Confirm Password", |
||||
|
"fullName": "Full Name", |
||||
|
"forgotPassword": "Forgot Password?", |
||||
|
"rememberMe": "Remember me", |
||||
|
"dontHaveAccount": "Don't have an account?", |
||||
|
"alreadyHaveAccount": "Already have an account?", |
||||
|
"signUpHere": "Sign up here", |
||||
|
"loginHere": "Login here", |
||||
|
"passwordRecovery": "Password Recovery", |
||||
|
"resetPassword": "Reset Password", |
||||
|
"newPassword": "New Password", |
||||
|
"currentPassword": "Current Password", |
||||
|
"passwordRecoveryText": "A password recovery email will be sent to the registered account.", |
||||
|
"resetPasswordText": "Please enter your new password and confirm it to reset your password.", |
||||
|
"logIn": "Log In", |
||||
|
"noAccount": "Don't have an account?", |
||||
|
"signUp": "Sign Up", |
||||
|
"haveAccount": "Already have an account?", |
||||
|
"passwordRecoveryDescription": "A password recovery email will be sent to the registered account.", |
||||
|
"passwordRecoveryEmailSent": "Password recovery email sent successfully.", |
||||
|
"resetPasswordDescription": "Please enter your new password and confirm it to reset your password.", |
||||
|
"passwordUpdatedSuccessfully": "Password updated successfully.", |
||||
|
"signupLink": "Don't have an account? Sign up", |
||||
|
"loginLink": "Already have an account? Log in", |
||||
|
"recoverPassword": "Recover Password", |
||||
|
"loginSuccess": "Login successful", |
||||
|
"logoutSuccess": "Logout successful", |
||||
|
"signupSuccess": "Signup successful", |
||||
|
"passwordResetSuccess": "Password reset successful", |
||||
|
"invalidCredentials": "Invalid username or password", |
||||
|
"accountNotFound": "Account not found", |
||||
|
"emailSent": "Email sent", |
||||
|
"tokenExpired": "Token expired", |
||||
|
"passwordMismatch": "Passwords do not match", |
||||
|
"togglePasswordVisibility": "Toggle password visibility", |
||||
|
"passwordStrengthLow": "Low", |
||||
|
"passwordStrengthMedium": "Medium", |
||||
|
"passwordStrengthHigh": "High" |
||||
|
}, |
||||
|
"user": { |
||||
|
"profile": "My profile", |
||||
|
"userInformation": "User Information", |
||||
|
"userSettings": "User Settings", |
||||
|
"changePassword": "Change Password", |
||||
|
"deleteAccount": "Danger zone", |
||||
|
"appearance": "Appearance", |
||||
|
"fullName": "Full Name", |
||||
|
"email": "Email", |
||||
|
"isSuperuser": "Is superuser?", |
||||
|
"isActive": "Is active?", |
||||
|
"addUser": "Add User", |
||||
|
"editUser": "Edit User", |
||||
|
"deleteUser": "Delete User", |
||||
|
"setPassword": "Set Password", |
||||
|
"users": "Users", |
||||
|
"usersManagement": "Users Management", |
||||
|
"role": "Role", |
||||
|
"status": "Status", |
||||
|
"you": "You", |
||||
|
"superuser": "Superuser", |
||||
|
"user": "User", |
||||
|
"active": "Active", |
||||
|
"inactive": "Inactive" |
||||
|
}, |
||||
|
"items": { |
||||
|
"items": "Items", |
||||
|
"addItem": "Add Item", |
||||
|
"editItem": "Edit Item", |
||||
|
"deleteItem": "Delete Item", |
||||
|
"title": "Title", |
||||
|
"description": "Description", |
||||
|
"id": "ID", |
||||
|
"owner": "Owner", |
||||
|
"noItems": "No items found", |
||||
|
"itemDetails": "Item Details", |
||||
|
"itemsManagement": "Items Management", |
||||
|
"noItemsYet": "You don't have any items yet", |
||||
|
"addNewItemToStart": "Add a new item to get started" |
||||
|
}, |
||||
|
"forms": { |
||||
|
"required": "This field is required", |
||||
|
"emailRequired": "Email is required", |
||||
|
"passwordRequired": "Password is required", |
||||
|
"titleRequired": "Title is required", |
||||
|
"emailInvalid": "Please enter a valid email address", |
||||
|
"passwordMinLength": "Password must be at least 8 characters", |
||||
|
"passwordsDoNotMatch": "The passwords do not match", |
||||
|
"pleaseConfirmPassword": "Please confirm your password", |
||||
|
"fillDetails": "Fill in the details to add a new item.", |
||||
|
"updateDetails": "Update the item details below.", |
||||
|
"fillUserDetails": "Fill in the form below to add a new user to the system.", |
||||
|
"updateUserDetails": "Update the user details below.", |
||||
|
"usernameRequired": "Username is required", |
||||
|
"fullNameRequired": "Full Name is required" |
||||
|
}, |
||||
|
"messages": { |
||||
|
"success": { |
||||
|
"itemCreated": "Item created successfully.", |
||||
|
"itemUpdated": "Item updated successfully.", |
||||
|
"itemDeleted": "The item was deleted successfully", |
||||
|
"userCreated": "User created successfully.", |
||||
|
"userUpdated": "User updated successfully.", |
||||
|
"userDeleted": "The user was deleted successfully", |
||||
|
"passwordUpdated": "Password updated successfully.", |
||||
|
"accountDeleted": "Your account has been successfully deleted", |
||||
|
"passwordRecoveryEmailSent": "Password recovery email sent successfully." |
||||
|
}, |
||||
|
"error": { |
||||
|
"itemDeleteError": "An error occurred while deleting the item", |
||||
|
"userDeleteError": "An error occurred while deleting the user", |
||||
|
"generalError": "An error occurred. Please try again.", |
||||
|
"somethingWentWrong": "Something went wrong" |
||||
|
}, |
||||
|
"confirmation": { |
||||
|
"deleteItem": "This item will be permanently deleted. Are you sure? You will not be able to undo this action.", |
||||
|
"deleteUser": "All items associated with this user will also be permanently deleted. Are you sure? You will not be able to undo this action.", |
||||
|
"deleteAccount": "All your account data will be permanently deleted. If you are sure, please click \"Confirm\" to proceed. This action cannot be undone.", |
||||
|
"confirmationRequired": "Confirmation Required" |
||||
|
} |
||||
|
}, |
||||
|
"notFound": { |
||||
|
"title": "404", |
||||
|
"subtitle": "Page Not Found", |
||||
|
"description": "The page you are looking for does not exist.", |
||||
|
"goHome": "Go Home" |
||||
|
}, |
||||
|
"language": { |
||||
|
"switchLanguage": "Switch Language", |
||||
|
"english": "English", |
||||
|
"chinese": "中文" |
||||
|
}, |
||||
|
"theme": { |
||||
|
"light": "Light", |
||||
|
"dark": "Dark", |
||||
|
"system": "System", |
||||
|
"toggleColorMode": "Toggle color mode" |
||||
|
} |
||||
|
} |
@ -0,0 +1,199 @@ |
|||||
|
{ |
||||
|
"dashboard": { |
||||
|
"greeting": "您好,{{name}} 👋🏼", |
||||
|
"welcomeBack": "欢迎回来,很高兴再次见到您!" |
||||
|
}, |
||||
|
"common": { |
||||
|
"save": "保存", |
||||
|
"cancel": "取消", |
||||
|
"delete": "删除", |
||||
|
"edit": "编辑", |
||||
|
"add": "添加", |
||||
|
"create": "创建", |
||||
|
"update": "更新", |
||||
|
"confirm": "确认", |
||||
|
"close": "关闭", |
||||
|
"loading": "加载中...", |
||||
|
"search": "搜索", |
||||
|
"filter": "筛选", |
||||
|
"sort": "排序", |
||||
|
"actions": "操作", |
||||
|
"yes": "是", |
||||
|
"no": "否", |
||||
|
"ok": "确定", |
||||
|
"continue": "继续", |
||||
|
"back": "返回", |
||||
|
"next": "下一步", |
||||
|
"previous": "上一步", |
||||
|
"submit": "提交", |
||||
|
"reset": "重置", |
||||
|
"id": "ID", |
||||
|
"notAvailable": "不可用", |
||||
|
"success": "成功!", |
||||
|
"error": "出现错误!", |
||||
|
"warning": "警告", |
||||
|
"info": "信息", |
||||
|
"title": "标题", |
||||
|
"description": "描述", |
||||
|
"logo": "标志" |
||||
|
}, |
||||
|
"navigation": { |
||||
|
"dashboard": "仪表板", |
||||
|
"items": "项目", |
||||
|
"userSettings": "用户设置", |
||||
|
"admin": "管理员", |
||||
|
"settings": "设置", |
||||
|
"userManagement": "用户管理", |
||||
|
"menu": "菜单", |
||||
|
"logout": "退出登录", |
||||
|
"login": "登录", |
||||
|
"signup": "注册" |
||||
|
}, |
||||
|
"auth": { |
||||
|
"login": "登录", |
||||
|
"signup": "注册", |
||||
|
"logout": "退出登录", |
||||
|
"signupLink": "还没有账户?注册", |
||||
|
"loginLink": "已有账户?登录", |
||||
|
"email": "邮箱", |
||||
|
"password": "密码", |
||||
|
"confirmPassword": "确认密码", |
||||
|
"fullName": "全名", |
||||
|
"forgotPassword": "忘记密码?", |
||||
|
"resetPassword": "重置密码", |
||||
|
"recoverPassword": "找回密码", |
||||
|
"newPassword": "新密码", |
||||
|
"currentPassword": "当前密码", |
||||
|
"rememberMe": "记住我", |
||||
|
"loginSuccess": "登录成功", |
||||
|
"logoutSuccess": "退出成功", |
||||
|
"signupSuccess": "注册成功", |
||||
|
"passwordResetSuccess": "密码重置成功", |
||||
|
"invalidCredentials": "用户名或密码错误", |
||||
|
"accountNotFound": "账户不存在", |
||||
|
"emailSent": "邮件已发送", |
||||
|
"tokenExpired": "令牌已过期", |
||||
|
"passwordMismatch": "密码不匹配", |
||||
|
"togglePasswordVisibility": "切换密码可见性", |
||||
|
"passwordStrengthLow": "弱", |
||||
|
"passwordStrengthMedium": "中", |
||||
|
"passwordStrengthHigh": "强", |
||||
|
"dontHaveAccount": "还没有账户?", |
||||
|
"alreadyHaveAccount": "已有账户?", |
||||
|
"signUpHere": "在此注册", |
||||
|
"loginHere": "在此登录", |
||||
|
"passwordRecovery": "密码恢复", |
||||
|
"passwordRecoveryDescription": "密码恢复邮件将发送到注册的账户。", |
||||
|
"passwordRecoveryText": "密码恢复邮件将发送到注册的账户。", |
||||
|
"resetPasswordDescription": "请输入您的新密码并确认以重置密码。", |
||||
|
"resetPasswordText": "请输入您的新密码并确认以重置密码。", |
||||
|
"logIn": "登录", |
||||
|
"noAccount": "还没有账户?", |
||||
|
"signUp": "注册", |
||||
|
"haveAccount": "已有账户?", |
||||
|
"passwordRecoveryEmailSent": "密码恢复邮件发送成功。", |
||||
|
"passwordUpdatedSuccessfully": "密码更新成功。" |
||||
|
}, |
||||
|
"user": { |
||||
|
"profile": "我的资料", |
||||
|
"userInformation": "用户信息", |
||||
|
"userSettings": "用户设置", |
||||
|
"changePassword": "修改密码", |
||||
|
"deleteAccount": "危险区域", |
||||
|
"appearance": "外观", |
||||
|
"fullName": "全名", |
||||
|
"email": "邮箱", |
||||
|
"isSuperuser": "是超级用户?", |
||||
|
"isActive": "是否活跃?", |
||||
|
"addUser": "添加用户", |
||||
|
"editUser": "编辑用户", |
||||
|
"deleteUser": "删除用户", |
||||
|
"setPassword": "设置密码", |
||||
|
"users": "用户", |
||||
|
"usersManagement": "用户管理", |
||||
|
"role": "角色", |
||||
|
"status": "状态", |
||||
|
"you": "您", |
||||
|
"superuser": "超级用户", |
||||
|
"user": "用户", |
||||
|
"active": "活跃", |
||||
|
"inactive": "非活跃" |
||||
|
}, |
||||
|
"items": { |
||||
|
"items": "项目", |
||||
|
"addItem": "添加项目", |
||||
|
"createItem": "创建项目", |
||||
|
"editItem": "编辑项目", |
||||
|
"deleteItem": "删除项目", |
||||
|
"itemCreated": "项目创建成功", |
||||
|
"itemUpdated": "项目更新成功", |
||||
|
"itemDeleted": "项目删除成功", |
||||
|
"title": "标题", |
||||
|
"description": "描述", |
||||
|
"id": "ID", |
||||
|
"owner": "所有者", |
||||
|
"noItems": "没有项目", |
||||
|
"itemDetails": "项目详情", |
||||
|
"itemsManagement": "项目管理", |
||||
|
"noItemsYet": "您还没有任何项目", |
||||
|
"addNewItemToStart": "添加新项目开始使用" |
||||
|
}, |
||||
|
"forms": { |
||||
|
"required": "必填", |
||||
|
"usernameRequired": "用户名是必需的", |
||||
|
"emailRequired": "邮箱为必填项", |
||||
|
"emailInvalid": "邮箱格式无效", |
||||
|
"passwordRequired": "密码为必填项", |
||||
|
"passwordMinLength": "密码至少需要8个字符", |
||||
|
"fullNameRequired": "全名为必填项", |
||||
|
"passwordsDoNotMatch": "密码不匹配", |
||||
|
"pleaseConfirmPassword": "请确认密码", |
||||
|
"fillDetails": "请填写详细信息", |
||||
|
"updateDetails": "更新详细信息", |
||||
|
"fillUserDetails": "请填写用户详细信息", |
||||
|
"updateUserDetails": "更新用户详细信息", |
||||
|
"titleRequired": "标题为必填项" |
||||
|
}, |
||||
|
"messages": { |
||||
|
"success": { |
||||
|
"itemCreated": "项目创建成功。", |
||||
|
"itemUpdated": "项目更新成功。", |
||||
|
"itemDeleted": "项目删除成功", |
||||
|
"userCreated": "用户创建成功。", |
||||
|
"userUpdated": "用户更新成功。", |
||||
|
"userDeleted": "用户删除成功", |
||||
|
"passwordUpdated": "密码更新成功。", |
||||
|
"accountDeleted": "您的账户已成功删除", |
||||
|
"passwordRecoveryEmailSent": "密码恢复邮件发送成功。" |
||||
|
}, |
||||
|
"error": { |
||||
|
"itemDeleteError": "删除项目时发生错误", |
||||
|
"userDeleteError": "删除用户时发生错误", |
||||
|
"generalError": "发生错误,请重试。", |
||||
|
"somethingWentWrong": "出现了一些问题" |
||||
|
}, |
||||
|
"confirmation": { |
||||
|
"deleteItem": "此项目将被永久删除。您确定吗?此操作无法撤销。", |
||||
|
"deleteUser": "与此用户关联的所有项目也将被永久删除。您确定吗?此操作无法撤销。", |
||||
|
"deleteAccount": "您的所有账户数据将被永久删除。如果您确定,请点击确认继续。此操作无法撤销。", |
||||
|
"confirmationRequired": "需要确认" |
||||
|
} |
||||
|
}, |
||||
|
"notFound": { |
||||
|
"title": "404", |
||||
|
"subtitle": "页面未找到", |
||||
|
"description": "您要查找的页面不存在。", |
||||
|
"goHome": "返回首页" |
||||
|
}, |
||||
|
"language": { |
||||
|
"switchLanguage": "切换语言", |
||||
|
"english": "English", |
||||
|
"chinese": "中文" |
||||
|
}, |
||||
|
"theme": { |
||||
|
"light": "浅色", |
||||
|
"dark": "深色", |
||||
|
"system": "跟随系统", |
||||
|
"toggleColorMode": "切换颜色模式" |
||||
|
} |
||||
|
} |
Loading…
Reference in new issue