From e0334cf0a8d2fe764b6e6aa302e2bf42fd0aa494 Mon Sep 17 00:00:00 2001 From: memoclaw Date: Fri, 20 Mar 2026 05:56:56 +0800 Subject: [PATCH] refactor: restructure i18n locale keys for better maintainability (#5744) Co-authored-by: memoclaw <265580040+memoclaw@users.noreply.github.com> Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- web/src/components/ActivityCalendar/hooks.ts | 13 +- .../components/ChangeMemberPasswordDialog.tsx | 2 +- .../components/CreateAccessTokenDialog.tsx | 14 +- .../CreateIdentityProviderDialog.tsx | 46 ++--- web/src/components/CreateUserDialog.tsx | 4 +- web/src/components/CreateWebhookDialog.tsx | 12 +- .../MemoDetailSidebar/MemoDetailSidebar.tsx | 4 +- web/src/components/MemoFilters.tsx | 6 +- web/src/components/MemoSharePanel.tsx | 32 ++-- .../Settings/AccessTokenSection.tsx | 20 +- .../components/Settings/InstanceSection.tsx | 28 +-- web/src/components/Settings/MemberSection.tsx | 26 ++- .../Settings/MemoRelatedSettings.tsx | 10 +- .../components/Settings/MyAccountSection.tsx | 4 +- .../Settings/PreferencesSection.tsx | 6 +- web/src/components/Settings/SSOSection.tsx | 6 +- .../components/Settings/StorageSection.tsx | 10 +- .../components/Settings/WebhookSection.tsx | 14 +- web/src/components/UpdateAccountDialog.tsx | 8 +- .../UpdateCustomizedProfileDialog.tsx | 8 +- web/src/components/UserMenu.tsx | 4 +- web/src/locales/ar.json | 172 ++++++++--------- web/src/locales/ca.json | 172 ++++++++--------- web/src/locales/cs.json | 172 ++++++++--------- web/src/locales/de.json | 172 ++++++++--------- web/src/locales/en-GB.json | 4 +- web/src/locales/en.json | 131 ++++++------- web/src/locales/es.json | 172 ++++++++--------- web/src/locales/fa.json | 172 ++++++++--------- web/src/locales/fr.json | 172 ++++++++--------- web/src/locales/gl.json | 172 ++++++++--------- web/src/locales/hi.json | 172 ++++++++--------- web/src/locales/hr.json | 172 ++++++++--------- web/src/locales/hu.json | 172 ++++++++--------- web/src/locales/id.json | 172 ++++++++--------- web/src/locales/it.json | 172 ++++++++--------- web/src/locales/ja.json | 172 ++++++++--------- web/src/locales/ka-GE.json | 172 ++++++++--------- web/src/locales/ko.json | 172 ++++++++--------- web/src/locales/mr.json | 172 ++++++++--------- web/src/locales/nb.json | 172 ++++++++--------- web/src/locales/nl.json | 172 ++++++++--------- web/src/locales/pl.json | 172 ++++++++--------- web/src/locales/pt-BR.json | 172 ++++++++--------- web/src/locales/pt-PT.json | 172 ++++++++--------- web/src/locales/ru.json | 172 ++++++++--------- web/src/locales/sl.json | 172 ++++++++--------- web/src/locales/sv.json | 172 ++++++++--------- web/src/locales/th.json | 172 ++++++++--------- web/src/locales/tr.json | 172 ++++++++--------- web/src/locales/uk.json | 172 ++++++++--------- web/src/locales/vi.json | 172 ++++++++--------- web/src/locales/zh-Hans.json | 174 +++++++++--------- web/src/locales/zh-Hant.json | 174 +++++++++--------- web/src/pages/Setting.tsx | 14 +- web/src/pages/SharedMemo.tsx | 2 +- 56 files changed, 2886 insertions(+), 2878 deletions(-) diff --git a/web/src/components/ActivityCalendar/hooks.ts b/web/src/components/ActivityCalendar/hooks.ts index e3d2cfb79..460cdad05 100644 --- a/web/src/components/ActivityCalendar/hooks.ts +++ b/web/src/components/ActivityCalendar/hooks.ts @@ -4,7 +4,18 @@ import { useTranslate } from "@/utils/i18n"; export const useWeekdayLabels = () => { const t = useTranslate(); - return useMemo(() => [t("days.sun"), t("days.mon"), t("days.tue"), t("days.wed"), t("days.thu"), t("days.fri"), t("days.sat")], [t]); + return useMemo( + () => [ + t("common.days.sun"), + t("common.days.mon"), + t("common.days.tue"), + t("common.days.wed"), + t("common.days.thu"), + t("common.days.fri"), + t("common.days.sat"), + ], + [t], + ); }; export const useTodayDate = () => { diff --git a/web/src/components/ChangeMemberPasswordDialog.tsx b/web/src/components/ChangeMemberPasswordDialog.tsx index cd45b844a..c9d9995ff 100644 --- a/web/src/components/ChangeMemberPasswordDialog.tsx +++ b/web/src/components/ChangeMemberPasswordDialog.tsx @@ -75,7 +75,7 @@ function ChangeMemberPasswordDialog({ open, onOpenChange, user, onSuccess }: Pro - {t("setting.account-section.change-password")} ({user.displayName}) + {t("setting.account.change-password")} ({user.displayName})
diff --git a/web/src/components/CreateAccessTokenDialog.tsx b/web/src/components/CreateAccessTokenDialog.tsx index 845df571b..3da482485 100644 --- a/web/src/components/CreateAccessTokenDialog.tsx +++ b/web/src/components/CreateAccessTokenDialog.tsx @@ -38,7 +38,7 @@ function CreateAccessTokenDialog({ open, onOpenChange, onSuccess }: Props) { // Expiration options in days (0 = never expires) const expirationOptions = [ { - label: t("setting.access-token-section.create-dialog.duration-1m"), + label: t("setting.access-token.create-dialog.duration-1m"), value: 30, }, { @@ -46,7 +46,7 @@ function CreateAccessTokenDialog({ open, onOpenChange, onSuccess }: Props) { value: 90, }, { - label: t("setting.access-token-section.create-dialog.duration-never"), + label: t("setting.access-token.create-dialog.duration-never"), value: 0, }, ]; @@ -118,12 +118,12 @@ function CreateAccessTokenDialog({ open, onOpenChange, onSuccess }: Props) { - {t("setting.access-token-section.create-dialog.create-access-token")} + {t("setting.access-token.create-dialog.create-access-token")} {createdToken ? (
- +