diff --git a/src/public/app/services/i18n.js b/src/public/app/services/i18n.js new file mode 100644 index 000000000..7fab4af92 --- /dev/null +++ b/src/public/app/services/i18n.js @@ -0,0 +1,5 @@ +import library_loader from "./library_loader.js"; + +await library_loader.requireLibrary(library_loader.I18NEXT); + +export const t = i18next.t; \ No newline at end of file diff --git a/src/public/app/services/library_loader.js b/src/public/app/services/library_loader.js index 6860795ca..aa8ffe984 100644 --- a/src/public/app/services/library_loader.js +++ b/src/public/app/services/library_loader.js @@ -72,6 +72,8 @@ const MARKJS = { ] }; +const I18NEXT = { js: [ "node_modules/i18next/i18next.min.js" ] }; + async function requireLibrary(library) { if (library.css) { library.css.map(cssUrl => requireCss(cssUrl)); @@ -129,5 +131,6 @@ export default { FORCE_GRAPH, MERMAID, EXCALIDRAW, - MARKJS + MARKJS, + I18NEXT } diff --git a/src/routes/assets.ts b/src/routes/assets.ts index 6ebfd8313..475940e32 100644 --- a/src/routes/assets.ts +++ b/src/routes/assets.ts @@ -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/panzoom/dist/`, persistentCacheStatic(path.join(srcRoot, '..', 'node_modules/panzoom/dist/'))); + + app.use(`/${assetPath}/node_modules/i18next/`, persistentCacheStatic(path.join(srcRoot, "..", 'node_modules/i18next/'))) } export = {