Skip to content

Commit

Permalink
feat: language support for intake
Browse files Browse the repository at this point in the history
  • Loading branch information
gakshita committed Jan 28, 2025
1 parent eb9d6a5 commit cdd1032
Show file tree
Hide file tree
Showing 11 changed files with 134 additions and 71 deletions.
91 changes: 66 additions & 25 deletions packages/i18n/src/locales/en/translations.json
Original file line number Diff line number Diff line change
Expand Up @@ -333,6 +333,14 @@
"show_all": "Show all",
"show_less": "Show less",
"no_data_yet": "No Data yet",
"Syncing": "Syncing",
"add_work_item": "Add work item",
"advanced_description_placeholder": "Press '/' for commands...",
"create_work_item": "Create work item",
"attachments": "Attachments",
"declining": "Declining",
"declined": "Declined",
"decline": "Decline",

"project_view": {
"sort_by": {
Expand Down Expand Up @@ -516,9 +524,12 @@
},
"comments": "Comments",
"updates": "Updates",
"clear_all": "Clear all"
"clear_all": "Clear all",
"link_copied": "Link copied",
"copied_to_clipboard": "Work item link copied to clipboard",
"is_copied_to_clipboard": "Work item is copied to clipboard"
},

"form": {
"title": {
"required": "Title is required",
Expand Down Expand Up @@ -638,13 +649,66 @@
"description": "Duplicate"
}
},
"modals": {
"decline": {
"title": "Decline work item",
"content": "Are you sure you want to decline work item {value}?"
},
"delete": {
"title": "Delete work item",
"content": "Are you sure you want to delete work item {value}?",
"success": "Work item deleted successfully"
}
},
"errors": {
"snooze_permission": "Only project admins can snooze/Un-snooze work items",
"accept_permission": "Only project admins can accept work items",
"decline_permission": "Only project admins can deny work items"
},
"actions": {
"accept": "Accept",
"decline": "Decline",
"snooze": "Snooze",
"unsnooze": "Un snooze",
"copy": "Copy work item link",
"delete": "Delete",
"open": "Open work item",
"mark_as_duplicate": "Mark as duplicate",
"move": "Move {value} to project work items"
},
"source": {
"in-app": "in-app"
},
"order_by": {
"created_at": "Created at",
"updated_at": "Updated at",
"id": "ID"
},
"label": "Intake",
"page_label": "{workspace} - Intake",
"modal": {
"title": "Create intake work item"
},
"tabs": {
"open": "Open",
"closed": "Closed"
},
"empty_state": {
"sidebar_open_tab": {
"title": "No open issues",
"description": "Find open issues here. Create new issue."
},
"sidebar_closed_tab": {
"title": "No closed issues",
"description": "All the issues whether accepted or declined can be found here."
},
"sidebar_filter": {
"title": "No matching issues",
"description": "No issue matches filter applied in intake. Create a new issue."
},
"detail": {
"title": "Select an issue to view its details."
}
}
},

Expand Down Expand Up @@ -1191,30 +1255,7 @@
}
}
},

"inbox": {
"label": "Inbox",
"empty_state": {
"sidebar_open_tab": {
"title": "No open issues",
"description": "Find open issues here. Create new issue."
},
"sidebar_closed_tab": {
"title": "No closed issues",
"description": "All the issues whether accepted or declined can be found here."
},
"sidebar_filter": {
"title": "No matching issues",
"description": "No issue matches filter applied in intake. Create a new issue."
},
"detail": {
"title": "Select an issue to view its details."
}
}
},

