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: Add i18next-http-backend to library loader
Elian Dorand4bf162e9265
diff --git a/package-lock.json b/package-lock.jsonindex 683413b859..1de54f524b 100644--- a/package-lock.json+++ b/package-lock.json@@ -43,6 +43,7 @@"http-proxy-agent": "7.0.2","https-proxy-agent": "7.0.4","i18next": "^23.12.2",+ "i18next-http-backend": "^2.5.2","image-type": "4.1.0","ini": "3.0.1","is-animated": "2.0.2",@@ -4143,6 +4144,14 @@"yarn": ">=1"}},+ "node_modules/cross-fetch": {+ "version": "4.0.0",+ "resolved": "https://registry.npmjs.org/cross-fetch/-/cross-fetch-4.0.0.tgz",+ "integrity": "sha512-e4a5N8lVvuLgAWgnCrLr2PP0YyDOTHa9H/Rj54dirp61qXnNq46m82bRhNqIA5VccJtWBvPTFRV3TtvHUKPB1g==",+ "dependencies": {+ "node-fetch": "^2.6.12"+ }+ },"node_modules/cross-spawn": {"version": "7.0.3","resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.3.tgz",@@ -7480,6 +7489,14 @@"@babel/runtime": "^7.23.2"}},+ "node_modules/i18next-http-backend": {+ "version": "2.5.2",+ "resolved": "https://registry.npmjs.org/i18next-http-backend/-/i18next-http-backend-2.5.2.tgz",+ "integrity": "sha512-+K8HbDfrvc1/2X8jpb7RLhI9ZxBDpx3xogYkQwGKlWAUXLSEGXzgdt3EcUjLlBCdMwdQY+K+EUF6oh8oB6rwHw==",+ "dependencies": {+ "cross-fetch": "4.0.0"+ }+ },"node_modules/iconv-corefoundation": {"version": "1.1.7","resolved": "https://registry.npmjs.org/iconv-corefoundation/-/iconv-corefoundation-1.1.7.tgz",@@ -16636,6 +16653,14 @@"cross-spawn": "^7.0.1"}},+ "cross-fetch": {+ "version": "4.0.0",+ "resolved": "https://registry.npmjs.org/cross-fetch/-/cross-fetch-4.0.0.tgz",+ "integrity": "sha512-e4a5N8lVvuLgAWgnCrLr2PP0YyDOTHa9H/Rj54dirp61qXnNq46m82bRhNqIA5VccJtWBvPTFRV3TtvHUKPB1g==",+ "requires": {+ "node-fetch": "^2.6.12"+ }+ },"cross-spawn": {"version": "7.0.3","resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.3.tgz",@@ -19185,6 +19210,14 @@"@babel/runtime": "^7.23.2"}},+ "i18next-http-backend": {+ "version": "2.5.2",+ "resolved": "https://registry.npmjs.org/i18next-http-backend/-/i18next-http-backend-2.5.2.tgz",+ "integrity": "sha512-+K8HbDfrvc1/2X8jpb7RLhI9ZxBDpx3xogYkQwGKlWAUXLSEGXzgdt3EcUjLlBCdMwdQY+K+EUF6oh8oB6rwHw==",+ "requires": {+ "cross-fetch": "4.0.0"+ }+ },"iconv-corefoundation": {"version": "1.1.7","resolved": "https://registry.npmjs.org/iconv-corefoundation/-/iconv-corefoundation-1.1.7.tgz",diff --git a/package.json b/package.jsonindex 6d4b0cc088..554125c810 100644--- a/package.json+++ b/package.json@@ -67,6 +67,7 @@"http-proxy-agent": "7.0.2","https-proxy-agent": "7.0.4","i18next": "^23.12.2",+ "i18next-http-backend": "^2.5.2","image-type": "4.1.0","ini": "3.0.1","is-animated": "2.0.2",diff --git a/src/public/app/services/library_loader.js b/src/public/app/services/library_loader.jsindex aa8ffe9846..2dc5196866 100644--- a/src/public/app/services/library_loader.js+++ b/src/public/app/services/library_loader.js@@ -72,7 +72,10 @@ const MARKJS = {]};-const I18NEXT = { js: [ "node_modules/i18next/i18next.min.js" ] };+const I18NEXT = { js: [+ "node_modules/i18next/i18next.min.js",+ "node_modules/i18next-http-backend/i18nextHttpBackend.min.js"+] };async function requireLibrary(library) {if (library.css) {diff --git a/src/routes/assets.ts b/src/routes/assets.tsindex 1615df1663..8417c47b99 100644--- a/src/routes/assets.ts+++ b/src/routes/assets.ts@@ -72,6 +72,7 @@ function register(app: express.Application) {// i18napp.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/")));}