Skip to content

Commit fdff476

Browse files
chore: notification language support and refactor
1 parent 7f19caf commit fdff476

File tree

18 files changed

+157
-52
lines changed

18 files changed

+157
-52
lines changed

packages/constants/src/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ export * from "./graph";
99
export * from "./instance";
1010
export * from "./issue";
1111
export * from "./metadata";
12+
export * from "./notification";
1213
export * from "./state";
1314
export * from "./swr";
1415
export * from "./user";
Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -29,12 +29,13 @@ export type TNotificationTab = ENotificationTab.ALL | ENotificationTab.MENTIONS;
2929

3030
export const NOTIFICATION_TABS = [
3131
{
32-
label: "All",
32+
i18n_label: "notification.tabs.all",
3333
value: ENotificationTab.ALL,
34-
count: (unReadNotification: TUnreadNotificationsCount) => unReadNotification?.total_unread_notifications_count || 0,
34+
count: (unReadNotification: TUnreadNotificationsCount) =>
35+
unReadNotification?.total_unread_notifications_count || 0,
3536
},
3637
{
37-
label: "Mentions",
38+
i18n_label: "notification.tabs.mentions",
3839
value: ENotificationTab.MENTIONS,
3940
count: (unReadNotification: TUnreadNotificationsCount) =>
4041
unReadNotification?.mention_unread_notifications_count || 0,
@@ -43,63 +44,63 @@ export const NOTIFICATION_TABS = [
4344

4445
export const FILTER_TYPE_OPTIONS = [
4546
{
46-
label: "Assigned to me",
47+
i18n_label: "notification.filter_type_options.assigned_to_me",
4748
value: ENotificationFilterType.ASSIGNED,
4849
},
4950
{
50-
label: "Created by me",
51+
i18n_label: "notification.filter_type_options.created_by_me",
5152
value: ENotificationFilterType.CREATED,
5253
},
5354
{
54-
label: "Subscribed by me",
55+
i18n_label: "notification.filter_type_options.subscribed_by_me",
5556
value: ENotificationFilterType.SUBSCRIBED,
5657
},
5758
];
5859

5960
export const NOTIFICATION_SNOOZE_OPTIONS = [
6061
{
6162
key: "1_day",
62-
label: "1 day",
63+
i18n_label: "notification.snooze_options.1_day",
6364
value: () => {
6465
const date = new Date();
6566
return new Date(date.getTime() + 24 * 60 * 60 * 1000);
6667
},
6768
},
6869
{
6970
key: "3_days",
70-
label: "3 days",
71+
i18n_label: "notification.snooze_options.3_days",
7172
value: () => {
7273
const date = new Date();
7374
return new Date(date.getTime() + 3 * 24 * 60 * 60 * 1000);
7475
},
7576
},
7677
{
7778
key: "5_days",
78-
label: "5 days",
79+
i18n_label: "notification.snooze_options.5_days",
7980
value: () => {
8081
const date = new Date();
8182
return new Date(date.getTime() + 5 * 24 * 60 * 60 * 1000);
8283
},
8384
},
8485
{
8586
key: "1_week",
86-
label: "1 week",
87+
i18n_label: "notification.snooze_options.1_week",
8788
value: () => {
8889
const date = new Date();
8990
return new Date(date.getTime() + 7 * 24 * 60 * 60 * 1000);
9091
},
9192
},
9293
{
9394
key: "2_weeks",
94-
label: "2 weeks",
95+
i18n_label: "notification.snooze_options.2_weeks",
9596
value: () => {
9697
const date = new Date();
9798
return new Date(date.getTime() + 14 * 24 * 60 * 60 * 1000);
9899
},
99100
},
100101
{
101102
key: "custom",
102-
label: "Custom",
103+
i18n_label: "notification.snooze_options.custom",
103104
value: undefined,
104105
},
105106
];

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

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -969,6 +969,7 @@
969969
},
970970

971971
"notification": {
972+
"label": "Notifications",
972973
"empty_state": {
973974
"detail": {
974975
"title": "Select to view details."
@@ -981,6 +982,23 @@
981982
"title": "No issues assigned",
982983
"description": "Updates for issues assigned to you can be \n seen here"
983984
}
985+
},
986+
"tabs": {
987+
"all": "All",
988+
"mentions": "Mentions"
989+
},
990+
"filter_type_options": {
991+
"assigned_to_me": "Assigned to me",
992+
"created_by_me": "Created by me",
993+
"subscribed_by_me": "Subscribed by me"
994+
},
995+
"snooze_options": {
996+
"1_day": "1 day",
997+
"3_days": "3 days",
998+
"5_days": "5 days",
999+
"1_week": "1 week",
1000+
"2_weeks": "2 weeks",
1001+
"custom": "Custom"
9841002
}
9851003
},
9861004

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

Lines changed: 23 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -355,7 +355,7 @@
355355
"description": "Elige tu foto, colores y más.",
356356
"cta": "Personalizar ahora"
357357
},
358-
"widgets": {
358+
"widgets": {
359359
"title": "Está tranquilo sin widgets, actívalos",
360360
"description": "Parece que todos tus widgets están desactivados. ¡Enciéndelos ahora para mejorar tu experiencia!",
361361
"primary_button": {
@@ -393,16 +393,15 @@
393393
"title": "Enlace no eliminado",
394394
"message": "No se pudo eliminar el enlace"
395395
}
396-
397396
}
398397
},
399398
"recents": {
400399
"title": "Recientes",
401400
"empty": {
402-
"project": "Tus proyectos recientes aparecerán aquí cuando visites uno.",
403-
"page": "Tus páginas recientes aparecerán aquí cuando visites una.",
404-
"issue": "Tus problemas recientes aparecerán aquí cuando visites uno.",
405-
"default": "Aún no tienes elementos recientes."
401+
"project": "Tus proyectos recientes aparecerán aquí cuando visites uno.",
402+
"page": "Tus páginas recientes aparecerán aquí cuando visites una.",
403+
"issue": "Tus problemas recientes aparecerán aquí cuando visites uno.",
404+
"default": "Aún no tienes elementos recientes."
406405
},
407406
"filters": {
408407
"all": "Todos los elementos",
@@ -429,7 +428,6 @@
429428
"star_us_on_github": "Danos una estrella en GitHub"
430429
},
431430

432-
433431
"link": {
434432
"modal": {
435433
"url": {
@@ -973,6 +971,7 @@
973971
},
974972

975973
"notification": {
974+
"label": "Notificaciones",
976975
"empty_state": {
977976
"detail": {
978977
"title": "Selecciona para ver los detalles."
@@ -985,6 +984,23 @@
985984
"title": "No hay problemas asignados",
986985
"description": "Las actualizaciones de los problemas asignados a ti se \n pueden ver aquí"
987986
}
987+
},
988+
"tabs": {
989+
"all": "Todas",
990+
"mentions": "Menciones"
991+
},
992+
"filter_type_options": {
993+
"assigned_to_me": "Asignadas a mí",
994+
"created_by_me": "Creadas por mí",
995+
"subscribed_by_me": "Suscritas por mí"
996+
},
997+
"snooze_options": {
998+
"1_day": "1 día",
999+
"3_days": "3 días",
1000+
"5_days": "5 días",
1001+
"1_week": "1 semana",
1002+
"2_weeks": "2 semanas",
1003+
"custom": "Personalizado"
9881004
}
9891005
},
9901006

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

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -968,6 +968,7 @@
968968
},
969969

970970
"notification": {
971+
"label": "Notifications",
971972
"empty_state": {
972973
"detail": {
973974
"title": "Sélectionnez pour voir les détails."
@@ -980,6 +981,23 @@
980981
"title": "Aucune tâche assignée",
981982
"description": "Les mises à jour des problèmes qui vous sont assignés peuvent être \n vues ici."
982983
}
984+
},
985+
"tabs": {
986+
"all": "Toutes",
987+
"mentions": "Mentions"
988+
},
989+
"filter_type_options": {
990+
"assigned_to_me": "Assignées à moi",
991+
"created_by_me": "Créées par moi",
992+
"subscribed_by_me": "Suivies par moi"
993+
},
994+
"snooze_options": {
995+
"1_day": "1 jour",
996+
"3_days": "3 jours",
997+
"5_days": "5 jours",
998+
"1_week": "1 semaine",
999+
"2_weeks": "2 semaines",
1000+
"custom": "Personnalisé"
9831001
}
9841002
},
9851003

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

Lines changed: 23 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -399,10 +399,10 @@
399399
"recents": {
400400
"title": "最近",
401401
"empty": {
402-
"project": "プロジェクトを訪問すると、最近のプロジェクトがここに表示されます。",
403-
"page": "ページを訪問すると、最近のページがここに表示されます。",
404-
"issue": "課題を訪問すると、最近の課題がここに表示されます。",
405-
"default": "最近のアイテムはまだありません。"
402+
"project": "プロジェクトを訪問すると、最近のプロジェクトがここに表示されます。",
403+
"page": "ページを訪問すると、最近のページがここに表示されます。",
404+
"issue": "課題を訪問すると、最近の課題がここに表示されます。",
405+
"default": "最近のアイテムはまだありません。"
406406
},
407407
"filters": {
408408
"all": "すべてのアイテム",
@@ -441,7 +441,7 @@
441441
}
442442
}
443443
},
444-
444+
445445
"common": {
446446
"all": "すべて",
447447
"states": "ステータス",
@@ -971,6 +971,7 @@
971971
},
972972

973973
"notification": {
974+
"label": "通知",
974975
"empty_state": {
975976
"detail": {
976977
"title": "詳細を表示するには選択してください。"
@@ -983,6 +984,23 @@
983984
"title": "割り当てられた問題はありません",
984985
"description": "あなたに割り当てられた問題の更新情報はここで確認できます。"
985986
}
987+
},
988+
"tabs": {
989+
"all": "すべて",
990+
"mentions": "メンション"
991+
},
992+
"filter_type_options": {
993+
"assigned_to_me": "自分に割り当て",
994+
"created_by_me": "自分が作成",
995+
"subscribed_by_me": "自分が購読"
996+
},
997+
"snooze_options": {
998+
"1_day": "1日",
999+
"3_days": "3日",
1000+
"5_days": "5日",
1001+
"1_week": "1週間",
1002+
"2_weeks": "2週間",
1003+
"custom": "カスタム"
9861004
}
9871005
},
9881006

packages/i18n/src/locales/zh-CN/translations.json

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -763,5 +763,26 @@
763763
"message": "无法删除便签"
764764
}
765765
}
766+
},
767+
768+
"notification": {
769+
"label": "通知",
770+
"tabs": {
771+
"all": "全部",
772+
"mentions": "提及"
773+
},
774+
"filter_type_options": {
775+
"assigned_to_me": "分配给我的",
776+
"created_by_me": "我创建的",
777+
"subscribed_by_me": "我订阅的"
778+
},
779+
"snooze_options": {
780+
"1_day": "1天",
781+
"3_days": "3天",
782+
"5_days": "5天",
783+
"1_week": "1周",
784+
"2_weeks": "2周",
785+
"custom": "自定义"
786+
}
766787
}
767788
}

