From 49efc4fd7b02d8f5467491c5ff978aa4ebb15c65 Mon Sep 17 00:00:00 2001 From: Andra Constantin Date: Wed, 18 Dec 2024 13:35:20 -0500 Subject: [PATCH] use translation for buttons --- public/locales/en/translation.json | 14 ++++++++------ .../AnalyticsConsent/AnalyticsConsent.tsx | 13 ++++++++++--- 2 files changed, 18 insertions(+), 9 deletions(-) diff --git a/public/locales/en/translation.json b/public/locales/en/translation.json index 7e757db4b4..7df6a4b104 100644 --- a/public/locales/en/translation.json +++ b/public/locales/en/translation.json @@ -33,6 +33,14 @@ "pressEnter": "Press Enter to save word", "vernacular": "Vernacular" }, + "analyticsConsent": { + "consentModal": { + "acceptAllBtn": "Yes, allow analytics cookies", + "acceptNecessaryBtn": "No, reject analytics cookies", + "description": "The Combine stores basic info about your current session on your device. This info is necessary and isn't shared with anybody. The Combine also uses analytics cookies, which are only for us to fix bugs and compile anonymized statistics. Do you consent to our usage of analytics cookies?", + "title": "Cookies on The Combine" + } + }, "appBar": { "dataEntry": "Data Entry", "dataCleanup": "Data Cleanup", @@ -129,12 +137,6 @@ "userSettings": { "analyticsConsent": { "button": "Change consent", - "consentModal": { - "acceptAllBtn": "Yes, allow analytics cookies", - "acceptNecessaryBtn": "No, reject analytics cookies", - "description": "The Combine stores basic info about your current session on your device. This info is necessary and isn't shared with anybody. The Combine also uses analytics cookies, which are only for us to fix bugs and compile anonymized statistics. Do you consent to our usage of analytics cookies?", - "title": "Cookies on The Combine" - }, "consentNo": "You have not consented to our use of analytics cookies.", "consentYes": "You have consented to our use of analytics cookies.", "title": "Analytics cookies" diff --git a/src/components/AnalyticsConsent/AnalyticsConsent.tsx b/src/components/AnalyticsConsent/AnalyticsConsent.tsx index 3326d4f4eb..3540af7a1a 100644 --- a/src/components/AnalyticsConsent/AnalyticsConsent.tsx +++ b/src/components/AnalyticsConsent/AnalyticsConsent.tsx @@ -1,6 +1,7 @@ -import { List, ListItemButton, Typography } from "@mui/material"; +import { List, ListItemButton, ListSubheader, Typography } from "@mui/material"; import Drawer from "@mui/material/Drawer"; import { ReactElement } from "react"; +import { useTranslation } from "react-i18next"; interface ConsentProps { onChangeConsent: (consentVal: boolean | undefined) => void; @@ -8,6 +9,8 @@ interface ConsentProps { } export function AnalyticsConsent(props: ConsentProps): ReactElement { + const { t } = useTranslation(); + const acceptAnalytics = (): void => { props.onChangeConsent(true); }; @@ -31,13 +34,17 @@ export function AnalyticsConsent(props: ConsentProps): ReactElement { onClick={acceptAnalytics} style={{ justifyContent: "center" }} > - Accept + + {t("analyticsConsent.consentModal.acceptAllBtn")} + - Reject + + {t("analyticsConsent.consentModal.acceptNecessaryBtn")} +