mirror of
https://github.com/BreizhHardware/Jellystat.git
synced 2026-01-18 16:27:20 +01:00
Fix for localization failed to load on some browsers
This commit is contained in:
@@ -1,20 +1,41 @@
|
||||
import React, { Suspense } from 'react';
|
||||
import ReactDOM from 'react-dom/client';
|
||||
import { BrowserRouter } from 'react-router-dom';
|
||||
import React, { Suspense } from "react";
|
||||
import ReactDOM from "react-dom/client";
|
||||
import { BrowserRouter } from "react-router-dom";
|
||||
|
||||
import App from './App.jsx';
|
||||
import App from "./App.jsx";
|
||||
|
||||
import './index.css';
|
||||
import 'bootstrap/dist/css/bootstrap.min.css';
|
||||
import "./index.css";
|
||||
import "bootstrap/dist/css/bootstrap.min.css";
|
||||
|
||||
import './localization.js';
|
||||
import Loading from './pages/components/general/loading.jsx';
|
||||
import i18n from "i18next";
|
||||
import Backend from "i18next-http-backend";
|
||||
import LanguageDetector from "i18next-browser-languagedetector";
|
||||
import { initReactI18next } from "react-i18next";
|
||||
|
||||
ReactDOM.createRoot(document.getElementById('root')).render(
|
||||
<React.StrictMode>
|
||||
<Suspense fallback={ <Loading />}/>
|
||||
<BrowserRouter>
|
||||
<App />
|
||||
</BrowserRouter>
|
||||
</React.StrictMode>
|
||||
);
|
||||
import Loading from "./pages/components/general/loading.jsx";
|
||||
|
||||
i18n
|
||||
.use(Backend)
|
||||
.use(LanguageDetector)
|
||||
.use(initReactI18next)
|
||||
.init({
|
||||
fallbackLng: "en",
|
||||
debug: false,
|
||||
detection: {
|
||||
order: ["queryString", "cookie"],
|
||||
cache: ["cookie"],
|
||||
},
|
||||
interpolation: {
|
||||
escapeValue: false,
|
||||
},
|
||||
})
|
||||
.then(() => {
|
||||
ReactDOM.createRoot(document.getElementById("root")).render(
|
||||
<React.StrictMode>
|
||||
<Suspense fallback={<Loading />} />
|
||||
<BrowserRouter>
|
||||
<App />
|
||||
</BrowserRouter>
|
||||
</React.StrictMode>
|
||||
);
|
||||
});
|
||||
|
||||
@@ -1,36 +1,33 @@
|
||||
import i18next from "i18next";
|
||||
import { Trans } from "react-i18next";
|
||||
import i18n from "../localization";
|
||||
|
||||
export const taskList = [
|
||||
{
|
||||
id: 0,
|
||||
name: "PartialJellyfinSync",
|
||||
description: <Trans i18nKey={"TASK_DESCRIPTION.PartialJellyfinSync"}/>,
|
||||
type:i18n.t("TASK_TYPE.JOB"),
|
||||
link: "/sync/beginPartialSync"
|
||||
},
|
||||
{
|
||||
id: 1,
|
||||
name: "JellyfinSync",
|
||||
description: <Trans i18nKey={"TASK_DESCRIPTION.JellyfinSync"}/>,
|
||||
type: i18n.t("TASK_TYPE.JOB"),
|
||||
link: "/sync/beginSync"
|
||||
},
|
||||
{
|
||||
id: 2,
|
||||
name: "Jellyfin Playback Reporting Plugin Sync",
|
||||
description: <Trans i18nKey={"TASK_DESCRIPTION.Jellyfin_Playback_Reporting_Plugin_Sync"}/>,
|
||||
type: i18n.t("TASK_TYPE.IMPORT"),
|
||||
link: "/sync/syncPlaybackPluginData"
|
||||
},
|
||||
{
|
||||
id: 3,
|
||||
name: "Backup",
|
||||
description: <Trans i18nKey={"TASK_DESCRIPTION.Backup"}/>,
|
||||
type: i18n.t("TASK_TYPE.JOB"),
|
||||
link: "/backup/beginBackup"
|
||||
},
|
||||
|
||||
|
||||
]
|
||||
|
||||
{
|
||||
id: 0,
|
||||
name: "PartialJellyfinSync",
|
||||
description: <Trans i18nKey={"TASK_DESCRIPTION.PartialJellyfinSync"} />,
|
||||
type: i18next.t("TASK_TYPE.JOB"),
|
||||
link: "/sync/beginPartialSync",
|
||||
},
|
||||
{
|
||||
id: 1,
|
||||
name: "JellyfinSync",
|
||||
description: <Trans i18nKey={"TASK_DESCRIPTION.JellyfinSync"} />,
|
||||
type: i18next.t("TASK_TYPE.JOB"),
|
||||
link: "/sync/beginSync",
|
||||
},
|
||||
{
|
||||
id: 2,
|
||||
name: "Jellyfin Playback Reporting Plugin Sync",
|
||||
description: <Trans i18nKey={"TASK_DESCRIPTION.Jellyfin_Playback_Reporting_Plugin_Sync"} />,
|
||||
type: i18next.t("TASK_TYPE.IMPORT"),
|
||||
link: "/sync/syncPlaybackPluginData",
|
||||
},
|
||||
{
|
||||
id: 3,
|
||||
name: "Backup",
|
||||
description: <Trans i18nKey={"TASK_DESCRIPTION.Backup"} />,
|
||||
type: i18next.t("TASK_TYPE.JOB"),
|
||||
link: "/backup/beginBackup",
|
||||
},
|
||||
];
|
||||
|
||||
@@ -1,22 +0,0 @@
|
||||
import i18n from "i18next";
|
||||
import Backend from "i18next-http-backend";
|
||||
import LanguageDetector from "i18next-browser-languagedetector";
|
||||
import { initReactI18next } from "react-i18next";
|
||||
|
||||
i18n
|
||||
.use(Backend)
|
||||
.use(LanguageDetector)
|
||||
.use(initReactI18next)
|
||||
.init({
|
||||
fallbackLng: "en",
|
||||
debug: false,
|
||||
detection: {
|
||||
order: ["queryString", "cookie"],
|
||||
cache: ["cookie"],
|
||||
},
|
||||
interpolation: {
|
||||
escapeValue: false,
|
||||
},
|
||||
});
|
||||
|
||||
export default i18n;
|
||||
@@ -15,8 +15,8 @@ import { taskList } from "../../../lib/tasklist";
|
||||
|
||||
|
||||
import "../../css/settings/settings.css";
|
||||
import i18n from "../../../localization";
|
||||
import { Trans } from "react-i18next";
|
||||
import i18next from "i18next";
|
||||
|
||||
export default function Tasks() {
|
||||
const [processing, setProcessing] = useState(false);
|
||||
@@ -95,12 +95,12 @@ export default function Tasks() {
|
||||
|
||||
|
||||
const intervals=[
|
||||
{value:15, display:i18n.t("SETTINGS_PAGE.INTERVALS.15_MIN")},
|
||||
{value:30, display:i18n.t("SETTINGS_PAGE.INTERVALS.30_MIN")},
|
||||
{value:60, display:i18n.t("SETTINGS_PAGE.INTERVALS.1_HOUR")},
|
||||
{value:720, display:i18n.t("SETTINGS_PAGE.INTERVALS.12_HOURS")},
|
||||
{value:1440, display:i18n.t("SETTINGS_PAGE.INTERVALS.1_DAY")},
|
||||
{value:10080, display:i18n.t("SETTINGS_PAGE.INTERVALS.1_WEEK")}
|
||||
{value:15, display:i18next.t("SETTINGS_PAGE.INTERVALS.15_MIN")},
|
||||
{value:30, display:i18next.t("SETTINGS_PAGE.INTERVALS.30_MIN")},
|
||||
{value:60, display:i18next.t("SETTINGS_PAGE.INTERVALS.1_HOUR")},
|
||||
{value:720, display:i18next.t("SETTINGS_PAGE.INTERVALS.12_HOURS")},
|
||||
{value:1440, display:i18next.t("SETTINGS_PAGE.INTERVALS.1_DAY")},
|
||||
{value:10080, display:i18next.t("SETTINGS_PAGE.INTERVALS.1_WEEK")}
|
||||
];
|
||||
return (
|
||||
<div className="tasks">
|
||||
|
||||
@@ -13,7 +13,7 @@ import Alert from "react-bootstrap/Alert";
|
||||
|
||||
import "../../css/settings/backups.css";
|
||||
import { Trans } from "react-i18next";
|
||||
import i18n from "../../../localization";
|
||||
import i18next from "i18next";
|
||||
|
||||
const token = localStorage.getItem("token");
|
||||
|
||||
@@ -131,7 +131,7 @@ function Row(file) {
|
||||
<TableCell>{formatFileSize(data.size)}</TableCell>
|
||||
<TableCell className="">
|
||||
<div className="d-flex justify-content-center">
|
||||
<DropdownButton title={i18n.t("ACTIONS")} variant="outline-primary" disabled={disabled}>
|
||||
<DropdownButton title={i18next.t("ACTIONS")} variant="outline-primary" disabled={disabled}>
|
||||
<Dropdown.Item as="button" variant="primary" onClick={() => downloadBackup(data.name)}>
|
||||
<Trans i18nKey={"DOWNLOAD"}/>
|
||||
</Dropdown.Item>
|
||||
|
||||
Reference in New Issue
Block a user