web/app/[workspaceSlug]/(projects)/notifications/page.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,14 @@ import { observer } from "mobx-react";
55
import { useParams } from "next/navigation";
66
import useSWR from "swr";
77
// plane imports
8+
import { ENotificationLoader, ENotificationQueryParamType } from "@plane/constants";
89
import { useTranslation } from "@plane/i18n";
910
// components
1011
import { LogoSpinner } from "@/components/common";
1112
import { PageHead } from "@/components/core";
1213
import { SimpleEmptyState } from "@/components/empty-state";
1314
import { InboxContentRoot } from "@/components/inbox";
1415
import { IssuePeekOverview } from "@/components/issues";
15-
import { ENotificationLoader, ENotificationQueryParamType } from "@/constants/notification";
1616
// hooks
1717
import { useIssueDetail, useUserPermissions, useWorkspace, useWorkspaceNotifications } from "@/hooks/store";
1818
import { useResolvedAssetPath } from "@/hooks/use-resolved-asset-path";

web/ce/components/workspace-notifications/notification-card/root.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,11 @@
22

33
import { FC } from "react";
44
import { observer } from "mobx-react";
5+
// plane imports
6+
import { ENotificationLoader, ENotificationQueryParamType } from "@plane/constants";
57
// components
68
import { NotificationItem } from "@/components/workspace-notifications";
79
// constants
8-
import { ENotificationLoader, ENotificationQueryParamType } from "@/constants/notification";
910
// hooks
1011
import { useWorkspaceNotifications } from "@/hooks/store";
1112

