Skip to content

Commit e697bb0

Browse files
authored
fix: Merge pull request #445 from CedricProfessionnel/translationInCognitoImportExport
translation of cognito
2 parents a37f26d + cd426ca commit e697bb0

File tree

14 files changed

+152
-103
lines changed

14 files changed

+152
-103
lines changed

cypress/utils/function-test/get-data-url-type.spec.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ const getDataUrlTypeTest = () => {
1818
"PDF"
1919
)
2020
expect(getDataUrlType("https://arxiv.org/pdf/1908.07069.txt")).to.equal(
21-
"Texte"
21+
"Text"
2222
)
2323
expect(getDataUrlType("https://arxiv.org/pdf/1908.07069.js")).to.equal(
2424
"File"

public/legal.html

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,19 +10,19 @@
1010
<body>
1111
<div
1212
id="header"
13-
style="display: inline-flex; justify-content: space-between; width: 100%"
13+
style="display: inline-flex; justify-content: space-between; width: 100%;"
1414
>
15-
<img src="./favicon.ico" style="height: 100%" />
16-
<div style="display: flex; width: 100%">
17-
<a style="margin: auto" href="https://universaldatatool.com">
15+
<img src="./favicon.ico" style="height: 100%;" />
16+
<div style="display: flex; width: 100%;">
17+
<a style="margin: auto;" href="https://universaldatatool.com">
1818
<h1>Universal Data Tool</h1>
1919
</a>
2020
</div>
21-
<img src="./favicon.ico" style="height: 100%" />
21+
<img src="./favicon.ico" style="height: 100%;" />
2222
</div>
2323
<div
2424
id="terms-and-conditions-wrapper"
25-
style="padding-right: 5vw; padding-left: 5vw; padding-top: 2vh"
25+
style="padding-right: 5vw; padding-left: 5vw; padding-top: 2vh;"
2626
>
2727
<h1>Terms and Conditions of Use</h1>
2828
<h3>1. Terms</h3>

src/components/ExportToCognitoS3Dialog/index.js

Lines changed: 35 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,9 @@ import isEmpty from "lodash/isEmpty"
66
import datasetManagerCognito from "udt-dataset-managers/dist/CognitoDatasetManager"
77
import useAuth from "../../utils/auth-handlers/use-auth"
88
import { Grid, TextField } from "@material-ui/core"
9+
import { useTranslation } from "react-i18next"
910
const redText = { color: "orange" }
1011

11-
const expandedAnnotationsColumns = [
12-
{ name: "Annotations", selector: "annotation" },
13-
{ name: "Last Modified", selector: "lastModified", sortable: true },
14-
]
15-
16-
const columns = [{ name: "Projects", selector: "folder", sortable: true }]
17-
1812
const customStyles = {
1913
headCells: {
2014
style: {
@@ -29,31 +23,6 @@ const customStyles = {
2923
},
3024
}
3125

32-
const ExpandedRow = ({ data }) => {
33-
const { rowAnnotations } = data
34-
return (
35-
<>
36-
<DataTable
37-
style={{
38-
boxSizing: "border-box",
39-
paddingLeft: "50px",
40-
paddingRight: "10px",
41-
}}
42-
dense
43-
striped
44-
noHeader
45-
columns={expandedAnnotationsColumns}
46-
data={rowAnnotations}
47-
noDataComponent='Make sure the project has "samples" folder'
48-
pagination={rowAnnotations.length > 10}
49-
paginationPerPage={10}
50-
paginationRowsPerPageOptions={[10, 20, 25, 50, 100, 200]}
51-
customStyles={customStyles}
52-
/>
53-
</>
54-
)
55-
}
56-
5726
export default ({ open, onClose }) => {
5827
const [dm, setDm] = useState()
5928
const { authConfig } = useAuth()
@@ -62,6 +31,36 @@ export default ({ open, onClose }) => {
6231
const [nameProjectToCreate, setNameProjectToCreate] = useState("")
6332
const [nameProjectExist, setNameProjectExist] = useState(false)
6433
const [currentDataset, setCurrentDataset] = useState()
34+
const { t } = useTranslation()
35+
const columns = [{ name: t("projects"), selector: "folder", sortable: true }]
36+
const expandedAnnotationsColumns = [
37+
{ name: t("annotations"), selector: "annotation" },
38+
{ name: t("last-modified"), selector: "lastModified", sortable: true },
39+
]
40+
const ExpandedRow = ({ data }) => {
41+
const { rowAnnotations } = data
42+
return (
43+
<>
44+
<DataTable
45+
style={{
46+
boxSizing: "border-box",
47+
paddingLeft: "50px",
48+
paddingRight: "10px",
49+
}}
50+
dense
51+
striped
52+
noHeader
53+
columns={expandedAnnotationsColumns}
54+
data={rowAnnotations}
55+
noDataComponent={t("has-samples-folder")}
56+
pagination={rowAnnotations.length > 10}
57+
paginationPerPage={10}
58+
paginationRowsPerPageOptions={[10, 20, 25, 50, 100, 200]}
59+
customStyles={customStyles}
60+
/>
61+
</>
62+
)
63+
}
6564

6665
const getCurrentDataset = async () => {
6766
if (currentDataset) return currentDataset
@@ -143,12 +142,12 @@ export default ({ open, onClose }) => {
143142

144143
return (
145144
<SimpleDialog
146-
title="Export Project"
145+
title={t("export-project")}
147146
open={open}
148147
onClose={onClose}
149148
actions={[
150149
{
151-
text: "Create project",
150+
text: t("create-project"),
152151
onClick: () => {
153152
handleCreateProject()
154153
},
@@ -159,18 +158,15 @@ export default ({ open, onClose }) => {
159158
<Grid container spacing={0}>
160159
<Grid container item xs={12} spacing={0} justify="center">
161160
{nameProjectExist ? (
162-
<p style={redText}>
163-
Warning : This project name already exist. If you continue the
164-
existing project with the same name will be replaced
165-
</p>
161+
<p style={redText}>{t("warning-project-exist")}</p>
166162
) : (
167163
<p></p>
168164
)}
169165
</Grid>
170166
<Grid container item xs={12} spacing={0} justify="center">
171167
<TextField
172168
id="ProjectName"
173-
label="Project Name"
169+
label={t("project-name")}
174170
variant="outlined"
175171
onChange={(event) => {
176172
setNameProjectToCreate(event.target.value)

src/components/ImportFromCognitoS3Dialog/check-interface-and-sample-type.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ export default (typeAuthorize, file) => {
1111
if (type === "audio_transcription") return "Audio"
1212
if (type === "data_entry") return "PDF"
1313
if (type === "text_entity_recognition" || type === "text_classification")
14-
return "Texte"
14+
return "Text"
1515
if (isEmpty(type)) return "Empty"
1616
return "File"
1717
}
@@ -22,7 +22,7 @@ export default (typeAuthorize, file) => {
2222
if (!isEmpty(assets[0].videoUrl)) return "Video"
2323
if (!isEmpty(assets[0].audioUrl)) return "Audio"
2424
if (!isEmpty(assets[0].pdfUrl)) return "PDF"
25-
if (!isEmpty(assets[0].document)) return "Texte"
25+
if (!isEmpty(assets[0].document)) return "Text"
2626
return "File"
2727
}
2828

src/components/ImportFromCognitoS3Dialog/header-table-import.js

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,13 @@ import {
33
Settings as SettingsIcon,
44
Storage as StorageIcon,
55
} from "@material-ui/icons/"
6-
6+
import { useTranslation } from "react-i18next"
77
import { Button, IconButton } from "@material-ui/core/"
88

99
const selectedStyle = { color: "DodgerBlue" }
1010

11-
const headerTable = ({ configImport, setConfigImport }) => {
11+
export default ({ configImport, setConfigImport }) => {
12+
const { t } = useTranslation()
1213
const loadAssetsOrAnnotations = () => {
1314
setConfigImport({
1415
...configImport,
@@ -24,20 +25,22 @@ const headerTable = ({ configImport, setConfigImport }) => {
2425
onClick={loadAssetsOrAnnotations}
2526
disabled
2627
>
27-
Load Assets
28+
{t("load-assets")}
2829
</Button>
2930
) : (
30-
<Button onClick={loadAssetsOrAnnotations}>Load Assets</Button>
31+
<Button onClick={loadAssetsOrAnnotations}>{t("load-assets")}</Button>
3132
)}
3233
{configImport.loadAssetsIsSelected ? (
33-
<Button onClick={loadAssetsOrAnnotations}>Load Annotations</Button>
34+
<Button onClick={loadAssetsOrAnnotations}>
35+
{t("load-annotations")}
36+
</Button>
3437
) : (
3538
<Button
3639
style={selectedStyle}
3740
onClick={loadAssetsOrAnnotations}
3841
disabled
3942
>
40-
Load Annotations
43+
{t("load-annotations")}
4144
</Button>
4245
)}
4346
<IconButton
@@ -58,4 +61,3 @@ const headerTable = ({ configImport, setConfigImport }) => {
5861
</tr>
5962
)
6063
}
61-
export default headerTable

src/components/ImportFromCognitoS3Dialog/index.js

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,7 @@ import SettingImport from "./interface-setting-import"
1515
import HeaderTableImport from "./header-table-import"
1616
import { Radio, Grid } from "@material-ui/core/"
1717
import getSources from "./get-sources"
18-
19-
const columns = [{ name: "Projects", selector: "folder", sortable: true }]
18+
import { useTranslation } from "react-i18next"
2019

2120
export default ({ open, onClose, onAddSamples }) => {
2221
const [dm, setDm] = useState(null)
@@ -26,6 +25,8 @@ export default ({ open, onClose, onAddSamples }) => {
2625
const [projectToFetch, setProjectToFetch] = useState("")
2726
const [configImport, setConfigImport] = useState(initConfigImport(oldData))
2827
const lastObjectRef = useRef({})
28+
const { t } = useTranslation()
29+
const columns = [{ name: t("projects"), selector: "folder", sortable: true }]
2930

3031
const hasProjectStarted = useCallback(() => {
3132
if (!open) return
@@ -186,12 +187,12 @@ export default ({ open, onClose, onAddSamples }) => {
186187

187188
return (
188189
<SimpleDialog
189-
title="Select Project"
190+
title={t("select-project")}
190191
open={open}
191192
onClose={onClose}
192193
actions={[
193194
{
194-
text: "Take samples from project",
195+
text: t("take-samples-from-project"),
195196
onClick: () => {
196197
handleAddSample()
197198
},

src/components/ImportFromCognitoS3Dialog/init-config-import.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,15 +11,15 @@ export default (dataset) => {
1111
? "Audio"
1212
: checkInterfaceAndsamples(["PDF", "Empty"], dataset)
1313
? "PDF"
14-
: checkInterfaceAndsamples(["Texte", "Empty"], dataset)
15-
? "Texte"
14+
: checkInterfaceAndsamples(["Text", "Empty"], dataset)
15+
? "Text"
1616
: "None",
1717
typeOfFileToDisable: {
1818
Image: !checkInterfaceAndsamples(["Image", "Empty"], dataset),
1919
Video: !checkInterfaceAndsamples(["Video", "Empty"], dataset),
2020
Audio: !checkInterfaceAndsamples(["Audio", "Empty"], dataset),
2121
PDF: !checkInterfaceAndsamples(["PDF", "Empty"], dataset),
22-
Texte: !checkInterfaceAndsamples(["Texte", "Empty"], dataset),
22+
Text: !checkInterfaceAndsamples(["Text", "Empty"], dataset),
2323
},
2424
loadAssetsIsSelected: true,
2525
contentDialogBoxIsSetting: false,

src/components/ImportFromCognitoS3Dialog/interface-setting-import.js

Lines changed: 18 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,17 @@ import {
66
FormControlLabel,
77
FormLabel,
88
} from "@material-ui/core/"
9-
const setting = ({ configImport, setConfigImport }) => {
9+
import { useTranslation } from "react-i18next"
10+
export default ({ configImport, setConfigImport }) => {
11+
const { t } = useTranslation()
1012
return (
1113
<tr>
1214
<th>
1315
{!configImport.loadAssetsIsSelected ? (
1416
<FormControl component="fieldset">
15-
<FormLabel component="legend">Annotation processing</FormLabel>
17+
<FormLabel component="legend">
18+
{t("annotation-processing")}
19+
</FormLabel>
1620
<RadioGroup
1721
aria-label="option1"
1822
onChange={(event) => {
@@ -25,26 +29,26 @@ const setting = ({ configImport, setConfigImport }) => {
2529
<FormControlLabel
2630
value="both"
2731
control={<Radio />}
28-
label="Keep both annotations"
32+
label={t("keep-both-annotations")}
2933
checked={configImport.annotationToKeep === "both"}
3034
/>
3135
<FormControlLabel
3236
value="incoming"
3337
control={<Radio />}
34-
label="Keep incoming annotations"
38+
label={t("keep-incoming-annotations")}
3539
checked={configImport.annotationToKeep === "incoming"}
3640
/>
3741
<FormControlLabel
3842
value="current"
3943
control={<Radio />}
40-
label="Keep current annotations"
44+
label={t("keep-current-annotations")}
4145
checked={configImport.annotationToKeep === "current"}
4246
/>
4347
</RadioGroup>
4448
</FormControl>
4549
) : (
4650
<FormControl component="fieldset">
47-
<FormLabel component="legend">Choose file type</FormLabel>
51+
<FormLabel component="legend">{t("choose-file-type")}</FormLabel>
4852
<RadioGroup
4953
aria-label="option2"
5054
onChange={(event) => {
@@ -57,37 +61,37 @@ const setting = ({ configImport, setConfigImport }) => {
5761
<FormControlLabel
5862
value="Image"
5963
control={<Radio />}
60-
label="Load image file"
64+
label={t("load-image-file")}
6165
disabled={configImport.typeOfFileToDisable.Image}
6266
checked={configImport.typeOfFileToLoad === "Image"}
6367
/>
6468
<FormControlLabel
6569
value="Video"
6670
control={<Radio />}
67-
label="Load video file"
71+
label={t("load-video-file")}
6872
disabled={configImport.typeOfFileToDisable.Video}
6973
checked={configImport.typeOfFileToLoad === "Video"}
7074
/>
7175
<FormControlLabel
7276
value="Audio"
7377
control={<Radio />}
74-
label="Load audio file"
78+
label={t("load-audio-file")}
7579
disabled={configImport.typeOfFileToDisable.Audio}
7680
checked={configImport.typeOfFileToLoad === "Audio"}
7781
/>
7882
<FormControlLabel
7983
value="PDF"
8084
control={<Radio />}
81-
label="Load PDF file"
85+
label={t("load-pdf-file")}
8286
disabled={configImport.typeOfFileToDisable.PDF}
8387
checked={configImport.typeOfFileToLoad === "PDF"}
8488
/>
8589
<FormControlLabel
86-
value="Texte"
90+
value="Text"
8791
control={<Radio />}
88-
label="Load texte file"
89-
disabled={configImport.typeOfFileToDisable.Texte}
90-
checked={configImport.typeOfFileToLoad === "Texte"}
92+
label={t("load-text-file")}
93+
disabled={configImport.typeOfFileToDisable.Text}
94+
checked={configImport.typeOfFileToLoad === "Text"}
9195
/>
9296
</RadioGroup>
9397
</FormControl>
@@ -96,4 +100,3 @@ const setting = ({ configImport, setConfigImport }) => {
96100
</tr>
97101
)
98102
}
99-
export default setting

src/components/ImportFromCognitoS3Dialog/set-type-of-file-to-load-and-disable.js

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@ export default (configImport, dataset) => {
1616
? "Audio"
1717
: checkInterfaceAndAssets(["PDF", "Empty"], dataset)
1818
? "PDF"
19-
: checkInterfaceAndAssets(["Texte", "Empty"], dataset)
20-
? "Texte"
19+
: checkInterfaceAndAssets(["Text", "Empty"], dataset)
20+
? "Text"
2121
: "None",
2222
typeOfFileToDisable: {
2323
Image: checkInterfaceAndAssets(["Image", "Empty"], dataset)
@@ -30,9 +30,7 @@ export default (configImport, dataset) => {
3030
? false
3131
: true,
3232
PDF: checkInterfaceAndAssets(["PDF", "Empty"], dataset) ? false : true,
33-
Texte: checkInterfaceAndAssets(["Texte", "Empty"], dataset)
34-
? false
35-
: true,
33+
Text: checkInterfaceAndAssets(["Text", "Empty"], dataset) ? false : true,
3634
},
3735
}
3836
}

0 commit comments

Comments
 (0)