chore: upgrade i18next, export useTranslation from @tachybase/client (#1211)

Reviewed-on: daoyoucloud/tachybase#1211
This commit is contained in:
sealday 2024-06-20 11:11:18 +08:00
parent eb01bdcb6a
commit b755424af5
49 changed files with 1009 additions and 1532 deletions

View File

@ -34,7 +34,7 @@
"deepmerge": "^4.2.2", "deepmerge": "^4.2.2",
"file-saver": "^2.0.5", "file-saver": "^2.0.5",
"flat": "^5.0.2", "flat": "^5.0.2",
"i18next": "^22.4.9", "i18next": "^23.11.5",
"i18next-http-backend": "^2.1.1", "i18next-http-backend": "^2.1.1",
"lodash": "4.17.21", "lodash": "4.17.21",
"lru-cache": "8.0.5", "lru-cache": "8.0.5",
@ -51,7 +51,7 @@
"react-error-boundary": "^4.0.10", "react-error-boundary": "^4.0.10",
"react-helmet": "^6.1.0", "react-helmet": "^6.1.0",
"react-hotkeys-hook": "^3.4.7", "react-hotkeys-hook": "^3.4.7",
"react-i18next": "^11.15.1", "react-i18next": "^14.1.2",
"react-iframe": "~1.8.5", "react-iframe": "~1.8.5",
"react-image-lightbox": "^5.1.4", "react-image-lightbox": "^5.1.4",
"react-intersection-observer": "^9.10.3", "react-intersection-observer": "^9.10.3",

View File

@ -47,6 +47,7 @@ export * from './modules/blocks/data-blocks/details-multi/setDataLoadingModeSett
export * from './modules/blocks/data-blocks/form'; export * from './modules/blocks/data-blocks/form';
export * from './modules/blocks/data-blocks/table'; export * from './modules/blocks/data-blocks/table';
export * from './modules/blocks/data-blocks/table-selector'; export * from './modules/blocks/data-blocks/table-selector';
export * from 'react-i18next';
export * from './modules/blocks/useParentRecordCommon'; export * from './modules/blocks/useParentRecordCommon';

View File

@ -36,7 +36,7 @@
"decompress": "4.2.1", "decompress": "4.2.1",
"find-package-json": "^1.2.0", "find-package-json": "^1.2.0",
"fs-extra": "^11.1.1", "fs-extra": "^11.1.1",
"i18next": "^22.4.9", "i18next": "^23.11.5",
"ini": "^4.1.1", "ini": "^4.1.1",
"koa": "^2.13.4", "koa": "^2.13.4",
"koa-bodyparser": "^4.3.0", "koa-bodyparser": "^4.3.0",

View File

@ -11,7 +11,7 @@
"antd-mobile": "^5.36.1", "antd-mobile": "^5.36.1",
"antd-mobile-icons": "^0.3.0", "antd-mobile-icons": "^0.3.0",
"lodash": "4.17.21", "lodash": "4.17.21",
"react-i18next": "^11.15.1", "react-i18next": "^14.1.2",
"react-router-dom": "6.x" "react-router-dom": "6.x"
}, },
"peerDependencies": { "peerDependencies": {

View File

@ -20,7 +20,7 @@
"antd": "5.18.1", "antd": "5.18.1",
"lodash": "^4.17.21", "lodash": "^4.17.21",
"react": "~18.3.1", "react": "~18.3.1",
"react-i18next": "^11.15.1", "react-i18next": "^14.1.2",
"sequelize": "^6.26.0" "sequelize": "^6.26.0"
}, },
"peerDependencies": { "peerDependencies": {

View File

@ -32,7 +32,7 @@
"qrcode.react": "^3.1.0", "qrcode.react": "^3.1.0",
"react": "^18.3.1", "react": "^18.3.1",
"react-error-boundary": "^4.0.10", "react-error-boundary": "^4.0.10",
"react-i18next": "^11.15.1", "react-i18next": "^14.1.2",
"react-pdf": "^7.5.1", "react-pdf": "^7.5.1",
"react-router-dom": "^6.11.2", "react-router-dom": "^6.11.2",
"react-transition-group": "^4.4.5", "react-transition-group": "^4.4.5",

View File

@ -20,7 +20,7 @@
"lodash": "4.17.21", "lodash": "4.17.21",
"react": "^18.3.1", "react": "^18.3.1",
"react-dom": "^18.3.1", "react-dom": "^18.3.1",
"react-i18next": "^11.15.1" "react-i18next": "^14.1.2"
}, },
"peerDependencies": { "peerDependencies": {
"@tachybase/acl": "workspace:*", "@tachybase/acl": "workspace:*",

View File

@ -14,7 +14,7 @@
"@tachybase/schema": "workspace:*", "@tachybase/schema": "workspace:*",
"antd": "5.18.1", "antd": "5.18.1",
"lodash": "4.17.21", "lodash": "4.17.21",
"react-i18next": "^11.15.1", "react-i18next": "^14.1.2",
"react-router-dom": "^6.11.2" "react-router-dom": "^6.11.2"
}, },
"peerDependencies": { "peerDependencies": {

View File

@ -11,7 +11,7 @@
"devDependencies": { "devDependencies": {
"@tachybase/schema": "workspace:*", "@tachybase/schema": "workspace:*",
"antd": "5.18.1", "antd": "5.18.1",
"react-i18next": "^11.15.1", "react-i18next": "^14.1.2",
"react-router-dom": "^6.11.2" "react-router-dom": "^6.11.2"
}, },
"peerDependencies": { "peerDependencies": {

View File

@ -12,7 +12,7 @@
"@tachybase/schema": "workspace:*", "@tachybase/schema": "workspace:*",
"antd": "5.18.1", "antd": "5.18.1",
"lodash": "4.17.21", "lodash": "4.17.21",
"react-i18next": "^11.15.1" "react-i18next": "^14.1.2"
}, },
"peerDependencies": { "peerDependencies": {
"@tachybase/client": "workspace:*", "@tachybase/client": "workspace:*",

View File

@ -9,7 +9,7 @@
"devDependencies": { "devDependencies": {
"@ant-design/icons": "~5.3.7", "@ant-design/icons": "~5.3.7",
"antd": "5.18.1", "antd": "5.18.1",
"react-i18next": "^11.15.1", "react-i18next": "^14.1.2",
"swagger-ui-dist": "^5.3.1" "swagger-ui-dist": "^5.3.1"
}, },
"peerDependencies": { "peerDependencies": {

View File

@ -13,10 +13,10 @@
"ahooks": "^3.7.2", "ahooks": "^3.7.2",
"antd": "5.18.1", "antd": "5.18.1",
"dayjs": "^1.11.8", "dayjs": "^1.11.8",
"i18next": "^22.4.9", "i18next": "^23.11.5",
"react": "^18.3.1", "react": "^18.3.1",
"react-dom": "^18.3.1", "react-dom": "^18.3.1",
"react-i18next": "^11.15.1" "react-i18next": "^14.1.2"
}, },
"peerDependencies": { "peerDependencies": {
"@tachybase/actions": "workspace:*", "@tachybase/actions": "workspace:*",

View File

@ -1 +1 @@
export const NAMESPACE = '@tachybase/plugin-api-keys'; export const NAMESPACE = 'api-keys';

View File

@ -12,7 +12,7 @@
"@tachybase/components": "workspace:*", "@tachybase/components": "workspace:*",
"antd": "5.18.1", "antd": "5.18.1",
"react": "^18.3.1", "react": "^18.3.1",
"react-i18next": "^11.15.1" "react-i18next": "^14.1.2"
}, },
"peerDependencies": { "peerDependencies": {
"@tachybase/client": "workspace:*", "@tachybase/client": "workspace:*",

View File

@ -14,7 +14,7 @@
"antd": "5.18.1", "antd": "5.18.1",
"cron": "^2.3.1", "cron": "^2.3.1",
"react": "^18.3.1", "react": "^18.3.1",
"react-i18next": "^11.15.1", "react-i18next": "^14.1.2",
"react-router-dom": "^6.11.2" "react-router-dom": "^6.11.2"
}, },
"peerDependencies": { "peerDependencies": {

View File

@ -28,7 +28,7 @@
"mkdirp": "^1.0.4", "mkdirp": "^1.0.4",
"object-path": "^0.11.8", "object-path": "^0.11.8",
"react": "^18.3.1", "react": "^18.3.1",
"react-i18next": "^11.15.1", "react-i18next": "^14.1.2",
"semver": "^7.5.4", "semver": "^7.5.4",
"tar": "^6.1.13" "tar": "^6.1.13"
}, },

View File

@ -20,7 +20,7 @@
"lodash": "^4.17.21", "lodash": "^4.17.21",
"react": "^18.3.1", "react": "^18.3.1",
"react-big-calendar": "^1.8.1", "react-big-calendar": "^1.8.1",
"react-i18next": "^11.15.1", "react-i18next": "^14.1.2",
"react-js-cron": "^3.1.0", "react-js-cron": "^3.1.0",
"solarlunar-es": "^1.0.9" "solarlunar-es": "^1.0.9"
}, },

View File

@ -11,7 +11,7 @@
"devDependencies": { "devDependencies": {
"@ant-design/icons": "~5.3.7", "@ant-design/icons": "~5.3.7",
"antd": "5.18.1", "antd": "5.18.1",
"react-i18next": "^11.15.1", "react-i18next": "^14.1.2",
"react-router-dom": "6.x" "react-router-dom": "6.x"
}, },
"peerDependencies": { "peerDependencies": {

View File

@ -9,7 +9,7 @@
"antd": "~5.18.1", "antd": "~5.18.1",
"dayjs": "^1.11.8", "dayjs": "^1.11.8",
"lodash": "^4.17.21", "lodash": "^4.17.21",
"react-i18next": "^11.15.1" "react-i18next": "^14.1.2"
}, },
"peerDependencies": { "peerDependencies": {
"@tachybase/client": "workspace:*", "@tachybase/client": "workspace:*",

View File

@ -13,7 +13,7 @@
"@tachybase/schema": "workspace:*", "@tachybase/schema": "workspace:*",
"antd": "5.18.1", "antd": "5.18.1",
"lodash": "~4.17.21", "lodash": "~4.17.21",
"react-i18next": "^11.15.1", "react-i18next": "^14.1.2",
"react-router-dom": "6.x" "react-router-dom": "6.x"
}, },
"peerDependencies": { "peerDependencies": {

View File

@ -15,7 +15,7 @@
"ahooks": "^3.7.2", "ahooks": "^3.7.2",
"antd": "5.18.1", "antd": "5.18.1",
"lodash": "4.17.21", "lodash": "4.17.21",
"react-i18next": "^11.15.1", "react-i18next": "^14.1.2",
"react-router-dom": "^6.11.2", "react-router-dom": "^6.11.2",
"sequelize": "^6.26.0" "sequelize": "^6.26.0"
}, },

View File

@ -21,7 +21,7 @@
"lodash": "^4.17.21", "lodash": "^4.17.21",
"react": "^18.3.1", "react": "^18.3.1",
"react-error-boundary": "^4.0.10", "react-error-boundary": "^4.0.10",
"react-i18next": "^11.15.1", "react-i18next": "^14.1.2",
"sequelize": "^6.26.0" "sequelize": "^6.26.0"
}, },
"peerDependencies": { "peerDependencies": {

View File

@ -16,7 +16,7 @@
"lodash": "4.17.21", "lodash": "4.17.21",
"node-xlsx": "^0.16.1", "node-xlsx": "^0.16.1",
"react": "^18.3.1", "react": "^18.3.1",
"react-i18next": "^11.15.1" "react-i18next": "^14.1.2"
}, },
"peerDependencies": { "peerDependencies": {
"@tachybase/actions": "workspace:*", "@tachybase/actions": "workspace:*",

View File

@ -7,7 +7,7 @@
"lodash": "^4.17.21", "lodash": "^4.17.21",
"mysql2": "^3.9.1", "mysql2": "^3.9.1",
"pg": "^8.11.3", "pg": "^8.11.3",
"react-i18next": "^11.15.1" "react-i18next": "^14.1.2"
}, },
"devDependencies": { "devDependencies": {
"@types/lodash": "^4.17.5" "@types/lodash": "^4.17.5"

View File

@ -28,7 +28,7 @@
"multer-cos": "^1.0.3", "multer-cos": "^1.0.3",
"multer-s3": "^3.0.1", "multer-s3": "^3.0.1",
"react": "^18.3.1", "react": "^18.3.1",
"react-i18next": "^11.15.1", "react-i18next": "^14.1.2",
"supertest": "^6.1.6" "supertest": "^6.1.6"
}, },
"peerDependencies": { "peerDependencies": {

View File

@ -12,7 +12,7 @@
"@tachybase/components": "workspace:*", "@tachybase/components": "workspace:*",
"@tachybase/schema": "workspace:*", "@tachybase/schema": "workspace:*",
"react": "^18.3.1", "react": "^18.3.1",
"react-i18next": "^11.15.1" "react-i18next": "^14.1.2"
}, },
"peerDependencies": { "peerDependencies": {
"@tachybase/client": "workspace:*", "@tachybase/client": "workspace:*",

View File

@ -15,7 +15,7 @@
"@tachybase/schema": "workspace:*", "@tachybase/schema": "workspace:*",
"antd": "5.18.1", "antd": "5.18.1",
"lodash": "4.17.21", "lodash": "4.17.21",
"react-i18next": "^11.15.1" "react-i18next": "^14.1.2"
}, },
"peerDependencies": { "peerDependencies": {
"@tachybase/client": "workspace:*", "@tachybase/client": "workspace:*",

View File

@ -24,7 +24,7 @@
"dagre": "^0.8.5", "dagre": "^0.8.5",
"lodash": "4.17.21", "lodash": "4.17.21",
"react": "^18.3.1", "react": "^18.3.1",
"react-i18next": "^11.15.1", "react-i18next": "^14.1.2",
"react-router-dom": "^6.11.2" "react-router-dom": "^6.11.2"
}, },
"peerDependencies": { "peerDependencies": {

View File

@ -13,7 +13,7 @@
"@tachybase/schema": "workspace:*", "@tachybase/schema": "workspace:*",
"antd": "5.18.1", "antd": "5.18.1",
"react": "^18.3.1", "react": "^18.3.1",
"react-i18next": "^11.15.1", "react-i18next": "^14.1.2",
"react-iframe": "~1.8.5" "react-iframe": "~1.8.5"
}, },
"peerDependencies": { "peerDependencies": {

View File

@ -21,7 +21,7 @@
"node-xlsx": "^0.16.1", "node-xlsx": "^0.16.1",
"react": "^18.3.1", "react": "^18.3.1",
"react-dom": "^18.3.1", "react-dom": "^18.3.1",
"react-i18next": "^11.15.1", "react-i18next": "^14.1.2",
"xlsx": "^0.17.0" "xlsx": "^0.17.0"
}, },
"peerDependencies": { "peerDependencies": {

View File

@ -15,7 +15,7 @@
"antd": "5.18.1", "antd": "5.18.1",
"lodash": "4.17.21", "lodash": "4.17.21",
"react-beautiful-dnd": "^13.1.0", "react-beautiful-dnd": "^13.1.0",
"react-i18next": "^11.15.1" "react-i18next": "^14.1.2"
}, },
"peerDependencies": { "peerDependencies": {
"@tachybase/client": "workspace:*", "@tachybase/client": "workspace:*",

View File

@ -14,7 +14,7 @@
"ahooks": "^3.7.2", "ahooks": "^3.7.2",
"antd": "5.18.1", "antd": "5.18.1",
"deepmerge": "^4.3.1", "deepmerge": "^4.3.1",
"react-i18next": "^11.15.1" "react-i18next": "^14.1.2"
}, },
"peerDependencies": { "peerDependencies": {
"@tachybase/actions": "workspace:*", "@tachybase/actions": "workspace:*",

View File

@ -13,7 +13,7 @@
"@types/tar-fs": "^2.0.2", "@types/tar-fs": "^2.0.2",
"ahooks": "^3.7.2", "ahooks": "^3.7.2",
"antd": "5.18.1", "antd": "5.18.1",
"react-i18next": "^11.15.1", "react-i18next": "^14.1.2",
"tar-fs": "^3.0.4" "tar-fs": "^3.0.4"
}, },
"peerDependencies": { "peerDependencies": {

View File

@ -23,7 +23,7 @@
"lodash": "4.17.21", "lodash": "4.17.21",
"react": "~18.3.1", "react": "~18.3.1",
"react-dom": "~18.3.1", "react-dom": "~18.3.1",
"react-i18next": "^11.15.1", "react-i18next": "^14.1.2",
"react-router-dom": "^6.11.2" "react-router-dom": "^6.11.2"
}, },
"peerDependencies": { "peerDependencies": {

View File

@ -1,4 +1,4 @@
import { i18n, tval, useApp } from '@tachybase/client'; import { i18n, tval, useTranslation} from '@tachybase/client';
export const NAMESPACE = 'map'; export const NAMESPACE = 'map';
@ -12,7 +12,5 @@ export function generateNTemplate(key: string) {
} }
export function useMapTranslation() { export function useMapTranslation() {
const { i18n } = useApp(); return useTranslation([NAMESPACE, 'client']);
const t = (key: string, props = {}) => i18n.t(key, { ns: [NAMESPACE, 'client'], ...props });
return { t };
} }

View File

@ -18,7 +18,7 @@
"lodash": "4.17.21", "lodash": "4.17.21",
"react": "~18.3.1", "react": "~18.3.1",
"react-dom": "~18.3.1", "react-dom": "~18.3.1",
"react-i18next": "11.x", "react-i18next": "~14.1.2",
"react-router-dom": "6.x" "react-router-dom": "6.x"
}, },
"peerDependencies": { "peerDependencies": {

View File

@ -16,7 +16,7 @@
"mysql2": "^2.3.3", "mysql2": "^2.3.3",
"pg": "^8.7.3", "pg": "^8.7.3",
"react": "~18.3.1", "react": "~18.3.1",
"react-i18next": "^11.15.1", "react-i18next": "^14.1.2",
"react-router-dom": "^6.11.2" "react-router-dom": "^6.11.2"
}, },
"peerDependencies": { "peerDependencies": {

View File

@ -12,7 +12,7 @@
"antd": "5.18.1", "antd": "5.18.1",
"lodash": "4.17.21", "lodash": "4.17.21",
"react": "~18.3.1", "react": "~18.3.1",
"react-i18next": "^11.15.1" "react-i18next": "^14.1.2"
}, },
"peerDependencies": { "peerDependencies": {
"@tachybase/client": "workspace:*", "@tachybase/client": "workspace:*",

View File

@ -17,7 +17,7 @@
"nanoid": "3.3.4", "nanoid": "3.3.4",
"openid-client": "^5.4.2", "openid-client": "^5.4.2",
"react": "~18.3.1", "react": "~18.3.1",
"react-i18next": "^11.15.1", "react-i18next": "^14.1.2",
"react-router-dom": "^6.11.2" "react-router-dom": "^6.11.2"
}, },
"peerDependencies": { "peerDependencies": {

View File

@ -14,7 +14,7 @@
"@tachybase/schema": "workspace:*", "@tachybase/schema": "workspace:*",
"antd": "5.18.1", "antd": "5.18.1",
"react": "~18.3.1", "react": "~18.3.1",
"react-i18next": "^11.15.1", "react-i18next": "^14.1.2",
"react-router-dom": "^6.11.2" "react-router-dom": "^6.11.2"
}, },
"peerDependencies": { "peerDependencies": {

View File

@ -16,7 +16,7 @@
"dayjs": "^1.11.8", "dayjs": "^1.11.8",
"lodash": "4.17.21", "lodash": "4.17.21",
"react": "~18.3.1", "react": "~18.3.1",
"react-i18next": "^11.15.1", "react-i18next": "^14.1.2",
"react-js-cron": "^3.1.0" "react-js-cron": "^3.1.0"
}, },
"peerDependencies": { "peerDependencies": {

View File

@ -12,7 +12,7 @@
"@tachybase/schema": "workspace:*", "@tachybase/schema": "workspace:*",
"antd": "5.18.1", "antd": "5.18.1",
"react": "~18.3.1", "react": "~18.3.1",
"react-i18next": "^11.15.1" "react-i18next": "^14.1.2"
}, },
"peerDependencies": { "peerDependencies": {
"@tachybase/actions": "workspace:*", "@tachybase/actions": "workspace:*",

View File

@ -15,7 +15,7 @@
"lodash": "4.17.21", "lodash": "4.17.21",
"rc-tree-select": "5.5.5", "rc-tree-select": "5.5.5",
"react": "~18.3.1", "react": "~18.3.1",
"react-i18next": "^11.15.1" "react-i18next": "^14.1.2"
}, },
"peerDependencies": { "peerDependencies": {
"@tachybase/client": "workspace:*", "@tachybase/client": "workspace:*",

View File

@ -18,7 +18,7 @@
"rc-util": "^5.32.0", "rc-util": "^5.32.0",
"react": "^18.3.1", "react": "^18.3.1",
"react-colorful": "^5.5.1", "react-colorful": "^5.5.1",
"react-i18next": "^11.15.1", "react-i18next": "^14.1.2",
"tinycolor2": "^1.6.0", "tinycolor2": "^1.6.0",
"use-debouncy": "^4.3.0", "use-debouncy": "^4.3.0",
"vanilla-jsoneditor": "^0.17.8" "vanilla-jsoneditor": "^0.17.8"

View File

@ -13,7 +13,7 @@
"@types/jsonwebtoken": "^8.5.8", "@types/jsonwebtoken": "^8.5.8",
"antd": "5.18.1", "antd": "5.18.1",
"jsonwebtoken": "^8.5.1", "jsonwebtoken": "^8.5.1",
"react-i18next": "^11.15.1" "react-i18next": "^14.1.2"
}, },
"peerDependencies": { "peerDependencies": {
"@tachybase/actions": "workspace:*", "@tachybase/actions": "workspace:*",

View File

@ -17,7 +17,7 @@
"antd": "5.18.1", "antd": "5.18.1",
"dayjs": "^1.11.8", "dayjs": "^1.11.8",
"react": "~18.3.1", "react": "~18.3.1",
"react-i18next": "^11.15.1", "react-i18next": "^14.1.2",
"tencentcloud-sdk-nodejs": "^4.0.525" "tencentcloud-sdk-nodejs": "^4.0.525"
}, },
"peerDependencies": { "peerDependencies": {

View File

@ -20,7 +20,7 @@
"antd": "5.18.1", "antd": "5.18.1",
"lodash": "^4.17.21", "lodash": "^4.17.21",
"react": "~18.3.1", "react": "~18.3.1",
"react-i18next": "^11.15.1", "react-i18next": "^14.1.2",
"sequelize": "^6.26.0" "sequelize": "^6.26.0"
}, },
"peerDependencies": { "peerDependencies": {

View File

@ -28,7 +28,7 @@
"lodash": "4.17.21", "lodash": "4.17.21",
"lru-cache": "8.0.5", "lru-cache": "8.0.5",
"react": "~18.3.1", "react": "~18.3.1",
"react-i18next": "^11.15.1", "react-i18next": "^14.1.2",
"react-js-cron": "^3.1.0", "react-js-cron": "^3.1.0",
"react-router-dom": "^6.11.2", "react-router-dom": "^6.11.2",
"sequelize": "^6.26.0" "sequelize": "^6.26.0"

File diff suppressed because it is too large Load Diff