Skip to content

Build your personal knowledge base with Trilium Notes

build: let webpack bundle i18next

Panagiotis Papadopoulosf3148bf478c4
diff --git a/src/public/app/services/i18n.ts b/src/public/app/services/i18n.ts
index 48b3be72e9..8abdba46ef 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 063757a59f..829184155f 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 39c4e2d6d9..a37df7f74e 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<HttpBackendOptions>;
var hljs: {
highlightAuto(text: string);
highlight(text: string, {
diff --git a/src/routes/assets.ts b/src/routes/assets.ts
index f925a6108f..37585d8d7c 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/")));