Added the foundation for making the frontend multilingual. Now only need to import useTranslation and use t('key') for all user-facing text for all pages (+add key:value pairs in src/locales for each language ofc)
- package.json -> Imported packages i18next & react-i18next for multilingual functionality. - src/App.jsx -> Imported LanguageSwitcher from ./components/LanguageSwitcher and added <LanguageSwitcher /> component at the beginning of layout so it's always visible. - src/components/LanguageSwitcher.jsx -> LanguageSwitcher component, consists of a dropdown menu that always appears at top right corner for choosing language. - src/i18n.js -> Initialize and configure i18next for app-wide multilingual support. - src/locales/en.json + src/locales/fr.json -> Empty json files that will soon contain translation key:value pairs for each page. - src/main.jsx -> Imported src/i18n.js for multilingual functionality.
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
import "./App.css";
|
||||
import { BrowserRouter as Router, Routes, Route } from "react-router-dom";
|
||||
import LanguageSwitcher from './components/LanguageSwitcher'; // Language switcher dropdown menu
|
||||
import Login from "./pages/Authentication/Login";
|
||||
import SignUp from "./pages/Authentication/SignUp";
|
||||
import DrivethruLandingPage from "./pages/UserPages/DrivethruLandingPage";
|
||||
@@ -9,6 +10,7 @@ import NotFoundPage from "./pages/UserPages/NotFoundPage";
|
||||
function App() {
|
||||
return (
|
||||
<Router>
|
||||
<LanguageSwitcher />
|
||||
<Routes>
|
||||
<Route path="/" element={<DrivethruLandingPage />} />
|
||||
<Route path="/login" element={<Login />} />
|
||||
|
||||
Reference in New Issue
Block a user