diff --git a/apps/basic/lingui.config.ts b/apps/basic/lingui.config.ts deleted file mode 100644 index 5f2cdfe..0000000 --- a/apps/basic/lingui.config.ts +++ /dev/null @@ -1,13 +0,0 @@ -const config = { - locales: ["en", "zh"], - sourceLocale: "en", - catalogs: [ - { - path: "src/locales/{locale}/messages", - include: ["src"], - }, - ], - format: "po", -}; - -export default config; diff --git a/apps/basic/src/components/DataTable/DataTableEmpty.tsx b/apps/basic/src/components/DataTable/DataTableEmpty.tsx index 029e2f3..dc47998 100644 --- a/apps/basic/src/components/DataTable/DataTableEmpty.tsx +++ b/apps/basic/src/components/DataTable/DataTableEmpty.tsx @@ -1,5 +1,4 @@ import { Flex, theme } from "antd"; -import { useLingui } from "@lingui/react/macro"; import { BarChart3 } from "lucide-react"; import type { ReactElement } from "react"; @@ -7,7 +6,6 @@ import type { ReactElement } from "react"; * Table empty state: icon in soft tile + bold title + secondary description (dashboard-style). */ export function DataTableEmpty(): ReactElement { - const { t } = useLingui(); const { token } = theme.useToken(); return ( @@ -46,7 +44,7 @@ export function DataTableEmpty(): ReactElement { lineHeight: token.lineHeightLG, }} > - {t`No data`} + No data - {t`Nothing to show in this list yet`} + Nothing to show in this list yet diff --git a/apps/basic/src/components/Layout/AppFooter/index.tsx b/apps/basic/src/components/Layout/AppFooter/index.tsx index 9670f33..fa400cd 100644 --- a/apps/basic/src/components/Layout/AppFooter/index.tsx +++ b/apps/basic/src/components/Layout/AppFooter/index.tsx @@ -1,12 +1,10 @@ import { Flex, Typography, theme } from "antd"; -import { useLingui } from "@lingui/react/macro"; import { GitHub } from "@/components/Icon"; const ANTD_ADMIN_REPO = "https://github.com/zuiidea/antd-admin"; export function AppFooter() { const { token } = theme.useToken(); - const { t } = useLingui(); const iconSize = Math.max(12, Math.round(Number(token.fontSizeSM))); return ( @@ -20,7 +18,7 @@ export function AppFooter() { }} > - {t`Powered by`} + Powered by s.toggleSidebar); const toggleDarkMode = useSettingsStore((s) => s.toggleDarkMode); - const locale = useSettingsStore((s) => s.locale); - const setLocale = useSettingsStore((s) => s.setLocale); const location = useLocation(); const matches = useMatches(); - const { t } = useLingui(); const { token } = theme.useToken(); const screens = Grid.useBreakpoint(); const isMobile = !screens.lg; @@ -74,14 +70,7 @@ export function Header({ showBreadcrumb: showBreadcrumbProp = true }: HeaderProp const leafIcon: LucideIcon = firstSegmentPath === "/users" ? Users : firstSegmentPath === "/403" ? ShieldAlert : Home; - const leafLabel = - leafLabelKey === "Dashboard" - ? t`Dashboard` - : leafLabelKey === "Users" - ? t`Users` - : leafLabelKey === "403" - ? t`403` - : leafLabelKey; + const leafLabel = leafLabelKey; const breadcrumbItems: ItemType[] = []; @@ -89,11 +78,11 @@ export function Header({ showBreadcrumb: showBreadcrumbProp = true }: HeaderProp if (onDashboard) { breadcrumbItems.push({ - title: crumb(Home, t`Dashboard`), + title: crumb(Home, "Dashboard"), }); } else { breadcrumbItems.push({ - title: crumb(Home, t`Dashboard`, "/dashboard"), + title: crumb(Home, "Dashboard", "/dashboard"), }); breadcrumbItems.push({ @@ -113,11 +102,6 @@ export function Header({ showBreadcrumb: showBreadcrumbProp = true }: HeaderProp const showBreadcrumb = showBreadcrumbProp && !hideBreadcrumbFromRoute && breadcrumbItems.length > 0; - const toggleLocale = () => { - const next: Locale = locale === "en" ? "zh" : "en"; - setLocale(next); - }; - return ( } - aria-label={t`Toggle sidebar`} + aria-label="Toggle sidebar" /> ) : null} {showBreadcrumb ? ( @@ -146,17 +130,11 @@ export function Header({ showBreadcrumb: showBreadcrumbProp = true }: HeaderProp ) : null} - } diff --git a/apps/basic/src/lingui.d.ts b/apps/basic/src/lingui.d.ts deleted file mode 100644 index cbfe464..0000000 --- a/apps/basic/src/lingui.d.ts +++ /dev/null @@ -1,4 +0,0 @@ -declare module "*.po" { - import type { Messages } from "@lingui/core"; - export const messages: Messages; -} diff --git a/apps/basic/src/locales/en/messages.po b/apps/basic/src/locales/en/messages.po deleted file mode 100644 index 886db19..0000000 --- a/apps/basic/src/locales/en/messages.po +++ /dev/null @@ -1,317 +0,0 @@ -msgid "" -msgstr "" -"POT-Creation-Date: 2026-04-07 15:30+0800\n" -"MIME-Version: 1.0\n" -"Content-Type: text/plain; charset=utf-8\n" -"Content-Transfer-Encoding: 8bit\n" -"X-Generator: @lingui/cli\n" -"Language: en\n" -"Project-Id-Version: \n" -"Report-Msgid-Bugs-To: \n" -"PO-Revision-Date: \n" -"Last-Translator: \n" -"Language-Team: \n" -"Plural-Forms: \n" - -#: src/routes/_auth/users/index.tsx:464 -#~ msgid "{n} rows" -#~ msgstr "{n} rows" - -#: src/routes/_auth/users/index.tsx:386 -msgid "{total} rows" -msgstr "{total} rows" - -#: src/routes/_auth/dashboard/index.tsx:35 -msgid "+180.1% from last month" -msgstr "+180.1% from last month" - -#: src/routes/_auth/dashboard/index.tsx:41 -msgid "+19% from last month" -msgstr "+19% from last month" - -#: src/routes/_auth/dashboard/index.tsx:29 -msgid "+20.1% from last month" -msgstr "+20.1% from last month" - -#: src/routes/_auth/dashboard/index.tsx:47 -msgid "+201 since last hour" -msgstr "+201 since last hour" - -#: src/components/Layout/Header/index.tsx:78 -msgid "403" -msgstr "403" - -#: src/routes/_auth/dashboard/index.tsx:45 -msgid "Active Now" -msgstr "Active Now" - -#: src/routes/_auth/users/-FormModal.tsx:58 -#: src/routes/_auth/users/-Toolbar.tsx:64 -msgid "Admin" -msgstr "Admin" - -#: src/routes/_auth/users/index.tsx:164 -msgid "Are you absolutely sure?" -msgstr "Are you absolutely sure?" - -#: src/routes/login/index.tsx:185 -msgid "Auto login" -msgstr "Auto login" - -#: src/components/NotFound/index.tsx:54 -#: src/routes/_auth/403/index.tsx:40 -msgid "Back to Home" -msgstr "Back to Home" - -#: src/routes/_auth/users/-FormModal.tsx:32 -#: src/routes/_auth/users/index.tsx:168 -msgid "Cancel" -msgstr "Cancel" - -#: src/routes/_auth/dashboard/index.tsx:134 -msgid "Chart Placeholder" -msgstr "Chart Placeholder" - -#: src/routes/_auth/users/index.tsx:106 -msgid "Create failed" -msgstr "Create failed" - -#: src/routes/_auth/users/-Toolbar.tsx:89 -msgid "Create User" -msgstr "Create User" - -#: src/routes/_auth/users/index.tsx:100 -msgid "Created successfully" -msgstr "Created successfully" - -#: src/components/Layout/Header/index.tsx:74 -#: src/components/Layout/Header/index.tsx:87 -#: src/components/Layout/Header/index.tsx:91 -#: src/components/Layout/Sidebar/index.tsx:32 -msgid "Dashboard" -msgstr "Dashboard" - -#: src/routes/_auth/users/index.tsx:166 -#: src/routes/_auth/users/index.tsx:257 -msgid "Delete" -msgstr "Delete" - -#: src/routes/_auth/users/index.tsx:156 -msgid "Delete failed" -msgstr "Delete failed" - -#: src/routes/_auth/users/index.tsx:149 -msgid "Deleted successfully" -msgstr "Deleted successfully" - -#: src/routes/_auth/users/index.tsx:142 -msgid "Deleting…" -msgstr "Deleting…" - -#: src/components/Layout/Sidebar/index.tsx:35 -msgid "Design Engineering" -msgstr "Design Engineering" - -#: src/routes/_auth/users/index.tsx:247 -msgid "Edit" -msgstr "Edit" - -#: src/routes/_auth/users/-FormModal.tsx:29 -msgid "Edit User" -msgstr "Edit User" - -#: src/routes/_auth/users/-FormModal.tsx:59 -#: src/routes/_auth/users/-Toolbar.tsx:65 -msgid "Editor" -msgstr "Editor" - -#: src/routes/_auth/users/-FormModal.tsx:63 -#: src/routes/_auth/users/index.tsx:202 -msgid "Email" -msgstr "Email" - -#: src/routes/_auth/users.tsx:353 -#~ msgid "Filter by role" -#~ msgstr "Filter by role" - -#: src/routes/login/index.tsx:192 -msgid "Forgot password?" -msgstr "Forgot password?" - -#: src/components/NotFound/index.tsx:57 -msgid "Go back" -msgstr "Go back" - -#: src/routes/login/index.tsx:68 -msgid "Login failed" -msgstr "Login failed" - -#: src/routes/login/index.tsx:64 -msgid "Login successful" -msgstr "Login successful" - -#: src/routes/_auth/users/-Toolbar.tsx:92 -#: src/routes/_auth/users/-Toolbar.tsx:93 -msgid "More filters" -msgstr "More filters" - -#: src/routes/_auth/users/-FormModal.tsx:29 -msgid "New User" -msgstr "New User" - -#: src/components/DataTable/DataTableEmpty.tsx:49 -msgid "No data" -msgstr "No data" - -#: src/components/DataTable/DataTableEmpty.tsx:59 -msgid "Nothing to show in this list yet" -msgstr "Nothing to show in this list yet" - -#: src/routes/_auth/users/-FormModal.tsx:31 -msgid "OK" -msgstr "OK" - -#: src/routes/_auth/dashboard/index.tsx:115 -msgid "Overview" -msgstr "Overview" - -#: src/routes/404/index.tsx:87 -#~ msgid "Page not found" -#~ msgstr "Page not found" - -#: src/routes/login/index.tsx:171 -msgid "Password" -msgstr "Password" - -#: src/components/Layout/Sidebar/index.tsx:30 -msgid "Platform" -msgstr "Platform" - -#: src/routes/login/index.tsx:172 -msgid "Please enter password" -msgstr "Please enter password" - -#: src/routes/_auth/users/-FormModal.tsx:46 -#: src/routes/login/index.tsx:164 -msgid "Please enter username" -msgstr "Please enter username" - -#: src/routes/_auth/users/-FormModal.tsx:53 -msgid "Please select roles" -msgstr "Please select roles" - -#: src/components/Layout/AppFooter/index.tsx:36 -msgid "Powered by" -msgstr "Powered by" - -#: src/components/Layout/Sidebar/index.tsx:31 -msgid "Projects" -msgstr "Projects" - -#: src/routes/_auth/dashboard/index.tsx:142 -msgid "Recent Sales" -msgstr "Recent Sales" - -#: src/routes/_auth/users/-Toolbar.tsx:58 -msgid "Role" -msgstr "Role" - -#: src/routes/_auth/users/-FormModal.tsx:52 -#: src/routes/_auth/users/index.tsx:209 -msgid "Roles" -msgstr "Roles" - -#: src/routes/_auth/dashboard/index.tsx:39 -msgid "Sales" -msgstr "Sales" - -#: src/components/Layout/Sidebar/index.tsx:36 -msgid "Sales & Marketing" -msgstr "Sales & Marketing" - -#: src/routes/_auth/users/-Toolbar.tsx:43 -msgid "Search User" -msgstr "Search User" - -#: src/routes/_auth/users.tsx:341 -#~ msgid "Search username or email" -#~ msgstr "Search username or email" - -#: src/routes/login/index.tsx:204 -msgid "Sign In" -msgstr "Sign In" - -#: src/routes/login.tsx:100 -#~ msgid "Sign in with your credentials." -#~ msgstr "Sign in with your credentials." - -#: src/components/Layout/Sidebar/index.tsx:194 -msgid "Sign Out" -msgstr "Sign Out" - -#: src/components/NotFound/index.tsx:50 -msgid "Sorry, the page you visited does not exist." -msgstr "Sorry, the page you visited does not exist." - -#: src/routes/_auth/403/index.tsx:37 -msgid "Sorry, you don't have permission to access this page." -msgstr "Sorry, you don't have permission to access this page." - -#: src/routes/_auth/dashboard/index.tsx:33 -msgid "Subscriptions" -msgstr "Subscriptions" - -#: src/components/Layout/Header/index.tsx:145 -#: src/routes/login/index.tsx:225 -msgid "Switch language" -msgstr "Switch language" - -#: src/routes/_auth/users/index.tsx:165 -msgid "This action cannot be undone. This will permanently delete the user." -msgstr "This action cannot be undone. This will permanently delete the user." - -#: src/components/Layout/Header/index.tsx:133 -#: src/components/Layout/Sidebar/index.tsx:263 -#: src/components/Layout/Sidebar/index.tsx:311 -msgid "Toggle sidebar" -msgstr "Toggle sidebar" - -#: src/components/Layout/Header/index.tsx:151 -#: src/routes/login/index.tsx:232 -msgid "Toggle Theme" -msgstr "Toggle Theme" - -#: src/routes/_auth/dashboard/index.tsx:27 -msgid "Total Revenue" -msgstr "Total Revenue" - -#: src/routes/_auth/users/index.tsx:132 -msgid "Update failed" -msgstr "Update failed" - -#: src/routes/_auth/users/index.tsx:122 -msgid "Updated successfully" -msgstr "Updated successfully" - -#: src/routes/_auth/users/index.tsx:115 -msgid "Updating…" -msgstr "Updating…" - -#: src/components/Layout/Sidebar/index.tsx:34 -msgid "User List" -msgstr "User List" - -#: src/routes/_auth/users/-FormModal.tsx:45 -#: src/routes/_auth/users/index.tsx:182 -#: src/routes/login/index.tsx:163 -msgid "Username" -msgstr "Username" - -#: src/components/Layout/Header/index.tsx:76 -#: src/components/Layout/Sidebar/index.tsx:33 -msgid "Users" -msgstr "Users" - -#: src/routes/login.tsx:101 -#~ msgid "Welcome back" -#~ msgstr "Welcome back" diff --git a/apps/basic/src/locales/zh/messages.po b/apps/basic/src/locales/zh/messages.po deleted file mode 100644 index 8b1850f..0000000 --- a/apps/basic/src/locales/zh/messages.po +++ /dev/null @@ -1,317 +0,0 @@ -msgid "" -msgstr "" -"POT-Creation-Date: 2026-04-07 15:30+0800\n" -"MIME-Version: 1.0\n" -"Content-Type: text/plain; charset=utf-8\n" -"Content-Transfer-Encoding: 8bit\n" -"X-Generator: @lingui/cli\n" -"Language: zh\n" -"Project-Id-Version: \n" -"Report-Msgid-Bugs-To: \n" -"PO-Revision-Date: \n" -"Last-Translator: \n" -"Language-Team: \n" -"Plural-Forms: \n" - -#: src/routes/_auth/users/index.tsx:464 -#~ msgid "{n} rows" -#~ msgstr "{n} 行" - -#: src/routes/_auth/users/index.tsx:386 -msgid "{total} rows" -msgstr "共 {total} 条" - -#: src/routes/_auth/dashboard/index.tsx:35 -msgid "+180.1% from last month" -msgstr "较上月 +180.1%" - -#: src/routes/_auth/dashboard/index.tsx:41 -msgid "+19% from last month" -msgstr "较上月 +19%" - -#: src/routes/_auth/dashboard/index.tsx:29 -msgid "+20.1% from last month" -msgstr "较上月 +20.1%" - -#: src/routes/_auth/dashboard/index.tsx:47 -msgid "+201 since last hour" -msgstr "较上一小时 +201" - -#: src/components/Layout/Header/index.tsx:78 -msgid "403" -msgstr "403" - -#: src/routes/_auth/dashboard/index.tsx:45 -msgid "Active Now" -msgstr "当前在线" - -#: src/routes/_auth/users/-FormModal.tsx:58 -#: src/routes/_auth/users/-Toolbar.tsx:64 -msgid "Admin" -msgstr "管理员" - -#: src/routes/_auth/users/index.tsx:164 -msgid "Are you absolutely sure?" -msgstr "确定要执行此操作吗?" - -#: src/routes/login/index.tsx:185 -msgid "Auto login" -msgstr "自动登录" - -#: src/components/NotFound/index.tsx:54 -#: src/routes/_auth/403/index.tsx:40 -msgid "Back to Home" -msgstr "返回首页" - -#: src/routes/_auth/users/-FormModal.tsx:32 -#: src/routes/_auth/users/index.tsx:168 -msgid "Cancel" -msgstr "取消" - -#: src/routes/_auth/dashboard/index.tsx:134 -msgid "Chart Placeholder" -msgstr "图表占位" - -#: src/routes/_auth/users/index.tsx:106 -msgid "Create failed" -msgstr "创建失败" - -#: src/routes/_auth/users/-Toolbar.tsx:89 -msgid "Create User" -msgstr "创建用户" - -#: src/routes/_auth/users/index.tsx:100 -msgid "Created successfully" -msgstr "创建成功" - -#: src/components/Layout/Header/index.tsx:74 -#: src/components/Layout/Header/index.tsx:87 -#: src/components/Layout/Header/index.tsx:91 -#: src/components/Layout/Sidebar/index.tsx:32 -msgid "Dashboard" -msgstr "仪表盘" - -#: src/routes/_auth/users/index.tsx:166 -#: src/routes/_auth/users/index.tsx:257 -msgid "Delete" -msgstr "删除" - -#: src/routes/_auth/users/index.tsx:156 -msgid "Delete failed" -msgstr "删除失败" - -#: src/routes/_auth/users/index.tsx:149 -msgid "Deleted successfully" -msgstr "删除成功" - -#: src/routes/_auth/users/index.tsx:142 -msgid "Deleting…" -msgstr "正在删除…" - -#: src/components/Layout/Sidebar/index.tsx:35 -msgid "Design Engineering" -msgstr "设计工程" - -#: src/routes/_auth/users/index.tsx:247 -msgid "Edit" -msgstr "编辑" - -#: src/routes/_auth/users/-FormModal.tsx:29 -msgid "Edit User" -msgstr "编辑用户" - -#: src/routes/_auth/users/-FormModal.tsx:59 -#: src/routes/_auth/users/-Toolbar.tsx:65 -msgid "Editor" -msgstr "编辑者" - -#: src/routes/_auth/users/-FormModal.tsx:63 -#: src/routes/_auth/users/index.tsx:202 -msgid "Email" -msgstr "邮箱" - -#: src/routes/_auth/users.tsx:353 -#~ msgid "Filter by role" -#~ msgstr "按角色筛选" - -#: src/routes/login/index.tsx:192 -msgid "Forgot password?" -msgstr "忘记密码?" - -#: src/components/NotFound/index.tsx:57 -msgid "Go back" -msgstr "返回上一页" - -#: src/routes/login/index.tsx:68 -msgid "Login failed" -msgstr "登录失败" - -#: src/routes/login/index.tsx:64 -msgid "Login successful" -msgstr "登录成功" - -#: src/routes/_auth/users/-Toolbar.tsx:92 -#: src/routes/_auth/users/-Toolbar.tsx:93 -msgid "More filters" -msgstr "更多筛选" - -#: src/routes/_auth/users/-FormModal.tsx:29 -msgid "New User" -msgstr "新建用户" - -#: src/components/DataTable/DataTableEmpty.tsx:49 -msgid "No data" -msgstr "暂无数据" - -#: src/components/DataTable/DataTableEmpty.tsx:59 -msgid "Nothing to show in this list yet" -msgstr "当前列表为空,暂无可展示的记录" - -#: src/routes/_auth/users/-FormModal.tsx:31 -msgid "OK" -msgstr "确定" - -#: src/routes/_auth/dashboard/index.tsx:115 -msgid "Overview" -msgstr "概览" - -#: src/routes/404/index.tsx:87 -#~ msgid "Page not found" -#~ msgstr "页面不存在" - -#: src/routes/login/index.tsx:171 -msgid "Password" -msgstr "密码" - -#: src/components/Layout/Sidebar/index.tsx:30 -msgid "Platform" -msgstr "平台" - -#: src/routes/login/index.tsx:172 -msgid "Please enter password" -msgstr "请输入密码" - -#: src/routes/_auth/users/-FormModal.tsx:46 -#: src/routes/login/index.tsx:164 -msgid "Please enter username" -msgstr "请输入用户名" - -#: src/routes/_auth/users/-FormModal.tsx:53 -msgid "Please select roles" -msgstr "请选择角色" - -#: src/components/Layout/AppFooter/index.tsx:36 -msgid "Powered by" -msgstr "由" - -#: src/components/Layout/Sidebar/index.tsx:31 -msgid "Projects" -msgstr "项目" - -#: src/routes/_auth/dashboard/index.tsx:142 -msgid "Recent Sales" -msgstr "近期销售" - -#: src/routes/_auth/users/-Toolbar.tsx:58 -msgid "Role" -msgstr "角色" - -#: src/routes/_auth/users/-FormModal.tsx:52 -#: src/routes/_auth/users/index.tsx:209 -msgid "Roles" -msgstr "角色" - -#: src/routes/_auth/dashboard/index.tsx:39 -msgid "Sales" -msgstr "销售额" - -#: src/components/Layout/Sidebar/index.tsx:36 -msgid "Sales & Marketing" -msgstr "销售与市场" - -#: src/routes/_auth/users/-Toolbar.tsx:43 -msgid "Search User" -msgstr "搜索用户" - -#: src/routes/_auth/users.tsx:341 -#~ msgid "Search username or email" -#~ msgstr "搜索用户名或邮箱" - -#: src/routes/login/index.tsx:204 -msgid "Sign In" -msgstr "登录" - -#: src/routes/login.tsx:100 -#~ msgid "Sign in with your credentials." -#~ msgstr "凭用户名与密码登录" - -#: src/components/Layout/Sidebar/index.tsx:194 -msgid "Sign Out" -msgstr "退出登录" - -#: src/components/NotFound/index.tsx:50 -msgid "Sorry, the page you visited does not exist." -msgstr "抱歉,您访问的页面不存在。" - -#: src/routes/_auth/403/index.tsx:37 -msgid "Sorry, you don't have permission to access this page." -msgstr "抱歉,您没有权限访问此页面。" - -#: src/routes/_auth/dashboard/index.tsx:33 -msgid "Subscriptions" -msgstr "订阅" - -#: src/components/Layout/Header/index.tsx:145 -#: src/routes/login/index.tsx:225 -msgid "Switch language" -msgstr "切换语言" - -#: src/routes/_auth/users/index.tsx:165 -msgid "This action cannot be undone. This will permanently delete the user." -msgstr "此操作无法撤销,将永久删除该用户。" - -#: src/components/Layout/Header/index.tsx:133 -#: src/components/Layout/Sidebar/index.tsx:263 -#: src/components/Layout/Sidebar/index.tsx:311 -msgid "Toggle sidebar" -msgstr "折叠侧栏" - -#: src/components/Layout/Header/index.tsx:151 -#: src/routes/login/index.tsx:232 -msgid "Toggle Theme" -msgstr "切换主题" - -#: src/routes/_auth/dashboard/index.tsx:27 -msgid "Total Revenue" -msgstr "总收入" - -#: src/routes/_auth/users/index.tsx:132 -msgid "Update failed" -msgstr "更新失败" - -#: src/routes/_auth/users/index.tsx:122 -msgid "Updated successfully" -msgstr "更新成功" - -#: src/routes/_auth/users/index.tsx:115 -msgid "Updating…" -msgstr "正在更新…" - -#: src/components/Layout/Sidebar/index.tsx:34 -msgid "User List" -msgstr "用户列表" - -#: src/routes/_auth/users/-FormModal.tsx:45 -#: src/routes/_auth/users/index.tsx:182 -#: src/routes/login/index.tsx:163 -msgid "Username" -msgstr "用户名" - -#: src/components/Layout/Header/index.tsx:76 -#: src/components/Layout/Sidebar/index.tsx:33 -msgid "Users" -msgstr "用户" - -#: src/routes/login.tsx:101 -#~ msgid "Welcome back" -#~ msgstr "欢迎回来" diff --git a/apps/basic/src/main.tsx b/apps/basic/src/main.tsx index 966b779..fd65c60 100644 --- a/apps/basic/src/main.tsx +++ b/apps/basic/src/main.tsx @@ -2,17 +2,9 @@ import React from "react"; import ReactDOM from "react-dom/client"; import { RouterProvider, createRouter } from "@tanstack/react-router"; import { routeTree } from "./routeTree.gen"; -import { i18n } from "@lingui/core"; -import { messages as enMessages } from "./locales/en/messages.po"; -import { messages as zhMessages } from "./locales/zh/messages.po"; -import { useSettingsStore } from "./stores/settings"; import { useAuthStore } from "./stores/auth"; import { fetchSessionAndApplyToStore } from "./utils/session"; -i18n.load("en", enMessages); -i18n.load("zh", zhMessages); -i18n.activate(useSettingsStore.getState().locale); - const router = createRouter({ routeTree }); declare module "@tanstack/react-router" { diff --git a/apps/basic/src/routes/__root.tsx b/apps/basic/src/routes/__root.tsx index d195170..30ea5a0 100644 --- a/apps/basic/src/routes/__root.tsx +++ b/apps/basic/src/routes/__root.tsx @@ -1,18 +1,13 @@ -import { useEffect } from "react"; +import { useEffect, useLayoutEffect } from "react"; import { createRootRoute, Outlet } from "@tanstack/react-router"; import { ConfigProvider, App } from "antd"; import enUS from "antd/locale/en_US"; -import zhCN from "antd/locale/zh_CN"; import { QueryClient, QueryClientProvider } from "@tanstack/react-query"; -import { i18n } from "@lingui/core"; -import { I18nProvider } from "@lingui/react"; import { useSettingsStore } from "@/stores/settings"; import { useAppTheme } from "@/hooks/useAppTheme"; import { NotFound } from "@/components/NotFound"; import "@/index.css"; -const antdLocaleMap = { en: enUS, zh: zhCN } as const; - const queryClient = new QueryClient({ defaultOptions: { queries: { retry: 1, refetchOnWindowFocus: false }, @@ -20,14 +15,12 @@ const queryClient = new QueryClient({ }); function RootComponent() { - const locale = useSettingsStore((s) => s.locale); const darkMode = useSettingsStore((s) => s.darkMode); const configProviderProps = useAppTheme(); - useEffect(() => { - i18n.activate(locale); - document.documentElement.lang = locale === "zh" ? "zh" : "en"; - }, [locale]); + useLayoutEffect(() => { + document.documentElement.lang = "en"; + }, []); useEffect(() => { document.documentElement.setAttribute("data-theme", darkMode ? "dark" : "light"); @@ -35,13 +28,11 @@ function RootComponent() { return ( - - - - - - - + + + + + ); } diff --git a/apps/basic/src/routes/_auth/403/index.tsx b/apps/basic/src/routes/_auth/403/index.tsx index cd988c7..74dc093 100644 --- a/apps/basic/src/routes/_auth/403/index.tsx +++ b/apps/basic/src/routes/_auth/403/index.tsx @@ -1,5 +1,4 @@ import { createFileRoute, useNavigate } from "@tanstack/react-router"; -import { useLingui } from "@lingui/react/macro"; import { Home, ShieldAlert } from "lucide-react"; import { Button, Flex, Result, theme } from "antd"; @@ -9,7 +8,6 @@ export const Route = createFileRoute("/_auth/403/")({ function ForbiddenPage() { const navigate = useNavigate(); - const { t } = useLingui(); const { token } = theme.useToken(); const goDashboard = () => { @@ -29,10 +27,10 @@ function ForbiddenPage() { } title="403" - subTitle={t`Sorry, you don't have permission to access this page.`} + subTitle="Sorry, you don't have permission to access this page." extra={ } /> diff --git a/apps/basic/src/routes/_auth/dashboard/index.tsx b/apps/basic/src/routes/_auth/dashboard/index.tsx index c535d39..e2d7575 100644 --- a/apps/basic/src/routes/_auth/dashboard/index.tsx +++ b/apps/basic/src/routes/_auth/dashboard/index.tsx @@ -3,7 +3,6 @@ import { useMemo } from "react"; import { createFileRoute } from "@tanstack/react-router"; import { Card, Col, Row, Typography, Avatar, theme, Flex, Skeleton } from "antd"; import { useQuery } from "@tanstack/react-query"; -import { useLingui } from "@lingui/react/macro"; import { DollarSign, Users, CreditCard, Activity } from "lucide-react"; import "./index.css"; @@ -115,7 +114,6 @@ function DashboardSkeleton() { } function DashboardPage() { - const { t } = useLingui(); const { token } = theme.useToken(); const { isPending } = useQuery({ queryKey: ["dashboard"], @@ -133,31 +131,31 @@ function DashboardPage() { const stats = useMemo( () => [ { - title: t`Total Revenue`, + title: "Total Revenue", value: "$45,231.89", - description: t`+20.1% from last month`, + description: "+20.1% from last month", icon: , }, { - title: t`Subscriptions`, + title: "Subscriptions", value: "+2350", - description: t`+180.1% from last month`, + description: "+180.1% from last month", icon: , }, { - title: t`Sales`, + title: "Sales", value: "+12,234", - description: t`+19% from last month`, + description: "+19% from last month", icon: , }, { - title: t`Active Now`, + title: "Active Now", value: "+573", - description: t`+201 since last hour`, + description: "+201 since last hour", icon: , }, ], - [t, token.colorTextSecondary], + [token.colorTextSecondary], ); const recentSales = useMemo( @@ -230,7 +228,7 @@ function DashboardPage() { {t`Overview`}} + title={Overview} > - {t`Chart Placeholder`} + Chart Placeholder @@ -256,7 +254,7 @@ function DashboardPage() { {t`Recent Sales`}} + title={Recent Sales} > open={open} - title={editingUser ? t`Edit User` : t`New User`} - okText={t`OK`} - cancelText={t`Cancel`} + title={editingUser ? "Edit User" : "New User"} + okText="OK" + cancelText="Cancel" form={form} confirmLoading={confirmLoading} onCancel={onCancel} @@ -36,25 +33,25 @@ export function FormModal({ > diff --git a/apps/basic/src/routes/_auth/users/-Toolbar.tsx b/apps/basic/src/routes/_auth/users/-Toolbar.tsx index c607325..ceb9e87 100644 --- a/apps/basic/src/routes/_auth/users/-Toolbar.tsx +++ b/apps/basic/src/routes/_auth/users/-Toolbar.tsx @@ -1,5 +1,4 @@ import { Button, Input, Select, theme } from "antd"; -import { useLingui } from "@lingui/react/macro"; import { Plus, UserRound } from "lucide-react"; import { forwardRef, useMemo } from "react"; import { FilterToolbar } from "@/components/FilterToolbar"; @@ -29,7 +28,6 @@ export const Toolbar = forwardRef(function Toolbar }, ref, ) { - const { t } = useLingui(); const { token } = theme.useToken(); const slots = useMemo( @@ -40,7 +38,7 @@ export const Toolbar = forwardRef(function Toolbar children: ( onKeywordChange(e.target.value)} @@ -55,29 +53,20 @@ export const Toolbar = forwardRef(function Toolbar children: ( @@ -159,13 +150,13 @@ function LoginPage() { {t`Password`}} - rules={[{ required: true, message: t`Please enter password` }]} + label={Password} + rules={[{ required: true, message: "Please enter password" }]} style={{ marginBottom: token.marginLG }} > @@ -178,14 +169,14 @@ function LoginPage() { wrap="wrap" > - {t`Auto login`} + Auto login e.preventDefault()} style={{ fontSize: token.fontSizeSM }} > - {t`Forgot password?`} + Forgot password? @@ -197,7 +188,7 @@ function LoginPage() { block size="large" > - {t`Sign In`} + Sign In @@ -213,19 +204,12 @@ function LoginPage() { > -