1+ "use client" ;
2+
13import React , { useState , useEffect } from "react" ;
24import ButtonsGroup from "../ButtonsGroup" ;
35import { fr } from "../fr" ;
46import { GdprService } from "../gdpr" ;
57import { getLink } from "../link" ;
68import { useGdprStore } from "../useGdprStore" ;
79import { ConsentBannerContentProps } from "./ConsentBannerContent" ;
10+ import { useTranslation } from "./i18n" ;
811
912const partition = < T , > ( arr : T [ ] , criteria : ( item : T ) => boolean ) : [ T [ ] , T [ ] ] => [
1013 arr . filter ( item => criteria ( item ) ) ,
@@ -23,6 +26,8 @@ export const ConsentManager = ({
2326 const consents = useGdprStore ( state => state . consents ) ;
2427 const [ accepted , setAccepted ] = useState < string [ ] > ( [ ] ) ;
2528
29+ const { t } = useTranslation ( ) ;
30+
2631 useEffect ( ( ) => {
2732 setAccepted ( [
2833 ...Object . entries ( consents )
@@ -69,9 +74,9 @@ export const ConsentManager = ({
6974 className = { fr . cx ( "fr-consent-service__title" ) }
7075 id = "fr-consent-service__title"
7176 >
72- Préférences pour tous les services.
77+ { t ( "all services pref" ) }
7378 < br />
74- < Link href = { gdprPageLink } > Données personnelles et cookies</ Link >
79+ < Link href = { gdprPageLink } > { t ( "personal data cookies" ) } </ Link >
7580 </ legend >
7681 < div className = { fr . cx ( "fr-consent-service__radios" ) } >
7782 < ButtonsGroup
@@ -80,13 +85,13 @@ export const ConsentManager = ({
8085 buttons = { [
8186 {
8287 onClick : ( ) => accept ( ) ,
83- title : "Tout accepter" ,
84- children : "Tout accepter"
88+ title : t ( "accept all" ) ,
89+ children : t ( "accept all" )
8590 } ,
8691 {
8792 onClick : ( ) => refuse ( ) ,
88- title : "Tout refuser" ,
89- children : "Tout refuser" ,
93+ title : t ( "refuse all" ) ,
94+ children : t ( "refuse all" ) ,
9095 priority : "secondary"
9196 }
9297 ] }
@@ -119,7 +124,7 @@ export const ConsentManager = ({
119124 htmlFor = { `consent-finality-${ index } -accept` }
120125 className = { fr . cx ( "fr-label" ) }
121126 >
122- Accepter
127+ { t ( "accept" ) }
123128 </ label >
124129 </ div >
125130 < div className = { fr . cx ( "fr-radio-group" ) } >
@@ -137,7 +142,7 @@ export const ConsentManager = ({
137142 htmlFor = { `consent-finality-${ index } -refuse` }
138143 className = { fr . cx ( "fr-label" ) }
139144 >
140- Refuser
145+ { t ( "refuse" ) }
141146 </ label >
142147 </ div >
143148 </ div >
@@ -157,8 +162,8 @@ export const ConsentManager = ({
157162 buttons = { [
158163 {
159164 ...consentModalButtonProps ,
160- children : "Confirmer mes choix" ,
161- title : "Confirmer mes choix" ,
165+ children : t ( "confirm choices" ) ,
166+ title : t ( "confirm choices" ) ,
162167 onClick : ( ) => confirm ( )
163168 }
164169 ] }
0 commit comments