From fd8a6612592927d26a0733ce5bbaab1c161986b0 Mon Sep 17 00:00:00 2001 From: godsakani <70459251+godsakani@users.noreply.github.com> Date: Sun, 25 Sep 2022 09:19:08 +0100 Subject: [PATCH] Language feature Implementation (#137) * feat: Added language menu item on side nav * file: added package-lock json file * packages: Added packages for language translation * package: added new yarn package * feat: remove commented links * file: Added translation file * feat: Added translation for loading screen. * feat: added radio button for switching languages * feat: added translation for links data item * file: Added json file for english translation * file: Added json file for french translation * feat: added translation feature * feat: Make used of translation file * feat: make used of translation file * feat: added language selector * feat: Added translation for pages --- frontend/package.json | 4 + frontend/public/index.html | 3 +- frontend/src/assets/data/Items.data.ts | 9 +- frontend/src/assets/data/Links.data.ts | 14 +- frontend/src/assets/translation/en/en.json | 34 + frontend/src/assets/translation/fr/fr.json | 33 + .../cityDetail/CityDetail.component.tsx | 7 +- .../notFound/NotFound.component.tsx | 11 +- .../components/search/Search.component.tsx | 1 - frontend/src/i18n.js | 38 + frontend/src/index.tsx | 9 +- frontend/src/languageSelect.js | 18 + frontend/src/pages/advices/Advices.tsx | 9 +- frontend/src/pages/detail/Detail.page.tsx | 9 +- frontend/src/pages/home/Home.pages.tsx | 18 +- .../src/pages/homeModal/HomeModal.pages.tsx | 9 +- frontend/src/pages/list/List.pages.tsx | 6 +- .../src/pages/streetMap/StreetMap.page.tsx | 6 +- package-lock.json | 1416 +++++++++++++++++ 19 files changed, 1607 insertions(+), 47 deletions(-) create mode 100644 frontend/src/assets/translation/en/en.json create mode 100644 frontend/src/assets/translation/fr/fr.json create mode 100644 frontend/src/i18n.js create mode 100644 frontend/src/languageSelect.js create mode 100644 package-lock.json diff --git a/frontend/package.json b/frontend/package.json index 358e2bf2..86ece00f 100644 --- a/frontend/package.json +++ b/frontend/package.json @@ -5,11 +5,15 @@ "dependencies": { "axios": "^0.22.0", "eslint": "^7.11.0", + "i18next": "^21.9.0", + "i18next-browser-languagedetector": "^6.1.5", + "i18next-http-backend": "^1.4.1", "leaflet": "^1.7.1", "rc-drawer": "^4.4.2", "react": "^17.0.2", "react-dom": "^17.0.2", "react-hooks-use-modal": "^2.1.0", + "react-i18next": "^11.18.3", "react-leaflet": "^3.2.2", "react-modern-drawer": "^0.1.1", "react-router-dom": "^5.3.0", diff --git a/frontend/public/index.html b/frontend/public/index.html index 918e471b..b2b7a2d0 100644 --- a/frontend/public/index.html +++ b/frontend/public/index.html @@ -26,7 +26,6 @@
- - +