Skip to content

Commit

Permalink
use translation for buttons
Browse files Browse the repository at this point in the history
  • Loading branch information
andracc committed Dec 18, 2024
1 parent ce7b9dc commit d7d1e61
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 8 deletions.
14 changes: 8 additions & 6 deletions public/locales/en/translation.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down Expand Up @@ -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"
Expand Down
11 changes: 9 additions & 2 deletions src/components/AnalyticsConsent/AnalyticsConsent.tsx
Original file line number Diff line number Diff line change
@@ -1,13 +1,16 @@
import { List, ListItemButton, 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;
required: boolean;
}

export function AnalyticsConsent(props: ConsentProps): ReactElement {
const { t } = useTranslation();

const acceptAnalytics = (): void => {
props.onChangeConsent(true);
};
Expand All @@ -31,13 +34,17 @@ export function AnalyticsConsent(props: ConsentProps): ReactElement {
onClick={acceptAnalytics}
style={{ justifyContent: "center" }}
>
<Typography>Accept</Typography>
<Typography>
{t("analyticsConsent.consentModal.acceptAllBtn")}
</Typography>
</ListItemButton>
<ListItemButton
onClick={rejectAnalytics}
style={{ justifyContent: "center" }}
>
<Typography>Reject</Typography>
<Typography>
{t("analyticsConsent.consentModal.acceptNecessaryBtn")}
</Typography>
</ListItemButton>
</List>
</Drawer>
Expand Down

0 comments on commit d7d1e61

Please sign in to comment.