@@ -6,6 +6,7 @@ import React, {
66 useMemo ,
77} from "react" ;
88import { InitOptions , WidgetApi , loadSpace } from "@usersnap/browser" ;
9+ import { useTranslation } from "react-i18next" ;
910
1011type 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
0 commit comments