@@ -20,8 +20,8 @@ import React, { useMemo, useState } from 'react';
20
20
import { FormattedMessage , useIntl } from 'react-intl' ;
21
21
import CsvDownloader from 'react-csv-downloader' ;
22
22
import { useWatch } from 'react-hook-form' ;
23
- import { FieldConstants } from '../../../../../utils/constants/fieldConstants ' ;
24
- import { CancelButton } from '../../utils/CancelButton ' ;
23
+ import { FieldConstants , GsLang , LANG_FRENCH } from '../../../../../utils' ;
24
+ import { CancelButton } from '../../utils' ;
25
25
26
26
export interface CsvUploaderProps {
27
27
name : string ;
@@ -34,6 +34,7 @@ export interface CsvUploaderProps {
34
34
validateData : ( rows : string [ ] [ ] ) => boolean ;
35
35
getDataFromCsv : any ;
36
36
useFieldArrayOutput : any ;
37
+ language : GsLang ;
37
38
}
38
39
39
40
export function CsvUploader ( {
@@ -47,6 +48,7 @@ export function CsvUploader({
47
48
validateData = ( ) => true ,
48
49
getDataFromCsv,
49
50
useFieldArrayOutput,
51
+ language,
50
52
} : Readonly < CsvUploaderProps > ) {
51
53
const watchTableValues = useWatch ( { name } ) ;
52
54
const { append, replace } = useFieldArrayOutput ;
@@ -178,7 +180,11 @@ export function CsvUploader({
178
180
< Grid container spacing = { 2 } >
179
181
< Grid container item >
180
182
< Grid item xs = { 6 } >
181
- < CsvDownloader datas = { data } filename = { fileName } separator = "," >
183
+ < CsvDownloader
184
+ datas = { data }
185
+ filename = { fileName }
186
+ separator = { language === LANG_FRENCH ? ';' : ',' }
187
+ >
182
188
< Button variant = "contained" >
183
189
< FormattedMessage id = "GenerateCSV" />
184
190
</ Button >
@@ -194,6 +200,7 @@ export function CsvUploader({
194
200
config = { {
195
201
// We use | for multi values in one cell, then we remove it from the default value for this config, to avoid delimiter autodetection
196
202
delimitersToGuess : [ ',' , ' ' , ';' , RECORD_SEP , UNIT_SEP ] ,
203
+ delimiter : language === LANG_FRENCH ? ';' : ',' ,
197
204
} }
198
205
>
199
206
{ ( { getRootProps, acceptedFile } : any ) => (
0 commit comments