Build your personal knowledge base with Trilium Notes
TypeScript electronelectron-appknowledge-baseknowledge-graphknowledge-managementknowledge-management-graphlocal-firstnote-managmentnote-takernote-takingnotebooknotesnotes-apppersonal-knowledge-basepersonal-wikiscriptableself-hostedself-hostingwiki
i18n: Set up client dependency to i18next
Elian Doran10ec7d6b2bf9
diff --git a/src/public/app/services/i18n.js b/src/public/app/services/i18n.jsnew file mode 100644index 0000000000..7fab4af921--- /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 filediff --git a/src/public/app/services/library_loader.js b/src/public/app/services/library_loader.jsindex 6860795ca5..aa8ffe9846 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.tsindex 6ebfd8313e..475940e32a 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 = {