i18n: Set up client dependency to i18next

This commit is contained in:
Elian Doran 2024-07-20 09:32:56 +03:00
parent 33d6d51d59
commit 10ec7d6b2b
No known key found for this signature in database
3 changed files with 11 additions and 1 deletions

View File

@ -0,0 +1,5 @@
import library_loader from "./library_loader.js";
await library_loader.requireLibrary(library_loader.I18NEXT);
export const t = i18next.t;

View File

@ -72,6 +72,8 @@ const MARKJS = {
] ]
}; };
const I18NEXT = { js: [ "node_modules/i18next/i18next.min.js" ] };
async function requireLibrary(library) { async function requireLibrary(library) {
if (library.css) { if (library.css) {
library.css.map(cssUrl => requireCss(cssUrl)); library.css.map(cssUrl => requireCss(cssUrl));
@ -129,5 +131,6 @@ export default {
FORCE_GRAPH, FORCE_GRAPH,
MERMAID, MERMAID,
EXCALIDRAW, EXCALIDRAW,
MARKJS MARKJS,
I18NEXT
} }

View File

@ -69,6 +69,8 @@ function register(app: express.Application) {
app.use(`/${assetPath}/node_modules/split.js/dist/`, persistentCacheStatic(path.join(srcRoot, '..', 'node_modules/split.js/dist/'))); app.use(`/${assetPath}/node_modules/split.js/dist/`, persistentCacheStatic(path.join(srcRoot, '..', 'node_modules/split.js/dist/')));
app.use(`/${assetPath}/node_modules/panzoom/dist/`, persistentCacheStatic(path.join(srcRoot, '..', 'node_modules/panzoom/dist/'))); app.use(`/${assetPath}/node_modules/panzoom/dist/`, persistentCacheStatic(path.join(srcRoot, '..', 'node_modules/panzoom/dist/')));
app.use(`/${assetPath}/node_modules/i18next/`, persistentCacheStatic(path.join(srcRoot, "..", 'node_modules/i18next/')))
} }
export = { export = {