Kene-s-Cribs-Website/src/index.js

53 lines
1.4 KiB
JavaScript

import React, { Suspense } from "react";
import ReactDOM from "react-dom";
import reportWebVitals from "./reportWebVitals";
import "bootstrap/dist/css/bootstrap.min.css";
import "flag-icon-css/css/flag-icon.min.css";
import i18n from "i18next";
import { initReactI18next } from "react-i18next";
import LanguageDetector from "i18next-browser-languagedetector";
import HttpApi from "i18next-http-backend";
import "./index.css";
import App from "./App";
i18n
.use(initReactI18next) // passes i18n down to react-i18next
.use(LanguageDetector)
.use(HttpApi)
.init({
// lng: "en",
supportedLngs: ["en", "fr"],
fallbackLng: "en",
detection: {
// "querystring",
order: ["cookie", "htmlTag", "localStorage", "path", "subdomain"],
caches: ["cookie"],
},
backend: {
loadPath: "/assets/locales/{{lng}}/translations.json",
},
react: {
useSuspense: false,
},
});
const loadingMsg = (
<div className="py-4 text-center">
<h2>Loading......</h2>
</div>
);
ReactDOM.render(
<Suspense fallback={loadingMsg}>
<React.StrictMode>
<App />
</React.StrictMode>
</Suspense>,
document.getElementById("root")
);
// If you want to start measuring performance in your app, pass a function
// to log results (for example: reportWebVitals(console.log))
// or send to an analytics endpoint. Learn more: https://bit.ly/CRA-vitals
reportWebVitals();