web/core/components/workspace-notifications/root.tsx

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,9 @@
33
import { FC, useCallback } from "react";
44
import { observer } from "mobx-react";
55
import { useParams } from "next/navigation";
6+
// plane imports
7+
import { NOTIFICATION_TABS, TNotificationTab } from "@plane/constants";
8+
import { useTranslation } from "@plane/i18n";
69
// components
710
import { Header, Row, ERowVariant, EHeaderVariant, ContentWrapper } from "@plane/ui";
811
import { CountChip } from "@/components/common";
@@ -12,16 +15,12 @@ import {
1215
NotificationSidebarHeader,
1316
AppliedFilters,
1417
} from "@/components/workspace-notifications";
15-
// constants
16-
import { NOTIFICATION_TABS, TNotificationTab } from "@/constants/notification";
1718
// helpers
1819
import { cn } from "@/helpers/common.helper";
1920
import { getNumberCount } from "@/helpers/string.helper";
2021
// hooks
2122
import { useWorkspace, useWorkspaceNotifications } from "@/hooks/store";
22-
2323
import { NotificationCardListRoot } from "@/plane-web/components/workspace-notifications";
24-
2524
export const NotificationsSidebarRoot: FC = observer(() => {
2625
const { workspaceSlug } = useParams();
2726
// hooks
@@ -34,6 +33,8 @@ export const NotificationsSidebarRoot: FC = observer(() => {
3433
currentNotificationTab,
3534
setCurrentNotificationTab,
3635
} = useWorkspaceNotifications();
36+
37+
const { t } = useTranslation();
3738
// derived values
3839
const workspace = workspaceSlug ? getWorkspaceBySlug(workspaceSlug.toString()) : undefined;
3940
const notificationIds = workspace ? notificationIdsByWorkspaceId(workspace.id) : undefined;
@@ -76,7 +77,7 @@ export const NotificationsSidebarRoot: FC = observer(() => {
7677
: "text-custom-text-100 hover:text-custom-text-200"
7778
)}
7879
>
79-
<div className="font-medium">{tab.label}</div>
80+
<div className="font-medium">{t(tab.i18n_label)}</div>
8081
{tab.count(unreadNotificationsCount) > 0 && (
8182
<CountChip count={getNumberCount(tab.count(unreadNotificationsCount))} />
8283
)}

0 commit comments

Comments
 (0)