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

54 lines
1.4 KiB
JavaScript
Raw Normal View History

import React, { Suspense } from "react";
import ReactDOM from "react-dom";
import reportWebVitals from "./reportWebVitals";
2021-03-28 23:02:05 +00:00
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",
},
2021-03-28 15:39:48 +00:00
react: {
useSuspense: false,
},
});
const loadingMsg = (
<div className="py-4 text-center">
<h2>Loading......</h2>
</div>
);
2021-03-28 15:39:48 +00:00
ReactDOM.render(
<Suspense fallback={loadingMsg}>
<React.StrictMode>
<App />
</React.StrictMode>
</Suspense>,
document.getElementById("root")
2021-03-28 15:39:48 +00:00
);
// 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();