Skip to content

Commit 87ba85a

Browse files
committed
Move label and description to config file
1 parent 1a0ff7e commit 87ba85a

File tree

2 files changed

+16
-11
lines changed

2 files changed

+16
-11
lines changed

govtool/frontend/src/context/usersnapContext.tsx

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import React, {
66
useMemo,
77
} from "react";
88
import { InitOptions, WidgetApi, loadSpace } from "@usersnap/browser";
9+
import { useTranslation } from "react-i18next";
910

1011
type WidgetValues = {
1112
assignee?: string;
@@ -65,6 +66,7 @@ export const UsersnapProvider = ({
6566
children,
6667
}: UsersnapProviderProps) => {
6768
const [usersnapApi, setUsersnapApi] = useState<UsersnapAPI | null>(null);
69+
const { t } = useTranslation();
6870

6971
const openFeedbackWindow = useCallback(() => {
7072
if (usersnapApi) {
@@ -82,31 +84,31 @@ export const UsersnapProvider = ({
8284
customFields: {
8385
sentiment_score: {
8486
type: 'rating',
85-
label: 'How would you rate your experience?',
87+
label: t("feedback.sentimentScore"),
8688
required: true,
8789
options: [1, 2, 3, 4, 5]
8890
},
8991
additional_notes: {
9092
type: 'textarea',
91-
label: 'Additional Notes',
93+
label: t("feedback.additionalNotes"),
9294
required: false
9395
}
9496
},
9597
feedbackTypes: [
9698
{
9799
id: 'bug',
98-
label: 'Report a Bug',
99-
description: 'Something is not working as expected'
100+
label: t("feedback.reportBug"),
101+
description: t("feedback.reportBugDescription")
100102
},
101103
{
102104
id: 'idea',
103-
label: 'Suggest a New Idea',
104-
description: 'Share your ideas for improvement'
105+
label: t("feedback.suggestIdea"),
106+
description: t("feedback.suggestIdeaDescription")
105107
},
106108
{
107109
id: 'sentiment',
108-
label: 'Share Your Experience',
109-
description: 'Rate your experience and provide feedback'
110+
label: t("feedback.sentimentFeedback"),
111+
description: t("feedback.sentimentFeedbackDescription")
110112
}
111113
]
112114
});
@@ -117,7 +119,7 @@ export const UsersnapProvider = ({
117119
}
118120
};
119121
initUsersnapSpace();
120-
}, [initParams, API_KEY]);
122+
}, [initParams, API_KEY, t]);
121123

122124
const value = useMemo(() => ({ openFeedbackWindow }), [openFeedbackWindow]);
123125

govtool/frontend/src/i18n/locales/en.json

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -844,10 +844,13 @@
844844
"title": "Feedback",
845845
"reportBug": "Report a Bug",
846846
"suggestIdea": "Suggest a New Idea",
847-
"sentimentFeedback": "Share Your Experience",
847+
"sentimentFeedback": "Sentiment Feedback",
848848
"sentimentScore": "How would you rate your experience?",
849849
"additionalNotes": "Additional Notes",
850-
"submit": "Submit Feedback"
850+
"submit": "Submit Feedback",
851+
"reportBugDescription": "Something is not working as expected",
852+
"suggestIdeaDescription": "Share your ideas for improvement",
853+
"sentimentFeedbackDescription": "Rate your experience and provide feedback"
851854
},
852855
"filter": "Filter",
853856
"goBack": "Go back",

0 commit comments

Comments
 (0)