From f3148bf478c43b26d4b9dfdb36b26a3c8111ca98 Mon Sep 17 00:00:00 2001 From: Panagiotis Papadopoulos Date: Fri, 28 Feb 2025 08:26:48 +0100 Subject: [PATCH] build: let webpack bundle i18next --- src/public/app/services/i18n.ts | 5 ++--- src/public/app/services/library_loader.ts | 5 ----- src/public/app/types.d.ts | 4 ---- src/routes/assets.ts | 2 -- 4 files changed, 2 insertions(+), 14 deletions(-) diff --git a/src/public/app/services/i18n.ts b/src/public/app/services/i18n.ts index 48b3be72e..8abdba46e 100644 --- a/src/public/app/services/i18n.ts +++ b/src/public/app/services/i18n.ts @@ -1,7 +1,6 @@ -import library_loader from "./library_loader.js"; import options from "./options.js"; - -await library_loader.requireLibrary(library_loader.I18NEXT); +import i18next from "i18next"; +import i18nextHttpBackend from "i18next-http-backend"; export async function initLocale() { const locale = (options.get("locale") as string) || "en"; diff --git a/src/public/app/services/library_loader.ts b/src/public/app/services/library_loader.ts index 063757a59..829184155 100644 --- a/src/public/app/services/library_loader.ts +++ b/src/public/app/services/library_loader.ts @@ -72,10 +72,6 @@ const MARKJS: Library = { js: ["node_modules/mark.js/dist/jquery.mark.es6.min.js"] }; -const I18NEXT: Library = { - js: ["node_modules/i18next/i18next.min.js", "node_modules/i18next-http-backend/i18nextHttpBackend.min.js"] -}; - const HIGHLIGHT_JS: Library = { js: () => { const mimeTypes = mimeTypesService.getMimeTypes(); @@ -194,7 +190,6 @@ export default { WHEEL_ZOOM, MERMAID, MARKJS, - I18NEXT, HIGHLIGHT_JS, LEAFLET }; diff --git a/src/public/app/types.d.ts b/src/public/app/types.d.ts index 39c4e2d6d..a37df7f74 100644 --- a/src/public/app/types.d.ts +++ b/src/public/app/types.d.ts @@ -1,7 +1,5 @@ import type FNote from "./entities/fnote"; -import type { BackendModule, i18n } from "i18next"; import type { Froca } from "./services/froca-interface"; -import type { HttpBackendOptions } from "i18next-http-backend"; import { Suggestion } from "./services/note_autocomplete.ts"; import utils from "./services/utils.ts"; import appContext from "./components/app_context.ts"; @@ -115,8 +113,6 @@ declare global { // Libraries // TODO: Replace once library loader is replaced with webpack. - var i18next: i18n; - var i18nextHttpBackend: BackendModule; var hljs: { highlightAuto(text: string); highlight(text: string, { diff --git a/src/routes/assets.ts b/src/routes/assets.ts index f925a6108..37585d8d7 100644 --- a/src/routes/assets.ts +++ b/src/routes/assets.ts @@ -73,8 +73,6 @@ async function register(app: express.Application) { app.use(`/${assetPath}/node_modules/panzoom/dist/`, persistentCacheStatic(path.join(srcRoot, "..", "node_modules/panzoom/dist/"))); // i18n - app.use(`/${assetPath}/node_modules/i18next/`, persistentCacheStatic(path.join(srcRoot, "..", "node_modules/i18next/"))); - app.use(`/${assetPath}/node_modules/i18next-http-backend/`, persistentCacheStatic(path.join(srcRoot, "..", "node_modules/i18next-http-backend/"))); app.use(`/${assetPath}/translations/`, persistentCacheStatic(path.join(srcRoot, "public", "translations/"))); app.use(`/${assetPath}/node_modules/eslint/bin/`, persistentCacheStatic(path.join(srcRoot, "..", "node_modules/eslint/bin/")));