From 521d35ffa24c6cbb67cdefdf44920d7912d4fe3f Mon Sep 17 00:00:00 2001 From: Joseph Mathew Date: Mon, 30 Oct 2023 17:50:37 +0530 Subject: [PATCH] Upgraded neeto-commons-frontend and removed i18n initializer (#923) * Upgraded neeto-commons-frontend and removed i18n initializer * Upgraded i18next and react-i18next * Reverted the change done in searchEmoji function --------- Co-authored-by: bot-bigbinary <13452707+bot-bigbinary@users.noreply.github.com> --- .storybook/preview.js | 7 +++++++ package.json | 11 ++++++++--- src/index.js | 4 ---- src/utils/i18next.js | 17 ----------------- yarn.lock | 42 +++++++++++++++++++++++++++++------------- 5 files changed, 44 insertions(+), 37 deletions(-) delete mode 100644 src/utils/i18next.js diff --git a/.storybook/preview.js b/.storybook/preview.js index 13cbca97..804b8f78 100644 --- a/.storybook/preview.js +++ b/.storybook/preview.js @@ -1,8 +1,15 @@ import "../src/index.scss"; import "./style.scss"; import { themes } from "@storybook/theming"; +import initializeApplication from "neetocommons/initializers"; +import en from "../src/translations/en.json"; import neetoTheme from "./neetoTheme"; +initializeApplication({ + skip: { axios: true, globalProps: true, logger: true }, + translationResources: { en: { translation: en } }, +}); + export const parameters = { layout: "fullscreen", actions: { argTypesRegex: "^on[A-Z].*" }, diff --git a/package.json b/package.json index 129c5e9c..9e4221ac 100644 --- a/package.json +++ b/package.json @@ -13,7 +13,8 @@ ], "files": [ "index.*", - "types.d.ts" + "types.d.ts", + "src/translations" ], "author": "BigBinary", "license": "MIT", @@ -114,7 +115,8 @@ "formik": "2.2.9", "fuse.js": "6.6.2", "husky": "8.0.1", - "i18next": "21.7.0", + "i18next": "23.2.7", + "js-logger": "^1.6.1", "lint-staged": "12.4.1", "lowlight": "2.7.0", "postcss": "8.4.14", @@ -132,7 +134,7 @@ "react-file-icon": "^1.3.0", "react-helmet": "6.1.0", "react-hotkeys-hook": "3.4.7", - "react-i18next": "11.16.8", + "react-i18next": "13.0.1", "react-masonry-infinite": "1.2.2", "react-popper": "2.3.0", "react-query": "3.39.3", @@ -164,10 +166,13 @@ "antd": "4.24.3", "axios": "0.27.2", "formik": "2.2.9", + "i18next": "23.2.7", + "js-logger": "^1.6.1", "ramda": "0.29.0", "react": "18.2.0", "react-dom": "18.2.0", "react-helmet": "6.1.0", + "react-i18next": "13.0.1", "react-query": "3.39.3", "react-router-dom": "5.3.3", "react-toastify": "8.0.2", diff --git a/src/index.js b/src/index.js index 3ba88fd6..a62e4b41 100644 --- a/src/index.js +++ b/src/index.js @@ -4,7 +4,6 @@ import { } from "components/Editor/utils"; import { substituteVariables } from "components/EditorContent/utils"; import { isEditorEmpty } from "utils/common"; -import { initializeI18n } from "utils/i18next"; import Attachments from "./components/Attachments"; import Editor from "./components/Editor"; @@ -12,9 +11,6 @@ import FormikEditor from "./components/Editor/FormikEditor"; import Menu from "./components/Editor/Menu"; import EditorContent from "./components/EditorContent"; import "./index.scss"; -import en from "./translations/en.json"; - -initializeI18n({ translationResources: { en: { translation: en } } }); export { Editor, diff --git a/src/utils/i18next.js b/src/utils/i18next.js deleted file mode 100644 index a06efab4..00000000 --- a/src/utils/i18next.js +++ /dev/null @@ -1,17 +0,0 @@ -import i18next from "i18next"; -import { mergeDeepLeft } from "ramda"; -import { initReactI18next } from "react-i18next"; - -import { en } from "../translations"; - -export const initializeI18n = resources => { - i18next.use(initReactI18next).init({ - resources: mergeDeepLeft({ en: { translation: en } }, resources), - lng: "en", - fallbackLng: "en", - interpolation: { - escapeValue: false, - skipOnVariables: false, - }, - }); -}; diff --git a/yarn.lock b/yarn.lock index 646fb3ed..48df3cf7 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1723,7 +1723,7 @@ dependencies: regenerator-runtime "^0.13.11" -"@babel/runtime@^7.12.13", "@babel/runtime@^7.14.5", "@babel/runtime@^7.16.7", "@babel/runtime@^7.17.2", "@babel/runtime@^7.18.0", "@babel/runtime@^7.19.0", "@babel/runtime@^7.5.5", "@babel/runtime@^7.6.2", "@babel/runtime@^7.7.2": +"@babel/runtime@^7.12.13", "@babel/runtime@^7.16.7", "@babel/runtime@^7.18.0", "@babel/runtime@^7.19.0", "@babel/runtime@^7.5.5", "@babel/runtime@^7.6.2", "@babel/runtime@^7.7.2": version "7.21.0" resolved "https://registry.yarnpkg.com/@babel/runtime/-/runtime-7.21.0.tgz#5b55c9d394e5fcf304909a8b00c07dc217b56673" integrity sha512-xwII0//EObnq89Ji5AKYQaRYiW/nZ3llSv29d49IuxPhKbtJoLP+9QUUZ4nVragQVtaVGeZrpB+ZtG/Pdy/POw== @@ -1737,6 +1737,13 @@ dependencies: regenerator-runtime "^0.13.10" +"@babel/runtime@^7.22.5": + version "7.23.2" + resolved "https://registry.yarnpkg.com/@babel/runtime/-/runtime-7.23.2.tgz#062b0ac103261d68a966c4c7baf2ae3e62ec3885" + integrity sha512-mM8eg4yl5D6i3lu2QKPuPH4FArvJ8KhTofbE7jwMUv9KX5mBvwPAqnV3MlyBNqdp9RyRKP6Yck8TrfYrPvX3bg== + dependencies: + regenerator-runtime "^0.14.0" + "@babel/runtime@~7.5.4": version "7.5.5" resolved "https://registry.yarnpkg.com/@babel/runtime/-/runtime-7.5.5.tgz#74fba56d35efbeca444091c7850ccd494fd2f132" @@ -8946,7 +8953,7 @@ html-entities@^2.1.0, html-entities@^2.3.2: resolved "https://registry.yarnpkg.com/html-entities/-/html-entities-2.3.3.tgz#117d7626bece327fc8baace8868fa6f5ef856e46" integrity sha512-DV5Ln36z34NNTDgnz0EWGBLZENelNAtkiFA4kyNOG2tDI6Mz1uSWiq1wAKdyjnJwyDiDO7Fa2SO1CTxPXL8VxA== -html-escaper@^2.0.0, html-escaper@^2.0.2: +html-escaper@^2.0.0: version "2.0.2" resolved "https://registry.yarnpkg.com/html-escaper/-/html-escaper-2.0.2.tgz#dfd60027da36a36dfcbe236262c00a5822681453" integrity sha512-H2iMtd0I4Mt5eYiapRdIDjp+XzelXQ0tFE4JS7YFwFevXXMmOp9myNrUvCg0D6ws8iqkRPBfKHgbwig1SmlLfg== @@ -9096,12 +9103,12 @@ husky@8.0.1: resolved "https://registry.yarnpkg.com/husky/-/husky-8.0.1.tgz#511cb3e57de3e3190514ae49ed50f6bc3f50b3e9" integrity sha512-xs7/chUH/CKdOCs7Zy0Aev9e/dKOMZf3K1Az1nar3tzlv0jfqnYtu235bstsWTmXOR0EfINrPa97yy4Lz6RiKw== -i18next@21.7.0: - version "21.7.0" - resolved "https://registry.yarnpkg.com/i18next/-/i18next-21.7.0.tgz#acf6937e11a8df6375e55d0ad5dc0d3c9f07e017" - integrity sha512-x8CFS5i2ev/RnVIh1kscxTk4kjIQbyltGSIfGI02Y2g7aaqIK2YSDgI7eZ8DbIOvMAbBU3CJtA3Av0N0Hy54nw== +i18next@23.2.7: + version "23.2.7" + resolved "https://registry.yarnpkg.com/i18next/-/i18next-23.2.7.tgz#1e528b71061ca62668d7d2b6586fb4e6cfe5adb4" + integrity sha512-EsbHHvF6b+p+B6Cht5fYWY7VE/WYOrqB1+DNwa1UpLTw6mG5g4tc8KCEjUUOSMUA2yqCsdYQP+PqVq5nBMtOtQ== dependencies: - "@babel/runtime" "^7.17.2" + "@babel/runtime" "^7.22.5" iconv-lite@0.4.24: version "0.4.24" @@ -9850,6 +9857,11 @@ jest-worker@^27.4.5: merge-stream "^2.0.0" supports-color "^8.0.0" +js-logger@^1.6.1: + version "1.6.1" + resolved "https://registry.yarnpkg.com/js-logger/-/js-logger-1.6.1.tgz#8f09671b515e4a6f31dced8fdb8923432e2c60af" + integrity sha512-yTgMCPXVjhmg28CuUH8CKjU+cIKL/G+zTu4Fn4lQxs8mRFH/03QTNvEFngcxfg/gRDiQAOoyCKmMTOm9ayOzXA== + js-sha3@0.8.0: version "0.8.0" resolved "https://registry.yarnpkg.com/js-sha3/-/js-sha3-0.8.0.tgz#b9b7a5da73afad7dedd0f8c463954cbde6818840" @@ -13068,13 +13080,12 @@ react-hotkeys-hook@3.4.7: dependencies: hotkeys-js "3.9.4" -react-i18next@11.16.8: - version "11.16.8" - resolved "https://registry.yarnpkg.com/react-i18next/-/react-i18next-11.16.8.tgz#e71621c16f8f77152e85795a88ba6a371e46687d" - integrity sha512-uuhSuwY0iMOPV9HUsN1OC4cGCrATPvzZ1O8UfvLR+imz/XjPmfDgZM1e4dPS0Suc2+aCQqJ0FmWP891lUkB2Cg== +react-i18next@13.0.1: + version "13.0.1" + resolved "https://registry.yarnpkg.com/react-i18next/-/react-i18next-13.0.1.tgz#4d047d2d63d9616f7f5fd4ca88b1cc449cc15290" + integrity sha512-gMO6N2GfSfuH7xlHSsZ/mZf+Py9bLm/+EDKIn5fNTuDTjcCcwmMU5UEuGCDk5mdfivbo7ySyYXBN7B9tbGUxiA== dependencies: - "@babel/runtime" "^7.14.5" - html-escaper "^2.0.2" + "@babel/runtime" "^7.22.5" html-parse-stringify "^3.0.1" react-infinite-scroller@^1.0.12: @@ -13340,6 +13351,11 @@ regenerator-runtime@^0.13.2, regenerator-runtime@^0.13.4, regenerator-runtime@^0 resolved "https://registry.yarnpkg.com/regenerator-runtime/-/regenerator-runtime-0.13.9.tgz#8925742a98ffd90814988d7566ad30ca3b263b52" integrity sha512-p3VT+cOEgxFsRRA9X4lkI1E+k2/CtnKtU4gcxyaCUreilL/vqI6CdZ3wxVUx3UOUg+gnUOQQcRI7BmSI656MYA== +regenerator-runtime@^0.14.0: + version "0.14.0" + resolved "https://registry.yarnpkg.com/regenerator-runtime/-/regenerator-runtime-0.14.0.tgz#5e19d68eb12d486f797e15a3c6a918f7cec5eb45" + integrity sha512-srw17NI0TUWHuGa5CFGGmhfNIeja30WMBfbslPNhf6JrqQlLN5gcrvig1oqPxiVaXb0oW0XRKtH6Nngs5lKCIA== + regenerator-transform@^0.15.0: version "0.15.0" resolved "https://registry.yarnpkg.com/regenerator-transform/-/regenerator-transform-0.15.0.tgz#cbd9ead5d77fae1a48d957cf889ad0586adb6537"