Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding french and english translation #39

Closed
179 changes: 178 additions & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 5 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,12 @@
},
"dependencies": {
"@dts-stn/service-canada-design-system": "^1.67.3",
"@types/i18next": "^13.0.0",
"i18n": "^0.15.1",
"i18next": "^23.11.5",
"react": "^18.2.0",
"react-dom": "^18.2.0"
"react-dom": "^18.2.0",
"react-i18next": "^14.1.2"
},
"devDependencies": {
"@types/react": "^18.2.66",
Expand Down
22 changes: 12 additions & 10 deletions src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,19 +4,21 @@
import NoPage from "./Pages/NoPage/NoPage";
import "./App.css";
import Header from "./Components/Header/Header";
import LanguageSwitcherButton from "./Components/LanguageChanger/LanguageChanger";

Check failure on line 7 in src/App.tsx

View workflow job for this annotation

GitHub Actions / lint-test / lint-test

'LanguageSwitcherButton' is defined but never used


Check failure on line 9 in src/App.tsx

View workflow job for this annotation

GitHub Actions / lint-test / lint-test

Delete `⏎`
function App() {
return (
<BrowserRouter>
<Header />
<Routes>
<Route path="/">
<Route index element={<HomePage />} />
<Route path="Json" element={<JsonPage />} />
<Route path="*" element={<NoPage />} />
</Route>
</Routes>
</BrowserRouter>
<BrowserRouter>

Check failure on line 12 in src/App.tsx

View workflow job for this annotation

GitHub Actions / lint-test / lint-test

Delete `··`
<Header />

Check failure on line 13 in src/App.tsx

View workflow job for this annotation

GitHub Actions / lint-test / lint-test

Delete `··`
<Routes>

Check failure on line 14 in src/App.tsx

View workflow job for this annotation

GitHub Actions / lint-test / lint-test

Replace `········` with `······`
<Route path="/">

Check failure on line 15 in src/App.tsx

View workflow job for this annotation

GitHub Actions / lint-test / lint-test

Delete `··`
<Route index element={<HomePage />} />

Check failure on line 16 in src/App.tsx

View workflow job for this annotation

GitHub Actions / lint-test / lint-test

Delete `··`
<Route path="Json" element={<JsonPage/>}/>

Check failure on line 17 in src/App.tsx

View workflow job for this annotation

GitHub Actions / lint-test / lint-test

Replace `············<Route·path="Json"·element={<JsonPage/>}` with `··········<Route·path="Json"·element={<JsonPage·/>}·`
<Route path="*" element={<NoPage />} />

Check failure on line 18 in src/App.tsx

View workflow job for this annotation

GitHub Actions / lint-test / lint-test

Delete `··`
</Route>

Check failure on line 19 in src/App.tsx

View workflow job for this annotation

GitHub Actions / lint-test / lint-test

Replace `··········` with `········`
</Routes>
</BrowserRouter>
);
}

Expand Down
11 changes: 7 additions & 4 deletions src/Components/DragDropFileInput/DragDropFileInput.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import React, { useState, useRef, useEffect } from "react";
import "./DragDropFileInput.css";
import { useTranslation } from 'react-i18next';
interface FileInputProps {
sendChange: (files: File[]) => void;
file: string;
Expand Down Expand Up @@ -53,9 +54,11 @@ const DragDropFileInput: React.FC<FileInputProps> = ({ sendChange, file }) => {
sendChange([]);
};

const { t } = useTranslation();

return (
<div className="drag-drop-container">
<h3 className="title">Attach a document</h3>
<h3 className="title">{t('attach_doc')}</h3>
<input
id="file-input"
ref={fileInput}
Expand All @@ -74,12 +77,12 @@ const DragDropFileInput: React.FC<FileInputProps> = ({ sendChange, file }) => {
<embed id="preview" src={file} className={file ? "active" : ""}></embed>
</label>
<div className="drag-drop-inner">
<p>Drag & drop your files here or</p>
<p>{t('drag_and_drop')}</p>
<button type="button" onClick={handleClick}>
Browse Files
{t('browse')}
</button>
<button type="button" onClick={handleCancel}>
Cancel
{t('cancel')}
</button>
</div>
</div>
Expand Down
2 changes: 1 addition & 1 deletion src/Components/FileList/FileElement/FileElement.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React, { useState, useEffect, useRef } from "react";
import "./FileElement.css";
import "./FileElement.css"
interface FileElementProps {
key: number;
file: File;
Expand Down
7 changes: 4 additions & 3 deletions src/Components/FileList/FileList.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import React, { useState } from "react";
import "./FileList.css";
import FileElement from "./FileElement/FileElement";
import { useTranslation } from 'react-i18next';

interface FileListProps {
files: File[];
Expand All @@ -27,12 +28,12 @@ const FileList: React.FC<FileListProps> = ({
} else {
propagateDelete(file, files[files.length - 1] === file);
}
};

}
const { t } = useTranslation();
return (
<div className={`file-list ${files.length === 0 ? "empty" : ""}`}>
<div className={`no-element ${files.length === 0 ? "active" : ""}`}>
No element to show
{t("no_element")}
</div>
{[...files].map((file: File, index: number) => (
<FileElement
Expand Down
Loading
Loading