From 8df5fcde0fa3253bfe74159f46431ebb65db7d3d Mon Sep 17 00:00:00 2001 From: Daniel Ziegenberg Date: Fri, 31 May 2024 15:34:26 +0200 Subject: [PATCH] Replace deprecated i18next-xhr-backend with i18next-http-backend Signed-off-by: Daniel Ziegenberg --- package-lock.json | 65 ++++++++++++++++++++++++++++++++++++++++++----- package.json | 2 +- src/i18n/i18n.ts | 6 ++--- 3 files changed, 62 insertions(+), 11 deletions(-) diff --git a/package-lock.json b/package-lock.json index ca52a773c4..ab78e83dbc 100644 --- a/package-lock.json +++ b/package-lock.json @@ -27,7 +27,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", @@ -2841,6 +2841,15 @@ "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==", + "license": "MIT", + "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", @@ -3373,13 +3382,13 @@ "@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==", + "license": "MIT", "dependencies": { - "@babel/runtime": "^7.5.5" + "cross-fetch": "4.0.0" } }, "node_modules/immer": { @@ -3833,6 +3842,26 @@ "tslib": "^2.0.3" } }, + "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==", + "license": "MIT", + "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-releases": { "version": "2.0.14", "resolved": "https://registry.npmjs.org/node-releases/-/node-releases-2.0.14.tgz", @@ -4657,6 +4686,12 @@ "resolved": "https://registry.npmjs.org/toposort/-/toposort-2.0.2.tgz", "integrity": "sha512-0a5EOkAUp8D4moMi2W8ZF8jcga7BgZd91O/yabJCFY8az+XSzeGyTKs0Aoo897iV1Nj6guFq8orWDS96z91oGg==" }, + "node_modules/tr46": { + "version": "0.0.3", + "resolved": "https://registry.npmjs.org/tr46/-/tr46-0.0.3.tgz", + "integrity": "sha512-N3WMsuqV66lT30CrXNbEjx4GEwlow3v6rr4mCcv6prnfwhS01rkgyFdjPNBYd9br7LpXV1+Emh01fHnq2Gdgrw==", + "license": "MIT" + }, "node_modules/tslib": { "version": "2.6.2", "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.6.2.tgz", @@ -5013,6 +5048,22 @@ "loose-envify": "^1.0.0" } }, + "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==", + "license": "BSD-2-Clause" + }, + "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==", + "license": "MIT", + "dependencies": { + "tr46": "~0.0.3", + "webidl-conversions": "^3.0.0" + } + }, "node_modules/which": { "version": "2.0.2", "resolved": "https://registry.npmjs.org/which/-/which-2.0.2.tgz", diff --git a/package.json b/package.json index 4a14ced112..dff4166116 100644 --- a/package.json +++ b/package.json @@ -23,7 +23,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,