build: let webpack bundle i18next

This commit is contained in:
Panagiotis Papadopoulos 2025-02-28 08:26:48 +01:00
parent b60f22c6b9
commit f3148bf478
4 changed files with 2 additions and 14 deletions

View File

@ -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";

View File

@ -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
};

View File

@ -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, {

View File

@ -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/")));