import React, { useEffect } from "react"; import Footer from "./shared-components/footer-component/Footer"; import Navbar from "./shared-components/navbar-component/Navbar"; import { BrowserRouter, Route, Switch } from "react-router-dom"; import i18next from "i18next"; import { useTranslation } from "react-i18next"; import Cookies from "js-cookie"; import HomePage from "./homePage/Homepage"; import ListingsPage from "./listings-page/ListingsPage"; import AgentPage from "./agent-page/AgentPage"; import ListingPage from "./listings-page/single-listing/listing-page"; import Login from "./login-page/Login"; import Account from "./login-page/account/Account"; import ContactUs from "./shared-components/contact-us/contact-us"; const langauges = [ { code: "fr", name: "Français", country_code: "fr", }, { code: "en", name: "English", country_code: "gb", }, ]; function App() { const currentLanguageCode = Cookies.get("i18next") || "en"; const currentLanguage = langauges.find( (lang) => lang.code === currentLanguageCode ); const { t } = useTranslation(); useEffect(() => { document.body.dir = currentLanguage.dir || "ltr"; }, [currentLanguage]); return (
{/* create the translations button */}
{/* */}
{t("Welcome_to_React")}
); } export default App;