diff --git a/src/index.jsx b/src/index.jsx index e5ed90b..058942f 100644 --- a/src/index.jsx +++ b/src/index.jsx @@ -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( - - }/> - - - - -); +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( + + } /> + + + + + ); + }); diff --git a/src/lib/tasklist.jsx b/src/lib/tasklist.jsx index 3c50e52..dab0cf9 100644 --- a/src/lib/tasklist.jsx +++ b/src/lib/tasklist.jsx @@ -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: , - type:i18n.t("TASK_TYPE.JOB"), - link: "/sync/beginPartialSync" - }, - { - id: 1, - name: "JellyfinSync", - description: , - type: i18n.t("TASK_TYPE.JOB"), - link: "/sync/beginSync" - }, - { - id: 2, - name: "Jellyfin Playback Reporting Plugin Sync", - description: , - type: i18n.t("TASK_TYPE.IMPORT"), - link: "/sync/syncPlaybackPluginData" - }, - { - id: 3, - name: "Backup", - description: , - type: i18n.t("TASK_TYPE.JOB"), - link: "/backup/beginBackup" - }, - - -] - + { + id: 0, + name: "PartialJellyfinSync", + description: , + type: i18next.t("TASK_TYPE.JOB"), + link: "/sync/beginPartialSync", + }, + { + id: 1, + name: "JellyfinSync", + description: , + type: i18next.t("TASK_TYPE.JOB"), + link: "/sync/beginSync", + }, + { + id: 2, + name: "Jellyfin Playback Reporting Plugin Sync", + description: , + type: i18next.t("TASK_TYPE.IMPORT"), + link: "/sync/syncPlaybackPluginData", + }, + { + id: 3, + name: "Backup", + description: , + type: i18next.t("TASK_TYPE.JOB"), + link: "/backup/beginBackup", + }, +]; diff --git a/src/localization.js b/src/localization.js deleted file mode 100644 index e7ff660..0000000 --- a/src/localization.js +++ /dev/null @@ -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; diff --git a/src/pages/components/settings/Tasks.jsx b/src/pages/components/settings/Tasks.jsx index e457362..bfd3557 100644 --- a/src/pages/components/settings/Tasks.jsx +++ b/src/pages/components/settings/Tasks.jsx @@ -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 (
diff --git a/src/pages/components/settings/backupfiles.jsx b/src/pages/components/settings/backupfiles.jsx index bfe16c9..e057a2e 100644 --- a/src/pages/components/settings/backupfiles.jsx +++ b/src/pages/components/settings/backupfiles.jsx @@ -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) { {formatFileSize(data.size)}
- + downloadBackup(data.name)}>