diff --git a/src/Components/Notifications/NoticeBoard.tsx b/src/Components/Notifications/NoticeBoard.tsx index 05e0728c6ad..8ce910e2e73 100644 --- a/src/Components/Notifications/NoticeBoard.tsx +++ b/src/Components/Notifications/NoticeBoard.tsx @@ -5,11 +5,13 @@ import PageTitle from "../Common/PageTitle"; import { Card, CardContent } from "@material-ui/core"; import Loading from "../Common/Loading"; import { formatDate } from "../../Utils/utils"; +import { useTranslation } from "react-i18next"; export const NoticeBoard: any = () => { const dispatch: any = useDispatch(); const [isLoading, setIsLoading] = useState(true); const [data, setData] = useState([]); + const { t } = useTranslation(); useEffect(() => { setIsLoading(true); @@ -43,7 +45,7 @@ export const NoticeBoard: any = () => {
- On: {formatDate(item.created_date)} + {t("on")}: {formatDate(item.created_date)}
@@ -56,7 +58,7 @@ export const NoticeBoard: any = () => {
- No notices for you. + {t("no_notices_for_you")}
@@ -66,7 +68,11 @@ export const NoticeBoard: any = () => { if (isLoading) return ; return (
- +
{notices}
); diff --git a/src/Components/Notifications/NotificationsList.tsx b/src/Components/Notifications/NotificationsList.tsx index 21c30f74ba1..6ca6aca336d 100644 --- a/src/Components/Notifications/NotificationsList.tsx +++ b/src/Components/Notifications/NotificationsList.tsx @@ -24,6 +24,7 @@ import { import SlideOver from "../../CAREUI/interactive/SlideOver"; import ButtonV2 from "../Common/components/ButtonV2"; import SelectMenuV2 from "../Form/SelectMenuV2"; +import { useTranslation } from "react-i18next"; const RESULT_LIMIT = 14; @@ -41,6 +42,7 @@ const NotificationTile = ({ const dispatch: any = useDispatch(); const [result, setResult] = useState(notification); const [isMarkingAsRead, setIsMarkingAsRead] = useState(false); + const { t } = useTranslation(); const handleMarkAsRead = async () => { setIsMarkingAsRead(true); @@ -124,7 +126,7 @@ const NotificationTile = ({ : "care-l-envelope-check" } /> - Mark as Read + {t("mark_as_read")} - Open + {t("open")} @@ -164,6 +166,7 @@ export default function NotificationsList({ const [isMarkingAllAsRead, setIsMarkingAllAsRead] = useState(false); const [isSubscribed, setIsSubscribed] = useState(""); const [isSubscribing, setIsSubscribing] = useState(false); + const { t } = useTranslation(); useEffect(() => { function handleKeyDown(event: KeyboardEvent) { @@ -208,21 +211,21 @@ export default function NotificationsList({ return ( <> - Subscribe + {t("subscribe")} ); } else if (status === "SubscribedOnAnotherDevice") { return ( <> - Subscribe on this device + {t("subscribe_on_this_device")} ); } else { return ( <> - Unsubscribe + {t("unsubscribe")} ); } @@ -254,12 +257,12 @@ export default function NotificationsList({ }) .catch(function (_e) { Error({ - msg: "Unsubscribe failed.", + msg: t("unsubscribe_failed"), }); }); }) .catch(function (_e) { - Error({ msg: "Subscription Error" }); + Error({ msg: t("subscription_error") }); }); }) .catch(function (_e) { @@ -376,7 +379,7 @@ export default function NotificationsList({ border onClick={() => setOffset((prev) => prev + RESULT_LIMIT)} > - {isLoading ? "Loading..." : "Load More"} + {isLoading ? t("loading") : t("load_more")} )} @@ -385,7 +388,7 @@ export default function NotificationsList({ } else if (data && data.length === 0) { manageResults = (
-
No Results Found
+
{t("no_results_found")}
); } @@ -395,7 +398,7 @@ export default function NotificationsList({ return ( <> setOpen(!open)} icon={} badgeCount={unreadCount} @@ -404,7 +407,7 @@ export default function NotificationsList({ open={open} setOpen={setOpen} slideFrom="right" - title="Notifications" + title={t("Notifications")} dialogClass="md:w-[400px]" onCloseClick={onClickCB} > @@ -421,7 +424,7 @@ export default function NotificationsList({ }} > - Reload + {t("reload")} - Mark all as Read + {t("mark_all_as_read")} o.text} diff --git a/src/Locale/en/Common.json b/src/Locale/en/Common.json index 024ba3cfe85..9a7389fd1e1 100644 --- a/src/Locale/en/Common.json +++ b/src/Locale/en/Common.json @@ -20,5 +20,7 @@ "Apply": "Apply", "Clear Filters": "Clear Filters", "powered_by": "Powered By", - "care": "CARE" + "care": "CARE", + "on": "On", + "open": "Open" } \ No newline at end of file diff --git a/src/Locale/en/Notifications.json b/src/Locale/en/Notifications.json new file mode 100644 index 00000000000..a4770af5618 --- /dev/null +++ b/src/Locale/en/Notifications.json @@ -0,0 +1,17 @@ +{ + "no_notices_for_you": "No notices for you.", + "mark_as_read": "Mark as Read", + "subscribe": "Subscribe", + "subscribe_on_this_device": "Subscribe on this device", + "filter_by_category": "Filter by category", + "mark_all_as_read": "Mark all as Read", + "reload": "Reload", + "Notifications": "Notifications", + "no_results_found": "No Results Found", + "load_more": "Load More", + "subscription_error": "Subscription Error", + "unsubscribe_failed": "Unsubscribe failed.", + "unsubscribe": "Unsubscribe", + "escape": "Escape", + "loading": "Loading..." +} diff --git a/src/Locale/en/index.js b/src/Locale/en/index.js index cbf1d10c3b9..3f2d0aad0c0 100644 --- a/src/Locale/en/index.js +++ b/src/Locale/en/index.js @@ -2,10 +2,12 @@ import Auth from "./Auth.json"; import Common from "./Common.json"; import Entities from "./Entities.json"; import Facility from "./Facility.json"; +import Notifications from "./Notifications.json"; export default { ...Auth, ...Common, ...Entities, ...Facility, + ...Notifications, };