Skip to content

Commit 2f1fbc7

Browse files
chore: added translations for issue detail widgets
1 parent 747fde2 commit 2f1fbc7

File tree

12 files changed

+133
-93
lines changed

12 files changed

+133
-93
lines changed

packages/i18n/src/locales/en/translations.json

Lines changed: 58 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -363,6 +363,35 @@
363363
"error": "Error!"
364364
},
365365

366+
"links": {
367+
"toasts": {
368+
"created": {
369+
"title": "Link created",
370+
"message": "The link has been successfully created"
371+
},
372+
"not_created": {
373+
"title": "Link not created",
374+
"message": "The link could not be created"
375+
},
376+
"updated": {
377+
"title": "Link updated",
378+
"message": "The link has been successfully updated"
379+
},
380+
"not_updated": {
381+
"title": "Link not updated",
382+
"message": "The link could not be updated"
383+
},
384+
"removed": {
385+
"title": "Link removed",
386+
"message": "The link has been successfully removed"
387+
},
388+
"not_removed": {
389+
"title": "Link not removed",
390+
"message": "The link could not be removed"
391+
}
392+
}
393+
},
394+
366395
"home": {
367396
"empty": {
368397
"create_project": {
@@ -397,33 +426,7 @@
397426
"empty": "Save links to work things that you'd like handy.",
398427
"add": "Add quick Link",
399428
"title": "Quicklink",
400-
"title_plural": "Quicklinks",
401-
"toasts": {
402-
"created": {
403-
"title": "Link created",
404-
"message": "The link has been successfully created"
405-
},
406-
"not_created": {
407-
"title": "Link not created",
408-
"message": "The link could not be created"
409-
},
410-
"updated": {
411-
"title": "Link updated",
412-
"message": "The link has been successfully updated"
413-
},
414-
"not_updated": {
415-
"title": "Link not updated",
416-
"message": "The link could not be updated"
417-
},
418-
"removed": {
419-
"title": "Link removed",
420-
"message": "The link has been successfully removed"
421-
},
422-
"not_removed": {
423-
"title": "Link not removed",
424-
"message": "The link could not be removed"
425-
}
426-
}
429+
"title_plural": "Quicklinks"
427430
},
428431
"recents": {
429432
"title": "Recents",
@@ -503,10 +506,12 @@
503506
"group_by": "Group by",
504507
"epic": "Epic",
505508
"issue": "Issue",
509+
"add": "Add",
506510
"warning": "Warning",
507511
"updating": "Updating",
512+
"adding": "Adding",
508513
"update": "Update",
509-
"creating": "Creating",
514+
"create": "Create",
510515
"cancel": "Cancel",
511516
"description": "Description",
512517
"title": "Title",
@@ -549,7 +554,16 @@
549554
"is_copied_to_clipboard": "Work item is copied to clipboard",
550555
"no_links_added_yet": "No links added yet",
551556
"add_link": "Add link",
557+
"update_link": "Update link",
552558
"progress": "Progress",
559+
"attach": "Attach",
560+
"create_new": "Create new",
561+
"add_existing": "Add existing",
562+
"type_or_paste_a_url": "Type or paste a URL",
563+
"url_is_invalid": "URL is invalid",
564+
"display_title": "Display title",
565+
"link_title_placeholder": "What you'd like to see this link as",
566+
"optional": "Optional",
553567
"search": {
554568
"label": "Search",
555569
"placeholder": "Type to search...",
@@ -580,7 +594,11 @@
580594
"drop_here_to_move": "Drop here to move the {entity}",
581595
"delete": {
582596
"label": "Delete {entity}",
583-
"success": "{entity} deleted successfully"
597+
"success": "{entity} deleted successfully",
598+
"failed": "{entity} delete failed"
599+
},
600+
"update": {
601+
"failed": "{entity} update failed"
584602
}
585603
},
586604

@@ -617,7 +635,10 @@
617635
"assignee": "Add assignees",
618636
"start_date": "Add start date",
619637
"due_date": "Add due date",
620-
"parent": "Add parent issue"
638+
"parent": "Add parent issue",
639+
"sub_issue": "Add sub-issue",
640+
"relation": "Add relation",
641+
"link": "Add link"
621642
},
622643
"remove": {
623644
"cycle": {
@@ -692,18 +713,6 @@
692713
"error": "Asset upload failed. Please try again later."
693714
}
694715
},
695-
"update": {
696-
"failed": "Issue update failed"
697-
},
698-
"delete": {
699-
"failed": "Issue delete failed",
700-
"success": "Issue deleted successfully"
701-
},
702-
"actions": {
703-
"archive": {
704-
"description": "Only completed or canceled\nissues can be archived"
705-
}
706-
},
707716
"empty_state": {
708717
"issue_detail": {
709718
"title": "Issue does not exist",
@@ -717,6 +726,7 @@
717726
"label": "Sibling issues"
718727
},
719728
"archive": {
729+
"description": "Only completed or canceled\nissues can be archived",
720730
"label": "Archive Issue",
721731
"confirm_message": "Are you sure you want to archive the issue? All your archived issues can be restored later.",
722732
"success": {
@@ -726,6 +736,12 @@
726736
"failed": {
727737
"message": "Issue could not be archived. Please try again."
728738
}
739+
},
740+
"relation": {
741+
"relates_to": "Relates to",
742+
"duplicate": "Duplicate of",
743+
"blocked_by": "Blocked by",
744+
"blocking": "Blocking"
729745
}
730746
},
731747

web/ce/components/relations/index.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,28 +8,28 @@ export * from "./activity";
88
export const ISSUE_RELATION_OPTIONS: Record<TIssueRelationTypes, TRelationObject> = {
99
relates_to: {
1010
key: "relates_to",
11-
label: "Relates to",
11+
i18n_label: "issue.relation.relates_to",
1212
className: "bg-custom-background-80 text-custom-text-200",
1313
icon: (size) => <RelatedIcon height={size} width={size} className="text-custom-text-200" />,
1414
placeholder: "Add related issues",
1515
},
1616
duplicate: {
1717
key: "duplicate",
18-
label: "Duplicate of",
18+
i18n_label: "issue.relation.duplicate",
1919
className: "bg-custom-background-80 text-custom-text-200",
2020
icon: (size) => <CopyPlus size={size} className="text-custom-text-200" />,
2121
placeholder: "None",
2222
},
2323
blocked_by: {
2424
key: "blocked_by",
25-
label: "Blocked by",
25+
i18n_label: "issue.relation.blocked_by",
2626
className: "bg-red-500/20 text-red-700",
2727
icon: (size) => <CircleDot size={size} className="text-custom-text-200" />,
2828
placeholder: "None",
2929
},
3030
blocking: {
3131
key: "blocking",
32-
label: "Blocking",
32+
i18n_label: "issue.relation.blocking",
3333
className: "bg-yellow-500/20 text-yellow-700",
3434
icon: (size) => <XCircle size={size} className="text-custom-text-200" />,
3535
placeholder: "None",

web/core/components/home/widgets/links/use-links.tsx

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -36,17 +36,17 @@ export const useLinks = (workspaceSlug: string) => {
3636
if (!workspaceSlug) throw new Error("Missing required fields");
3737
await createLink(workspaceSlug, data);
3838
setToast({
39-
message: t("home.quick_links.toasts.created.message"),
39+
message: t("links.toasts.created.message"),
4040
type: TOAST_TYPE.SUCCESS,
41-
title: t("home.quick_links.toasts.created.title"),
41+
title: t("links.toasts.created.title"),
4242
});
4343
toggleLinkModal(false);
4444
} catch (error: any) {
4545
console.error("error", error);
4646
setToast({
47-
message: error?.data?.error ?? t("home.quick_links.toasts.not_created.message"),
47+
message: error?.data?.error ?? t("links.toasts.not_created.message"),
4848
type: TOAST_TYPE.ERROR,
49-
title: t("home.quick_links.toasts.not_created.title"),
49+
title: t("links.toasts.not_created.title"),
5050
});
5151
throw error;
5252
}
@@ -56,16 +56,16 @@ export const useLinks = (workspaceSlug: string) => {
5656
if (!workspaceSlug) throw new Error("Missing required fields");
5757
await updateLink(workspaceSlug, linkId, data);
5858
setToast({
59-
message: t("home.quick_links.toasts.updated.message"),
59+
message: t("links.toasts.updated.message"),
6060
type: TOAST_TYPE.SUCCESS,
61-
title: t("home.quick_links.toasts.updated.title"),
61+
title: t("links.toasts.updated.title"),
6262
});
6363
toggleLinkModal(false);
6464
} catch (error: any) {
6565
setToast({
66-
message: error?.data?.error ?? t("home.quick_links.toasts.not_updated.message"),
66+
message: error?.data?.error ?? t("links.toasts.not_updated.message"),
6767
type: TOAST_TYPE.ERROR,
68-
title: t("home.quick_links.toasts.not_updated.title"),
68+
title: t("links.toasts.not_updated.title"),
6969
});
7070
throw error;
7171
}
@@ -75,15 +75,15 @@ export const useLinks = (workspaceSlug: string) => {
7575
if (!workspaceSlug) throw new Error("Missing required fields");
7676
await removeLink(workspaceSlug, linkId);
7777
setToast({
78-
message: t("home.quick_links.toasts.removed.message"),
78+
message: t("links.toasts.removed.message"),
7979
type: TOAST_TYPE.SUCCESS,
80-
title: t("home.quick_links.toasts.removed.message"),
80+
title: t("links.toasts.removed.message"),
8181
});
8282
} catch (error: any) {
8383
setToast({
84-
message: error?.data?.error ?? t("home.quick_links.toasts.not_removed.message"),
84+
message: error?.data?.error ?? t("links.toasts.not_removed.message"),
8585
type: TOAST_TYPE.ERROR,
86-
title: t("home.quick_links.toasts.not_removed.title"),
86+
title: t("links.toasts.not_removed.title"),
8787
});
8888
}
8989
},

web/core/components/issues/issue-detail-widgets/action-buttons.tsx

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
"use client";
22
import React, { FC } from "react";
33
import { Layers, Link, Paperclip, Waypoints } from "lucide-react";
4+
//i18n
5+
import { useTranslation } from "@plane/i18n";
46
// components
57
import {
68
IssueAttachmentActionButton,
@@ -19,13 +21,14 @@ type Props = {
1921

2022
export const IssueDetailWidgetActionButtons: FC<Props> = (props) => {
2123
const { workspaceSlug, projectId, issueId, disabled } = props;
24+
const { t } = useTranslation();
2225
return (
2326
<div className="flex items-center flex-wrap gap-2">
2427
<SubIssuesActionButton
2528
issueId={issueId}
2629
customButton={
2730
<IssueDetailWidgetButton
28-
title="Add sub-issue"
31+
title={t("issue.add.sub_issue")}
2932
icon={<Layers className="h-3.5 w-3.5 flex-shrink-0" strokeWidth={2} />}
3033
disabled={disabled}
3134
/>
@@ -36,7 +39,7 @@ export const IssueDetailWidgetActionButtons: FC<Props> = (props) => {
3639
issueId={issueId}
3740
customButton={
3841
<IssueDetailWidgetButton
39-
title="Add relation"
42+
title={t("issue.add.relation")}
4043
icon={<Waypoints className="h-3.5 w-3.5 flex-shrink-0" strokeWidth={2} />}
4144
disabled={disabled}
4245
/>
@@ -46,7 +49,7 @@ export const IssueDetailWidgetActionButtons: FC<Props> = (props) => {
4649
<IssueLinksActionButton
4750
customButton={
4851
<IssueDetailWidgetButton
49-
title="Add link"
52+
title={t("issue.add.link")}
5053
icon={<Link className="h-3.5 w-3.5 flex-shrink-0" strokeWidth={2} />}
5154
disabled={disabled}
5255
/>
@@ -59,7 +62,7 @@ export const IssueDetailWidgetActionButtons: FC<Props> = (props) => {
5962
issueId={issueId}
6063
customButton={
6164
<IssueDetailWidgetButton
62-
title="Attach"
65+
title={t("common.attach")}
6366
icon={<Paperclip className="h-3.5 w-3.5 flex-shrink-0" strokeWidth={2} />}
6467
disabled={disabled}
6568
/>

web/core/components/issues/issue-detail-widgets/links/helper.tsx

Lines changed: 15 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
"use client";
22
import { useMemo } from "react";
33
import { EIssueServiceType } from "@plane/constants";
4+
import { useTranslation } from "@plane/i18n";
45
import { TIssueLink, TIssueServiceType } from "@plane/types";
56
import { TOAST_TYPE, setToast } from "@plane/ui";
67
// hooks
@@ -15,6 +16,8 @@ export const useLinkOperations = (
1516
issueServiceType: TIssueServiceType = EIssueServiceType.ISSUES
1617
): TLinkOperations => {
1718
const { createLink, updateLink, removeLink } = useIssueDetail(issueServiceType);
19+
// i18n
20+
const { t } = useTranslation();
1821

1922
const handleLinkOperations: TLinkOperations = useMemo(
2023
() => ({
@@ -23,15 +26,15 @@ export const useLinkOperations = (
2326
if (!workspaceSlug || !projectId || !issueId) throw new Error("Missing required fields");
2427
await createLink(workspaceSlug, projectId, issueId, data);
2528
setToast({
26-
message: "The link has been successfully created",
29+
message: t("links.toasts.created.message"),
2730
type: TOAST_TYPE.SUCCESS,
28-
title: "Link created",
31+
title: t("links.toasts.created.title"),
2932
});
3033
} catch (error: any) {
3134
setToast({
32-
message: error?.data?.error ?? "The link could not be created",
35+
message: error?.data?.error ?? t("links.toasts.not_created.message"),
3336
type: TOAST_TYPE.ERROR,
34-
title: "Link not created",
37+
title: t("links.toasts.not_created.title"),
3538
});
3639
throw error;
3740
}
@@ -41,15 +44,15 @@ export const useLinkOperations = (
4144
if (!workspaceSlug || !projectId || !issueId) throw new Error("Missing required fields");
4245
await updateLink(workspaceSlug, projectId, issueId, linkId, data);
4346
setToast({
44-
message: "The link has been successfully updated",
47+
message: t("links.toasts.updated.message"),
4548
type: TOAST_TYPE.SUCCESS,
46-
title: "Link updated",
49+
title: t("links.toasts.updated.title"),
4750
});
4851
} catch (error) {
4952
setToast({
50-
message: "The link could not be updated",
53+
message: t("links.toasts.not_updated.message"),
5154
type: TOAST_TYPE.ERROR,
52-
title: "Link not updated",
55+
title: t("links.toasts.not_updated.title"),
5356
});
5457
throw error;
5558
}
@@ -59,15 +62,15 @@ export const useLinkOperations = (
5962
if (!workspaceSlug || !projectId || !issueId) throw new Error("Missing required fields");
6063
await removeLink(workspaceSlug, projectId, issueId, linkId);
6164
setToast({
62-
message: "The link has been successfully removed",
65+
message: t("links.toasts.removed.message"),
6366
type: TOAST_TYPE.SUCCESS,
64-
title: "Link removed",
67+
title: t("links.toasts.removed.title"),
6568
});
6669
} catch (error) {
6770
setToast({
68-
message: "The link could not be removed",
71+
message: t("links.toasts.not_removed.message"),
6972
type: TOAST_TYPE.ERROR,
70-
title: "Link not removed",
73+
title: t("links.toasts.not_removed.title"),
7174
});
7275
}
7376
},

0 commit comments

Comments
 (0)