"workspace_draft_issues": {
"draft_an_issue": "Draft an issue",
"draft_an_issue": "Draft an issue",
"empty_state": {
"title": "Half-written issues, and soon, comments will show up here.",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,13 @@ const ProjectInboxPage = observer(() => {
);

// derived values
const pageTitle = currentProjectDetails?.name ? `${currentProjectDetails?.name} - Intake` : "Plane - Intake";
const pageTitle = currentProjectDetails?.name
? t("inbox_issue.page_label", {
workspace: currentProjectDetails?.name,
})
: t("inbox_issue.page_label", {
workspace: "Plane",
});

const currentNavigationTab = navigationTab
? navigationTab === "open"
Expand Down
8 changes: 5 additions & 3 deletions web/ce/components/projects/settings/intake/header.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import { observer } from "mobx-react";
import { useParams } from "next/navigation";
import { RefreshCcw } from "lucide-react";
// ui
import { useTranslation } from "@plane/i18n";
import { Breadcrumbs, Button, Intake, Header } from "@plane/ui";
// components
import { BreadcrumbLink } from "@/components/common";
Expand All @@ -22,6 +23,7 @@ export const ProjectInboxHeader: FC = observer(() => {
const { workspaceSlug, projectId } = useParams();
// store hooks
const { allowPermissions } = useUserPermissions();
const { t } = useTranslation();

const { currentProjectDetails, loader: currentProjectDetailsLoader } = useProject();
const { loader } = useProjectInbox();
Expand All @@ -41,14 +43,14 @@ export const ProjectInboxHeader: FC = observer(() => {

<Breadcrumbs.BreadcrumbItem
type="text"
link={<BreadcrumbLink label="Intake" icon={<Intake className="h-4 w-4 text-custom-text-300" />} />}
link={<BreadcrumbLink label={t("intake")} icon={<Intake className="h-4 w-4 text-custom-text-300" />} />}
/>
</Breadcrumbs>

{loader === "pagination-loading" && (
<div className="flex items-center gap-1.5 text-custom-text-300">
<RefreshCcw className="h-3.5 w-3.5 animate-spin" />
<p className="text-sm">Syncing...</p>
<p className="text-sm">{t("syncing")}...</p>
</div>
)}
</div>
Expand All @@ -64,7 +66,7 @@ export const ProjectInboxHeader: FC = observer(() => {
/>

<Button variant="primary" size="sm" onClick={() => setCreateIssueModal(true)}>
Add issue
{t("add_work_item")}
</Button>
</div>
) : (
Expand Down
38 changes: 21 additions & 17 deletions web/core/components/inbox/content/inbox-issue-header.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import {
MoveRight,
Copy,
} from "lucide-react";
import { useTranslation } from "@plane/i18n";
import { TNameDescriptionLoader } from "@plane/types";
import { Button, ControlLink, CustomMenu, Row, TOAST_TYPE, setToast } from "@plane/ui";
// components
Expand Down Expand Up @@ -71,6 +72,7 @@ export const InboxIssueActionsHeader: FC<TInboxIssueActionsHeader> = observer((p
const { data: currentUser } = useUser();
const { allowPermissions } = useUserPermissions();
const { currentProjectDetails } = useProject();
const { t } = useTranslation();

const router = useAppRouter();
const { getProjectById } = useProject();
Expand Down Expand Up @@ -172,8 +174,8 @@ export const InboxIssueActionsHeader: FC<TInboxIssueActionsHeader> = observer((p
copyUrlToClipboard(path).then(() =>
setToast({
type: TOAST_TYPE.SUCCESS,
title: "Link copied",
message: "Issue link copied to clipboard",
title: t("common.link_copied"),
message: t("common.copied_to_clipboard"),
})
);

Expand Down Expand Up @@ -243,10 +245,12 @@ export const InboxIssueActionsHeader: FC<TInboxIssueActionsHeader> = observer((p
beforeFormSubmit={handleInboxIssueAccept}
withDraftIssueWrapper={false}
fetchIssueDetails={false}
modalTitle={`Move ${currentProjectDetails?.identifier}-${issue?.sequence_id} to project issues`}
modalTitle={t("inbox_issue.actions.move", {
value: `${currentProjectDetails?.identifier}-${issue?.sequence_id}`,
})}
primaryButtonText={{
default: "Add to project",
loading: "Adding",
default: t("add_to_project"),
loading: t("adding"),
}}
/>
<DeclineIssueModal
Expand Down Expand Up @@ -319,11 +323,11 @@ export const InboxIssueActionsHeader: FC<TInboxIssueActionsHeader> = observer((p
handleActionWithPermission(
isProjectAdmin,
() => setAcceptIssueModal(true),
"Only project admins can accept issues"
t("inbox_issue.errors.accept_permission")
)
}
>
Accept
{t("inbox_issue.actions.accept")}
</Button>
</div>
)}
Expand All @@ -339,11 +343,11 @@ export const InboxIssueActionsHeader: FC<TInboxIssueActionsHeader> = observer((p
handleActionWithPermission(
isProjectAdmin,
() => setDeclineIssueModal(true),
"Only project admins can deny issues"
t("inbox_issue.errors.decline_permission")
)
}
>
Decline
{t("inbox_issue.actions.decline")}
</Button>
</div>
)}
Expand All @@ -356,7 +360,7 @@ export const InboxIssueActionsHeader: FC<TInboxIssueActionsHeader> = observer((p
size="sm"
onClick={() => handleCopyIssueLink(issueLink)}
>
Copy issue link
{t("inbox_issue.actions.copy")}
</Button>
<ControlLink
href={`/${workspaceSlug}/projects/${issue?.project_id}/issues/${currentInboxIssueId}`}
Expand All @@ -366,7 +370,7 @@ export const InboxIssueActionsHeader: FC<TInboxIssueActionsHeader> = observer((p
target="_self"
>
<Button variant="neutral-primary" prependIcon={<ExternalLink className="h-2.5 w-2.5" />} size="sm">
Open issue
{t("inbox_issue.actions.open")}
</Button>
</ControlLink>
</div>
Expand All @@ -380,15 +384,15 @@ export const InboxIssueActionsHeader: FC<TInboxIssueActionsHeader> = observer((p
handleActionWithPermission(
isProjectAdmin,
handleIssueSnoozeAction,
"Only project admins can snooze/Un-snooze issues"
t("inbox_issue.errors.snooze_permission")
)
}
>
<div className="flex items-center gap-2">
<Clock size={14} strokeWidth={2} />
{inboxIssue?.snoozed_till && numberOfDaysLeft && numberOfDaysLeft > 0
? "Un-snooze"
: "Snooze"}
? t("inbox_issue.actions.unsnooze")
: t("inbox_issue.actions.snooze")}
</div>
</CustomMenu.MenuItem>
)}
Expand All @@ -404,21 +408,21 @@ export const InboxIssueActionsHeader: FC<TInboxIssueActionsHeader> = observer((p
>
<div className="flex items-center gap-2">
<FileStack size={14} strokeWidth={2} />
Mark as duplicate
{t("inbox_issue.actions.mark_as_duplicate")}
</div>
</CustomMenu.MenuItem>
)}
<CustomMenu.MenuItem onClick={() => handleCopyIssueLink(intakeIssueLink)}>
<div className="flex items-center gap-2">
<Copy size={14} strokeWidth={2} />
Copy issue link
{t("inbox_issue.actions.copy")}
</div>
</CustomMenu.MenuItem>
{canDelete && (
<CustomMenu.MenuItem onClick={() => setDeleteIssueModal(true)}>
<div className="flex items-center gap-2">
<Trash2 size={14} strokeWidth={2} />
Delete
{t("inbox_issue.actions.delete")}
</div>
</CustomMenu.MenuItem>
)}
Expand Down
10 changes: 6 additions & 4 deletions web/core/components/inbox/modals/create-modal/create-root.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import { usePathname } from "next/navigation";
import { ETabIndices, ISSUE_CREATED } from "@plane/constants";
import { EditorRefApi } from "@plane/editor";
// types
import { useTranslation } from "@plane/i18n";
import { TIssue } from "@plane/types";
import { Button, ToggleSwitch, TOAST_TYPE, setToast } from "@plane/ui";
// components
Expand Down Expand Up @@ -66,6 +67,7 @@ export const InboxIssueCreateRoot: FC<TInboxIssueCreateRoot> = observer((props)
const workspaceId = getWorkspaceBySlug(workspaceSlug)?.id;
const { isMobile } = usePlatformOS();
const { getProjectById } = useProject();
const { t } = useTranslation();
// states
const [createMore, setCreateMore] = useState<boolean>(false);
const [formSubmitting, setFormSubmitting] = useState(false);
Expand Down Expand Up @@ -212,7 +214,7 @@ export const InboxIssueCreateRoot: FC<TInboxIssueCreateRoot> = observer((props)
<form ref={formRef} onSubmit={handleFormSubmit} className="flex flex-col w-full">
<div className="space-y-5 p-5 rounded-t-lg bg-custom-background-100">
<div className="flex items-center justify-between gap-2">
<h3 className="text-xl font-medium text-custom-text-200">Create intake issue</h3>
<h3 className="text-xl font-medium text-custom-text-200">{t("inbox_issue.modal.title")}</h3>
{duplicateIssues?.length > 0 && (
<DeDupeButtonRoot
workspaceSlug={workspaceSlug}
Expand Down Expand Up @@ -250,7 +252,7 @@ export const InboxIssueCreateRoot: FC<TInboxIssueCreateRoot> = observer((props)
tabIndex={getIndex("create_more")}
>
<ToggleSwitch value={createMore} onChange={() => {}} size="sm" />
<span className="text-xs">Create more</span>
<span className="text-xs">{t("create_more")}</span>
</div>
<div className="flex items-center gap-3">
<Button
Expand All @@ -270,7 +272,7 @@ export const InboxIssueCreateRoot: FC<TInboxIssueCreateRoot> = observer((props)
}}
tabIndex={getIndex("discard_button")}
>
Discard
{t("discard")}
</Button>
<Button
variant="primary"
Expand All @@ -281,7 +283,7 @@ export const InboxIssueCreateRoot: FC<TInboxIssueCreateRoot> = observer((props)
disabled={isTitleLengthMoreThan255Character}
tabIndex={getIndex("submit_button")}
>
{formSubmitting ? "Creating" : "Create Issue"}
{formSubmitting ? t("creating") : t("create_work_item")}
</Button>
</div>
</div>
Expand Down
Loading

0 comments on commit cdd1032

Please sign in to comment.