From 68a0955f739566bbb5a3ceaba873d96913b46ee4 Mon Sep 17 00:00:00 2001 From: gakshita Date: Wed, 22 Jan 2025 16:18:53 +0530 Subject: [PATCH] fix: translation key --- packages/constants/src/project.ts | 73 +++++++++++-------- .../(projects)/profile/[userId]/page.tsx | 6 +- .../components/projects/create/attributes.tsx | 4 +- .../sidebar/sidebar-header.tsx | 2 +- .../automation/auto-archive-automation.tsx | 4 +- .../automation/auto-close-automation.tsx | 4 +- web/core/components/cycles/delete-modal.tsx | 4 +- .../inbox/modals/delete-issue-modal.tsx | 4 +- .../components/issues/delete-issue-modal.tsx | 9 ++- .../issues/workspace-draft/delete-modal.tsx | 9 ++- .../modules/delete-module-modal.tsx | 4 +- .../project/applied-filters/access.tsx | 2 +- .../project-display-filters.tsx | 2 +- .../project/dropdowns/filters/access.tsx | 4 +- .../components/project/dropdowns/order-by.tsx | 6 +- web/core/components/project/form.tsx | 6 +- 16 files changed, 82 insertions(+), 61 deletions(-) diff --git a/packages/constants/src/project.ts b/packages/constants/src/project.ts index 48f8528faa0..6c70afcc902 100644 --- a/packages/constants/src/project.ts +++ b/packages/constants/src/project.ts @@ -7,38 +7,53 @@ import { export const NETWORK_CHOICES: { key: 0 | 2; - label: string; + i18n_label: string; description: string; icon: LucideIcon; }[] = [ { key: 0, - label: "workspace_projects.network.private.title", + i18n_label: "workspace_projects.network.private.title", description: "workspace_projects.network.private.description", //"Accessible only by invite", icon: Lock, }, { key: 2, - label: "workspace_projects.network.public.title", + i18n_label: "workspace_projects.network.public.title", description: "workspace_projects.network.public.description", //"Anyone in the workspace except Guests can join", icon: Globe2, }, ]; export const GROUP_CHOICES = { - backlog: "workspace_projects.state.backlog", - unstarted: "workspace_projects.state.unstarted", - started: "workspace_projects.state.started", - completed: "workspace_projects.state.completed", - cancelled: "workspace_projects.state.cancelled", + backlog: { + key: "backlog", + i18n_label: "workspace_projects.state.backlog", + }, + unstarted: { + key: "unstarted", + i18n_label: "workspace_projects.state.unstarted", + }, + started: { + key: "started", + i18n_label: "workspace_projects.state.started", + }, + completed: { + key: "completed", + i18n_label: "workspace_projects.state.completed", + }, + cancelled: { + key: "cancelled", + i18n_label: "workspace_projects.state.cancelled", + }, }; export const PROJECT_AUTOMATION_MONTHS = [ - { label: "common.months_count", value: 1 }, - { label: "common.months_count", value: 3 }, - { label: "common.months_count", value: 6 }, - { label: "common.months_count", value: 9 }, - { label: "common.months_count", value: 12 }, + { i18n_label: "common.months_count", value: 1 }, + { i18n_label: "common.months_count", value: 3 }, + { i18n_label: "common.months_count", value: 6 }, + { i18n_label: "common.months_count", value: 9 }, + { i18n_label: "common.months_count", value: 12 }, ]; export const PROJECT_UNSPLASH_COVERS = [ @@ -62,55 +77,55 @@ export const PROJECT_UNSPLASH_COVERS = [ export const PROJECT_ORDER_BY_OPTIONS: { key: TProjectOrderByOptions; - label: string; + i18n_label: string; }[] = [ { key: "sort_order", - label: "workspace_projects.sort.manual", + i18n_label: "workspace_projects.sort.manual", }, { key: "name", - label: "workspace_projects.sort.name", + i18n_label: "workspace_projects.sort.name", }, { key: "created_at", - label: "workspace_projects.sort.created_at", + i18n_label: "workspace_projects.sort.created_at", }, { key: "members_length", - label: "workspace_projects.sort.members_length", + i18n_label: "workspace_projects.sort.members_length", }, ]; export const PROJECT_DISPLAY_FILTER_OPTIONS: { key: TProjectAppliedDisplayFilterKeys; - label: string; + i18n_label: string; }[] = [ { key: "my_projects", - label: "workspace_projects.scope.my_projects", + i18n_label: "workspace_projects.scope.my_projects", }, { key: "archived_projects", - label: "workspace_projects.scope.archived_projects", + i18n_label: "workspace_projects.scope.archived_projects", }, ]; export const PROJECT_ERROR_MESSAGES = { permissionError: { - title: "workspace_projects.error.permission", - message: undefined, + i18n_title: "workspace_projects.error.permission", + i18n_message: undefined, }, cycleDeleteError: { - title: "error", - message: "workspace_projects.error.cycle_delete", + i18n_title: "error", + i18n_message: "workspace_projects.error.cycle_delete", }, moduleDeleteError: { - title: "error", - message: "workspace_projects.error.module_delete", + i18n_title: "error", + i18n_message: "workspace_projects.error.module_delete", }, issueDeleteError: { - title: "error", - message: "workspace_projects.error.issue_delete", + i18n_title: "error", + i18n_message: "workspace_projects.error.issue_delete", }, }; diff --git a/web/app/[workspaceSlug]/(projects)/profile/[userId]/page.tsx b/web/app/[workspaceSlug]/(projects)/profile/[userId]/page.tsx index dab2e5100d0..45166a94cd2 100644 --- a/web/app/[workspaceSlug]/(projects)/profile/[userId]/page.tsx +++ b/web/app/[workspaceSlug]/(projects)/profile/[userId]/page.tsx @@ -37,7 +37,11 @@ export default function ProfileOverviewPage() { const group = userProfile?.state_distribution.find((g) => g.state_group === t(key)); if (group) return group; - else return { state_group: t(key) as TStateGroups, state_count: 0 }; + else + return { + state_group: t(GROUP_CHOICES[key as keyof typeof GROUP_CHOICES].i18n_label) as TStateGroups, + state_count: 0, + }; }); return ( diff --git a/web/ce/components/projects/create/attributes.tsx b/web/ce/components/projects/create/attributes.tsx index c757c35ba44..abcecc2cd84 100644 --- a/web/ce/components/projects/create/attributes.tsx +++ b/web/ce/components/projects/create/attributes.tsx @@ -40,7 +40,7 @@ const ProjectAttributes: FC = (props) => { {currentNetwork ? ( <> - {t(currentNetwork.label)} + {t(currentNetwork.i18n_label)} ) : ( {t("select_network")} @@ -58,7 +58,7 @@ const ProjectAttributes: FC = (props) => {
-

{t(network.label)}

+

{t(network.i18n_label)}

{t(network.description)}

diff --git a/web/core/components/analytics/custom-analytics/sidebar/sidebar-header.tsx b/web/core/components/analytics/custom-analytics/sidebar/sidebar-header.tsx index dd070c53c12..707a149221b 100644 --- a/web/core/components/analytics/custom-analytics/sidebar/sidebar-header.tsx +++ b/web/core/components/analytics/custom-analytics/sidebar/sidebar-header.tsx @@ -93,7 +93,7 @@ export const CustomAnalyticsSidebarHeader = observer(() => {
Network
- {t(NETWORK_CHOICES.find((n) => n.key === projectDetails?.network)?.label ?? "")} + {t(NETWORK_CHOICES.find((n) => n.key === projectDetails?.network)?.i18n_label ?? "")}
diff --git a/web/core/components/automation/auto-archive-automation.tsx b/web/core/components/automation/auto-archive-automation.tsx index a4afe5d29f2..800c94e8215 100644 --- a/web/core/components/automation/auto-archive-automation.tsx +++ b/web/core/components/automation/auto-archive-automation.tsx @@ -92,8 +92,8 @@ export const AutoArchiveAutomation: React.FC = observer((props) => { > <> {PROJECT_AUTOMATION_MONTHS.map((month) => ( - - {t(month.label, { month: month.value })} + + {t(month.i18n_label, { month: month.value })} ))} diff --git a/web/core/components/automation/auto-close-automation.tsx b/web/core/components/automation/auto-close-automation.tsx index 18e3be6722a..9dfd8fcaa68 100644 --- a/web/core/components/automation/auto-close-automation.tsx +++ b/web/core/components/automation/auto-close-automation.tsx @@ -119,8 +119,8 @@ export const AutoCloseAutomation: React.FC = observer((props) => { > <> {PROJECT_AUTOMATION_MONTHS.map((month) => ( - - {t(month.label, { month: month.value })} + + {t(month.i18n_label, { month: month.value })} ))}