From 90b11bde5b38784cc97edd594a39de92fb854658 Mon Sep 17 00:00:00 2001 From: Daniel Ziegenberg Date: Fri, 24 May 2024 22:55:59 +0200 Subject: [PATCH] Replace deprecated i18next-xhr-backend with i18next-http-backend Signed-off-by: Daniel Ziegenberg --- package-lock.json | 59 +++++++++++++++++++++++++++++++++++++++++------ package.json | 2 +- src/i18n/i18n.ts | 6 ++--- 3 files changed, 56 insertions(+), 11 deletions(-) diff --git a/package-lock.json b/package-lock.json index 86bc7f2432..3bf398d300 100644 --- a/package-lock.json +++ b/package-lock.json @@ -28,7 +28,7 @@ "http-proxy-middleware": "^2.0.6", "i18next": "^23.11.5", "i18next-browser-languagedetector": "^7.2.0", - "i18next-xhr-backend": "^3.2.2", + "i18next-http-backend": "^2.5.2", "lodash": "^4.17.21", "moment": "^2.30.1", "moment-timezone": "^0.5.45", @@ -7473,6 +7473,14 @@ "node": ">=10" } }, + "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", @@ -10571,13 +10579,12 @@ "@babel/runtime": "^7.23.2" } }, - "node_modules/i18next-xhr-backend": { - "version": "3.2.2", - "resolved": "https://registry.npmjs.org/i18next-xhr-backend/-/i18next-xhr-backend-3.2.2.tgz", - "integrity": "sha512-OtRf2Vo3IqAxsttQbpjYnmMML12IMB5e0fc5B7qKJFLScitYaXa1OhMX0n0X/3vrfFlpHL9Ro/H+ps4Ej2j7QQ==", - "deprecated": "replaced by i18next-http-backend", + "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": { - "@babel/runtime": "^7.5.5" + "cross-fetch": "4.0.0" } }, "node_modules/iconv-lite": { @@ -15375,6 +15382,44 @@ "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.5.0.tgz", "integrity": "sha512-336iVw3rtn2BUK7ORdIAHTyxHGRIHVReokCR3XjbckJMK7ms8FysBfhLR8IXnAgy7T0PTPNBWKiH514FOW/WSg==" }, + "node_modules/node-fetch": { + "version": "2.7.0", + "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.7.0.tgz", + "integrity": "sha512-c4FRfUm/dbcWZ7U+1Wq0AwCyFL+3nt2bEw05wfxSz+DWpWsitgmSgYmy2dQdWyKC1694ELPqMs/YzUSNozLt8A==", + "dependencies": { + "whatwg-url": "^5.0.0" + }, + "engines": { + "node": "4.x || >=6.0.0" + }, + "peerDependencies": { + "encoding": "^0.1.0" + }, + "peerDependenciesMeta": { + "encoding": { + "optional": true + } + } + }, + "node_modules/node-fetch/node_modules/tr46": { + "version": "0.0.3", + "resolved": "https://registry.npmjs.org/tr46/-/tr46-0.0.3.tgz", + "integrity": "sha512-N3WMsuqV66lT30CrXNbEjx4GEwlow3v6rr4mCcv6prnfwhS01rkgyFdjPNBYd9br7LpXV1+Emh01fHnq2Gdgrw==" + }, + "node_modules/node-fetch/node_modules/webidl-conversions": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/webidl-conversions/-/webidl-conversions-3.0.1.tgz", + "integrity": "sha512-2JAn3z8AR6rjK8Sm8orRC0h/bcl/DqL7tRPdGZ4I1CjdF+EaMLmYxBHyXuKL849eucPFhvBoxMsflfOb8kxaeQ==" + }, + "node_modules/node-fetch/node_modules/whatwg-url": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/whatwg-url/-/whatwg-url-5.0.0.tgz", + "integrity": "sha512-saE57nupxk6v3HY35+jzBwYa0rKSy0XR8JSxZPwgLr7ys0IBzhGviA1/TUGJLmSVqs8pb9AnvICXEuOHLprYTw==", + "dependencies": { + "tr46": "~0.0.3", + "webidl-conversions": "^3.0.0" + } + }, "node_modules/node-forge": { "version": "1.3.1", "resolved": "https://registry.npmjs.org/node-forge/-/node-forge-1.3.1.tgz", diff --git a/package.json b/package.json index 558c004c2d..254e330d98 100644 --- a/package.json +++ b/package.json @@ -24,7 +24,7 @@ "http-proxy-middleware": "^2.0.6", "i18next": "^23.11.5", "i18next-browser-languagedetector": "^7.2.0", - "i18next-xhr-backend": "^3.2.2", + "i18next-http-backend": "^2.5.2", "lodash": "^4.17.21", "moment": "^2.30.1", "moment-timezone": "^0.5.45", diff --git a/src/i18n/i18n.ts b/src/i18n/i18n.ts index 7b2a3bd609..50625f6d60 100644 --- a/src/i18n/i18n.ts +++ b/src/i18n/i18n.ts @@ -2,7 +2,7 @@ import i18n from "i18next"; import { initReactI18next } from "react-i18next"; import moment from "moment"; -import Backend from "i18next-xhr-backend"; +import HttpBackend, { HttpBackendOptions } from "i18next-http-backend"; import LanguageDetector from "i18next-browser-languagedetector"; // import language files @@ -62,10 +62,10 @@ const resources = { // Configuration of i18next i18n - .use(Backend) + .use(HttpBackend) .use(LanguageDetector) .use(initReactI18next) - .init({ + .init({ resources, fallbackLng: "en-US", debug: true,