diff --git a/package-lock.json b/package-lock.json index 851979a..255def6 100644 --- a/package-lock.json +++ b/package-lock.json @@ -12,9 +12,11 @@ "@testing-library/react": "^13.4.0", "@testing-library/user-event": "^13.5.0", "aos": "^2.3.4", + "i18next": "^23.11.5", "react": "^18.2.0", "react-dom": "^18.2.0", "react-github-btn": "^1.4.0", + "react-i18next": "^14.1.2", "react-icons": "^4.11.0", "react-scripts": "^5.0.1", "sass": "^1.69.4", @@ -8915,6 +8917,14 @@ "node": ">=12" } }, + "node_modules/html-parse-stringify": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/html-parse-stringify/-/html-parse-stringify-3.0.1.tgz", + "integrity": "sha512-KknJ50kTInJ7qIScF3jeaFRpMpE8/lfiTdzf/twXyPBLAGrLRTmkz3AdTnKeh40X8k9L2fdYwEp/42WGXIRGcg==", + "dependencies": { + "void-elements": "3.1.0" + } + }, "node_modules/html-webpack-plugin": { "version": "5.6.0", "resolved": "https://registry.npmjs.org/html-webpack-plugin/-/html-webpack-plugin-5.6.0.tgz", @@ -9058,6 +9068,28 @@ "node": ">=10.17.0" } }, + "node_modules/i18next": { + "version": "23.11.5", + "resolved": "https://registry.npmjs.org/i18next/-/i18next-23.11.5.tgz", + "integrity": "sha512-41pvpVbW9rhZPk5xjCX2TPJi2861LEig/YRhUkY+1FQ2IQPS0bKUDYnEqY8XPPbB48h1uIwLnP9iiEfuSl20CA==", + "funding": [ + { + "type": "individual", + "url": "https://locize.com" + }, + { + "type": "individual", + "url": "https://locize.com/i18next.html" + }, + { + "type": "individual", + "url": "https://www.i18next.com/how-to/faq#i18next-is-awesome.-how-can-i-support-the-project" + } + ], + "dependencies": { + "@babel/runtime": "^7.23.2" + } + }, "node_modules/iconv-lite": { "version": "0.6.3", "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.6.3.tgz", @@ -14484,6 +14516,27 @@ "react": ">=16.3.0" } }, + "node_modules/react-i18next": { + "version": "14.1.2", + "resolved": "https://registry.npmjs.org/react-i18next/-/react-i18next-14.1.2.tgz", + "integrity": "sha512-FSIcJy6oauJbGEXfhUgVeLzvWBhIBIS+/9c6Lj4niwKZyGaGb4V4vUbATXSlsHJDXXB+ociNxqFNiFuV1gmoqg==", + "dependencies": { + "@babel/runtime": "^7.23.9", + "html-parse-stringify": "^3.0.1" + }, + "peerDependencies": { + "i18next": ">= 23.2.3", + "react": ">= 16.8.0" + }, + "peerDependenciesMeta": { + "react-dom": { + "optional": true + }, + "react-native": { + "optional": true + } + } + }, "node_modules/react-icons": { "version": "4.12.0", "resolved": "https://registry.npmjs.org/react-icons/-/react-icons-4.12.0.tgz", @@ -16884,6 +16937,14 @@ "node": ">= 0.8" } }, + "node_modules/void-elements": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/void-elements/-/void-elements-3.1.0.tgz", + "integrity": "sha512-Dhxzh5HZuiHQhbvTW9AMetFfBHDMYpo23Uo9btPXgdYP+3T5S+p+jgNy7spra+veYhBP2dCSgxR/i2Y02h5/6w==", + "engines": { + "node": ">=0.10.0" + } + }, "node_modules/w3c-hr-time": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/w3c-hr-time/-/w3c-hr-time-1.0.2.tgz", diff --git a/package.json b/package.json index 4252d04..0386710 100644 --- a/package.json +++ b/package.json @@ -7,9 +7,11 @@ "@testing-library/react": "^13.4.0", "@testing-library/user-event": "^13.5.0", "aos": "^2.3.4", + "i18next": "^23.11.5", "react": "^18.2.0", "react-dom": "^18.2.0", "react-github-btn": "^1.4.0", + "react-i18next": "^14.1.2", "react-icons": "^4.11.0", "react-scripts": "^5.0.1", "sass": "^1.69.4", diff --git a/src/App.js b/src/App.js index 4ffb5b2..abe5b39 100644 --- a/src/App.js +++ b/src/App.js @@ -9,6 +9,8 @@ import Footer from "./components/Footer.tsx"; import CV from "./components/CV.tsx"; import Menu from "./components/Menu.tsx"; import data from "./assets/DATA.ts"; +import { useTranslation } from "react-i18next"; +import i18n from './i18n.js'; function App() { const [theme, setTheme] = useState("light"); @@ -28,22 +30,34 @@ function App() { document.documentElement.classList.toggle("dark"); } + const { i18n } = useTranslation(); + + const toggleLanguage = () => { + i18n.changeLanguage(i18n.language === "fr" ? "en" : "fr"); + } + return (
{title}
-{description}
+{t('about.title')}
+{t('about.description')}
Mon CV
- +{t('cv.title')}
+{name}
-{title}
+{t('card.title')}
{description}
+{t(`projects.${project.title}.description`)}