From af4b14fca6bb11a34323a8d418eedd1e8875be98 Mon Sep 17 00:00:00 2001 From: Alunara <> Date: Tue, 14 Jan 2025 19:00:35 +0100 Subject: [PATCH 01/12] chore: add and use a base lingui config --- apps/dao/lingui.config.js | 15 --------------- apps/dao/lingui.config.ts | 6 ++++++ apps/lend/lingui.config.js | 15 --------------- apps/lend/lingui.config.ts | 6 ++++++ apps/loan/lingui.config.js | 15 --------------- apps/loan/lingui.config.ts | 6 ++++++ apps/main/lingui.config.js | 25 ------------------------- apps/main/lingui.config.ts | 6 ++++++ lingui.config.ts | 24 ++++++++++++++++++++++++ 9 files changed, 48 insertions(+), 70 deletions(-) delete mode 100644 apps/dao/lingui.config.js create mode 100644 apps/dao/lingui.config.ts delete mode 100644 apps/lend/lingui.config.js create mode 100644 apps/lend/lingui.config.ts delete mode 100644 apps/loan/lingui.config.js create mode 100644 apps/loan/lingui.config.ts delete mode 100644 apps/main/lingui.config.js create mode 100644 apps/main/lingui.config.ts create mode 100644 lingui.config.ts diff --git a/apps/dao/lingui.config.js b/apps/dao/lingui.config.js deleted file mode 100644 index f059c6626..000000000 --- a/apps/dao/lingui.config.js +++ /dev/null @@ -1,15 +0,0 @@ -module.exports = { - locales: ['en', 'zh-Hans', 'zh-Hant', 'pseudo'], - pseudoLocale: 'pseudo', - sourceLocale: 'en', - fallbackLocales: { - default: 'en', - }, - catalogs: [ - { - path: 'src/locales/{locale}/messages', - include: ['src/components', 'src/hooks', 'src/layout', 'src/pages', 'src/store', '../../packages/curve-ui-kit'], - }, - ], - format: 'po', -} diff --git a/apps/dao/lingui.config.ts b/apps/dao/lingui.config.ts new file mode 100644 index 000000000..b9b237579 --- /dev/null +++ b/apps/dao/lingui.config.ts @@ -0,0 +1,6 @@ +import { config, defaultCatalog } from '../../lingui.config' + +export default { + ...config, + catalogs: [defaultCatalog], +} diff --git a/apps/lend/lingui.config.js b/apps/lend/lingui.config.js deleted file mode 100644 index f059c6626..000000000 --- a/apps/lend/lingui.config.js +++ /dev/null @@ -1,15 +0,0 @@ -module.exports = { - locales: ['en', 'zh-Hans', 'zh-Hant', 'pseudo'], - pseudoLocale: 'pseudo', - sourceLocale: 'en', - fallbackLocales: { - default: 'en', - }, - catalogs: [ - { - path: 'src/locales/{locale}/messages', - include: ['src/components', 'src/hooks', 'src/layout', 'src/pages', 'src/store', '../../packages/curve-ui-kit'], - }, - ], - format: 'po', -} diff --git a/apps/lend/lingui.config.ts b/apps/lend/lingui.config.ts new file mode 100644 index 000000000..b9b237579 --- /dev/null +++ b/apps/lend/lingui.config.ts @@ -0,0 +1,6 @@ +import { config, defaultCatalog } from '../../lingui.config' + +export default { + ...config, + catalogs: [defaultCatalog], +} diff --git a/apps/loan/lingui.config.js b/apps/loan/lingui.config.js deleted file mode 100644 index f059c6626..000000000 --- a/apps/loan/lingui.config.js +++ /dev/null @@ -1,15 +0,0 @@ -module.exports = { - locales: ['en', 'zh-Hans', 'zh-Hant', 'pseudo'], - pseudoLocale: 'pseudo', - sourceLocale: 'en', - fallbackLocales: { - default: 'en', - }, - catalogs: [ - { - path: 'src/locales/{locale}/messages', - include: ['src/components', 'src/hooks', 'src/layout', 'src/pages', 'src/store', '../../packages/curve-ui-kit'], - }, - ], - format: 'po', -} diff --git a/apps/loan/lingui.config.ts b/apps/loan/lingui.config.ts new file mode 100644 index 000000000..b9b237579 --- /dev/null +++ b/apps/loan/lingui.config.ts @@ -0,0 +1,6 @@ +import { config, defaultCatalog } from '../../lingui.config' + +export default { + ...config, + catalogs: [defaultCatalog], +} diff --git a/apps/main/lingui.config.js b/apps/main/lingui.config.js deleted file mode 100644 index 9747c98ad..000000000 --- a/apps/main/lingui.config.js +++ /dev/null @@ -1,25 +0,0 @@ -module.exports = { - locales: ['en', 'zh-Hans', 'zh-Hant', 'pseudo'], - pseudoLocale: 'pseudo', - sourceLocale: 'en', - fallbackLocales: { - default: 'en', - }, - catalogs: [ - { - path: 'src/locales/{locale}/messages', - include: [ - 'src/components', - 'src/entities', - 'src/features', - 'src/hooks', - 'src/layout', - 'src/pages', - 'src/store', - 'src/widgets', - '../../packages/curve-ui-kit', - ], - }, - ], - format: 'po', -} diff --git a/apps/main/lingui.config.ts b/apps/main/lingui.config.ts new file mode 100644 index 000000000..b9b237579 --- /dev/null +++ b/apps/main/lingui.config.ts @@ -0,0 +1,6 @@ +import { config, defaultCatalog } from '../../lingui.config' + +export default { + ...config, + catalogs: [defaultCatalog], +} diff --git a/lingui.config.ts b/lingui.config.ts new file mode 100644 index 000000000..d0f808881 --- /dev/null +++ b/lingui.config.ts @@ -0,0 +1,24 @@ +export const defaultCatalog = { + path: 'src/locales/{locale}/messages', + include: [ + 'src/components', + 'src/entities', + 'src/features', + 'src/hooks', + 'src/layout', + 'src/pages', + 'src/store', + 'src/widgets', + '../../packages/curve-ui-kit', + ], +} as const + +export const config = { + locales: ['en', 'zh-Hans', 'zh-Hant', 'pseudo'], + pseudoLocale: 'pseudo', + sourceLocale: 'en', + fallbackLocales: { + default: 'en', + }, + format: 'po', +} as const From 62d4152a58bde8d8e3219e83f99959c04e2c9f66 Mon Sep 17 00:00:00 2001 From: Alunara <> Date: Tue, 14 Jan 2025 19:16:45 +0100 Subject: [PATCH 02/12] chore: move lingui package dependencies to curve-ui-kit --- apps/dao/package.json | 9 ++++----- apps/lend/package.json | 10 ++++------ apps/loan/package.json | 10 ++++------ apps/main/package.json | 9 ++++----- packages/curve-ui-kit/package.json | 2 ++ packages/ui/package.json | 1 - 6 files changed, 18 insertions(+), 23 deletions(-) diff --git a/apps/dao/package.json b/apps/dao/package.json index bdf832f4e..d50b8e480 100644 --- a/apps/dao/package.json +++ b/apps/dao/package.json @@ -29,7 +29,10 @@ "@curvefi/api": "^2.65.27", "@hookform/error-message": "^2.0.1", "@hookform/resolvers": "^3.9.0", - "@lingui/react": "^4.6.0", + "@lingui/cli": "^4.6.0", + "@lingui/loader": "^4.6.0", + "@lingui/macro": "^4.6.0", + "@lingui/swc-plugin": "^4.0.4", "@supercharge/promise-pool": "^2.3.2", "bignumber.js": "^9.1.2", "curve-ui-kit": "*", @@ -60,10 +63,6 @@ "zustand": "^4.5.5" }, "devDependencies": { - "@lingui/cli": "^4.6.0", - "@lingui/loader": "^4.6.0", - "@lingui/macro": "^4.6.0", - "@lingui/swc-plugin": "^4.0.4", "@next/bundle-analyzer": "^13.5.6", "@svgr/webpack": "^8.1.0", "@types/lodash": "^4.14.182", diff --git a/apps/lend/package.json b/apps/lend/package.json index 84f0699c3..13d90d136 100644 --- a/apps/lend/package.json +++ b/apps/lend/package.json @@ -27,8 +27,10 @@ }, "dependencies": { "@curvefi/lending-api": "^2.4.0", - "@lingui/detect-locale": "^4.6.0", - "@lingui/react": "^4.6.0", + "@lingui/cli": "^4.6.0", + "@lingui/loader": "^4.6.0", + "@lingui/macro": "^4.6.0", + "@lingui/swc-plugin": "^4.0.4", "@supercharge/promise-pool": "^2.3.2", "bignumber.js": "^9.1.2", "cross-fetch": "^3.1.5", @@ -60,10 +62,6 @@ "zustand": "^4.5.5" }, "devDependencies": { - "@lingui/cli": "^4.6.0", - "@lingui/loader": "^4.6.0", - "@lingui/macro": "^4.6.0", - "@lingui/swc-plugin": "^4.0.4", "@next/bundle-analyzer": "^13.5.6", "@svgr/webpack": "^8.1.0", "@types/lodash": "^4.14.182", diff --git a/apps/loan/package.json b/apps/loan/package.json index ecc382ec8..3be15e434 100644 --- a/apps/loan/package.json +++ b/apps/loan/package.json @@ -28,8 +28,10 @@ "dependencies": { "@curvefi/lending-api": "^2.4.0", "@curvefi/stablecoin-api": "^1.5.7", - "@lingui/detect-locale": "^4.6.0", - "@lingui/react": "^4.6.0", + "@lingui/cli": "^4.6.0", + "@lingui/loader": "^4.6.0", + "@lingui/macro": "^4.6.0", + "@lingui/swc-plugin": "^4.0.4", "@supercharge/promise-pool": "^2.3.2", "@tanstack/react-table": "^8.20.6", "bignumber.js": "^9.1.2", @@ -61,10 +63,6 @@ "zustand": "^4.5.5" }, "devDependencies": { - "@lingui/cli": "^4.6.0", - "@lingui/loader": "^4.6.0", - "@lingui/macro": "^4.6.0", - "@lingui/swc-plugin": "^4.0.4", "@next/bundle-analyzer": "^13.5.6", "@svgr/webpack": "^8.1.0", "@types/lodash": "^4.14.182", diff --git a/apps/main/package.json b/apps/main/package.json index fc9090281..f5ad54dc8 100644 --- a/apps/main/package.json +++ b/apps/main/package.json @@ -29,7 +29,10 @@ "@curvefi/api": "^2.65.27", "@hookform/error-message": "^2.0.1", "@hookform/resolvers": "^3.9.0", - "@lingui/react": "^4.6.0", + "@lingui/cli": "^4.6.0", + "@lingui/loader": "^4.6.0", + "@lingui/macro": "^4.6.0", + "@lingui/swc-plugin": "^4.0.4", "@supercharge/promise-pool": "^2.3.2", "bignumber.js": "^9.1.2", "cross-fetch": "^3.1.5", @@ -65,10 +68,6 @@ "zustand": "^4.5.5" }, "devDependencies": { - "@lingui/cli": "^4.6.0", - "@lingui/loader": "^4.6.0", - "@lingui/macro": "^4.6.0", - "@lingui/swc-plugin": "^4.0.4", "@next/bundle-analyzer": "^13.5.6", "@svgr/webpack": "^8.1.0", "@types/lodash": "^4.14.182", diff --git a/packages/curve-ui-kit/package.json b/packages/curve-ui-kit/package.json index 6c190857e..e8cd19ec0 100644 --- a/packages/curve-ui-kit/package.json +++ b/packages/curve-ui-kit/package.json @@ -14,6 +14,8 @@ "dependencies": { "@emotion/react": "^11.13.3", "@emotion/styled": "^11.13.0", + "@lingui/detect-locale": "^4.6.0", + "@lingui/react": "^4.6.0", "@mui/icons-material": "^6.1.4", "@mui/material": "^6.1.4", "@mui/utils": "^6.1.4", diff --git a/packages/ui/package.json b/packages/ui/package.json index 3082c4dcb..20ea02ec1 100644 --- a/packages/ui/package.json +++ b/packages/ui/package.json @@ -10,7 +10,6 @@ }, "dependencies": { "@carbon/icons-react": "11.17.0", - "@lingui/detect-locale": "^4.6.0", "bignumber.js": "^9.1.2", "ethers": "^6.13.4", "lodash": "4.17.21", From 2861c207bcc836dfa6a5fd6eba269a7d7d9ff10a Mon Sep 17 00:00:00 2001 From: Alunara <> Date: Tue, 14 Jan 2025 19:19:13 +0100 Subject: [PATCH 03/12] chore: move dayjs dependency to curve-ui-kit --- apps/dao/package.json | 1 - apps/lend/package.json | 1 - apps/loan/package.json | 1 - apps/main/package.json | 1 - packages/curve-ui-kit/package.json | 1 + 5 files changed, 1 insertion(+), 4 deletions(-) diff --git a/apps/dao/package.json b/apps/dao/package.json index d50b8e480..4e070f59c 100644 --- a/apps/dao/package.json +++ b/apps/dao/package.json @@ -36,7 +36,6 @@ "@supercharge/promise-pool": "^2.3.2", "bignumber.js": "^9.1.2", "curve-ui-kit": "*", - "dayjs": "^1.11.7", "ethers": "^6.13.4", "focus-visible": "5.2.0", "fuse.js": "^6.6.2", diff --git a/apps/lend/package.json b/apps/lend/package.json index 13d90d136..55672f1f2 100644 --- a/apps/lend/package.json +++ b/apps/lend/package.json @@ -35,7 +35,6 @@ "bignumber.js": "^9.1.2", "cross-fetch": "^3.1.5", "curve-ui-kit": "*", - "dayjs": "^1.11.7", "ethers": "^6.13.4", "external-rewards": "*", "focus-visible": "5.2.0", diff --git a/apps/loan/package.json b/apps/loan/package.json index 3be15e434..47bd7aafe 100644 --- a/apps/loan/package.json +++ b/apps/loan/package.json @@ -37,7 +37,6 @@ "bignumber.js": "^9.1.2", "cross-fetch": "^3.1.5", "curve-ui-kit": "*", - "dayjs": "^1.11.7", "ethers": "^6.13.4", "focus-visible": "5.2.0", "fuse.js": "^6.6.2", diff --git a/apps/main/package.json b/apps/main/package.json index f5ad54dc8..9274ef84e 100644 --- a/apps/main/package.json +++ b/apps/main/package.json @@ -37,7 +37,6 @@ "bignumber.js": "^9.1.2", "cross-fetch": "^3.1.5", "curve-ui-kit": "*", - "dayjs": "^1.11.7", "ethers": "^6.13.4", "external-rewards": "*", "focus-visible": "5.2.0", diff --git a/packages/curve-ui-kit/package.json b/packages/curve-ui-kit/package.json index e8cd19ec0..a8ff0b2c9 100644 --- a/packages/curve-ui-kit/package.json +++ b/packages/curve-ui-kit/package.json @@ -40,6 +40,7 @@ "@web3-onboard/trezor": "^2.4.6", "@web3-onboard/trust": "^2.1.2", "@web3-onboard/walletconnect": "^2.6.1", + "dayjs": "^1.11.7", "ethers": "^6.13.4", "react": "*", "react-dom": "*" From d056988050e0b854deb393eabab7b313b4c5843b Mon Sep 17 00:00:00 2001 From: Alunara <> Date: Tue, 14 Jan 2025 19:25:49 +0100 Subject: [PATCH 04/12] chore: move numbro dependency to curve-ui-kit --- apps/lend/package.json | 1 - apps/loan/package.json | 1 - apps/main/package.json | 1 - packages/curve-ui-kit/package.json | 1 + 4 files changed, 1 insertion(+), 3 deletions(-) diff --git a/apps/lend/package.json b/apps/lend/package.json index 55672f1f2..d1e79cce9 100644 --- a/apps/lend/package.json +++ b/apps/lend/package.json @@ -46,7 +46,6 @@ "memoizee": "^0.4.17", "next": "^13.5.6", "next-images": "^1.8.5", - "numbro": "^2.4.0", "react": "*", "react-aria": "3.22.0", "react-dom": "*", diff --git a/apps/loan/package.json b/apps/loan/package.json index 47bd7aafe..d363246d4 100644 --- a/apps/loan/package.json +++ b/apps/loan/package.json @@ -47,7 +47,6 @@ "memoizee": "^0.4.17", "next": "^13.5.6", "next-images": "^1.8.5", - "numbro": "^2.4.0", "react": "*", "react-aria": "3.22.0", "react-dom": "*", diff --git a/apps/main/package.json b/apps/main/package.json index 9274ef84e..a4b955fa7 100644 --- a/apps/main/package.json +++ b/apps/main/package.json @@ -49,7 +49,6 @@ "memoizee": "^0.4.17", "next": "^13.5.6", "next-images": "^1.8.5", - "numbro": "^2.4.0", "react": "*", "react-aria": "3.22.0", "react-dom": "*", diff --git a/packages/curve-ui-kit/package.json b/packages/curve-ui-kit/package.json index a8ff0b2c9..1bf213997 100644 --- a/packages/curve-ui-kit/package.json +++ b/packages/curve-ui-kit/package.json @@ -42,6 +42,7 @@ "@web3-onboard/walletconnect": "^2.6.1", "dayjs": "^1.11.7", "ethers": "^6.13.4", + "numbro": "^2.4.0", "react": "*", "react-dom": "*" }, From f103daf9d1e25f7d12bf2379bc723478dda959d4 Mon Sep 17 00:00:00 2001 From: Alunara <> Date: Tue, 14 Jan 2025 19:26:46 +0100 Subject: [PATCH 05/12] chore: move make-plural dependency to curve-ui-kit --- apps/dao/package.json | 1 - apps/lend/package.json | 1 - apps/loan/package.json | 1 - apps/main/package.json | 1 - packages/curve-ui-kit/package.json | 1 + 5 files changed, 1 insertion(+), 4 deletions(-) diff --git a/apps/dao/package.json b/apps/dao/package.json index 4e070f59c..35f462946 100644 --- a/apps/dao/package.json +++ b/apps/dao/package.json @@ -43,7 +43,6 @@ "intersection-observer": "^0.12.0", "lightweight-charts": "4.1.2", "lodash": "4.17.21", - "make-plural": "^7.1.0", "memoizee": "^0.4.17", "next": "^13.5.6", "next-images": "^1.8.5", diff --git a/apps/lend/package.json b/apps/lend/package.json index d1e79cce9..6d9d32ad4 100644 --- a/apps/lend/package.json +++ b/apps/lend/package.json @@ -42,7 +42,6 @@ "immer": "^9.0.12", "intersection-observer": "^0.12.0", "lodash": "4.17.21", - "make-plural": "^7.1.0", "memoizee": "^0.4.17", "next": "^13.5.6", "next-images": "^1.8.5", diff --git a/apps/loan/package.json b/apps/loan/package.json index d363246d4..079217b00 100644 --- a/apps/loan/package.json +++ b/apps/loan/package.json @@ -43,7 +43,6 @@ "immer": "^9.0.12", "intersection-observer": "^0.12.0", "lodash": "4.17.21", - "make-plural": "^7.1.0", "memoizee": "^0.4.17", "next": "^13.5.6", "next-images": "^1.8.5", diff --git a/apps/main/package.json b/apps/main/package.json index a4b955fa7..af9cff3db 100644 --- a/apps/main/package.json +++ b/apps/main/package.json @@ -45,7 +45,6 @@ "intersection-observer": "^0.12.0", "lightweight-charts": "4.1.2", "lodash": "4.17.21", - "make-plural": "^7.1.0", "memoizee": "^0.4.17", "next": "^13.5.6", "next-images": "^1.8.5", diff --git a/packages/curve-ui-kit/package.json b/packages/curve-ui-kit/package.json index 1bf213997..ca4c2d9f7 100644 --- a/packages/curve-ui-kit/package.json +++ b/packages/curve-ui-kit/package.json @@ -42,6 +42,7 @@ "@web3-onboard/walletconnect": "^2.6.1", "dayjs": "^1.11.7", "ethers": "^6.13.4", + "make-plural": "^7.1.0", "numbro": "^2.4.0", "react": "*", "react-dom": "*" From 02130dda11ba275cb579aae6380d9ab34da40ad7 Mon Sep 17 00:00:00 2001 From: Alunara <> Date: Tue, 14 Jan 2025 19:34:33 +0100 Subject: [PATCH 06/12] refactor: move detectLocale to utilsFormat where its only usage lies --- packages/ui/src/utils/index.ts | 1 - packages/ui/src/utils/utilsFormat.ts | 12 ++++++++++-- packages/ui/src/utils/utilsLocale.ts | 10 ---------- 3 files changed, 10 insertions(+), 13 deletions(-) delete mode 100644 packages/ui/src/utils/utilsLocale.ts diff --git a/packages/ui/src/utils/index.ts b/packages/ui/src/utils/index.ts index cfafa6018..92c4db297 100644 --- a/packages/ui/src/utils/index.ts +++ b/packages/ui/src/utils/index.ts @@ -2,7 +2,6 @@ export * from './helpers' export * from './responsive' export * from './sharedStyles' export * from './utilsGas' -export * from './utilsLocale' export * from './utilsFormat' export * from './utilsConnectState' export * from './utilsNetworks' diff --git a/packages/ui/src/utils/utilsFormat.ts b/packages/ui/src/utils/utilsFormat.ts index d39a30981..d3b5ebd3e 100644 --- a/packages/ui/src/utils/utilsFormat.ts +++ b/packages/ui/src/utils/utilsFormat.ts @@ -1,12 +1,20 @@ +import { detect, fromUrl, fromNavigator } from '@lingui/detect-locale' import BigNumber from 'bignumber.js' import isUndefined from 'lodash/isUndefined' import isNaN from 'lodash/isNaN' -import { detectLocale } from 'ui/src/utils/utilsLocale' - BigNumber.config({ EXPONENTIAL_AT: 20, ROUNDING_MODE: BigNumber.ROUND_HALF_UP }) export const BN = BigNumber +export function detectLocale() { + if (typeof window !== 'undefined') { + const DEFAULT_FALLBACK = () => 'en' + return detect(fromUrl('lang'), fromNavigator(), DEFAULT_FALLBACK) ?? 'en-US' + } else { + return 'en-US' + } +} + const localeDetected = detectLocale() || 'en-US' // see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/NumberFormat/NumberFormat diff --git a/packages/ui/src/utils/utilsLocale.ts b/packages/ui/src/utils/utilsLocale.ts deleted file mode 100644 index 09c7dd706..000000000 --- a/packages/ui/src/utils/utilsLocale.ts +++ /dev/null @@ -1,10 +0,0 @@ -import { detect, fromUrl, fromNavigator } from '@lingui/detect-locale' - -export function detectLocale() { - if (typeof window !== 'undefined') { - const DEFAULT_FALLBACK = () => 'en' - return detect(fromUrl('lang'), fromNavigator(), DEFAULT_FALLBACK) ?? 'en-US' - } else { - return 'en-US' - } -} From 5a817d80780683a9abcfdad69ce31e68a28a693b Mon Sep 17 00:00:00 2001 From: Alunara <> Date: Tue, 14 Jan 2025 19:47:02 +0100 Subject: [PATCH 07/12] chore: remove unnecessary ts-ignore --- packages/curve-ui-kit/src/lib/i18n.ts | 1 - 1 file changed, 1 deletion(-) diff --git a/packages/curve-ui-kit/src/lib/i18n.ts b/packages/curve-ui-kit/src/lib/i18n.ts index f8d659202..bbccb98b0 100644 --- a/packages/curve-ui-kit/src/lib/i18n.ts +++ b/packages/curve-ui-kit/src/lib/i18n.ts @@ -85,7 +85,6 @@ export function updateAppLocale(locale: string) { if (locale === 'zh-Hans') numbroLang = 'zh-CN' if (numbroLang) { - // @ts-ignore import(`numbro/languages/${numbroLang}`).then((module) => { numbro.registerLanguage(module.default) numbro.setLanguage(numbroLang) From 1b4182891f0695a10b7b597bd7145626fb384fda Mon Sep 17 00:00:00 2001 From: Alunara <> Date: Tue, 14 Jan 2025 19:17:07 +0100 Subject: [PATCH 08/12] chore: update yarn.lock --- yarn.lock | 23 +++++------------------ 1 file changed, 5 insertions(+), 18 deletions(-) diff --git a/yarn.lock b/yarn.lock index ec2f717a0..92d8168de 100644 --- a/yarn.lock +++ b/yarn.lock @@ -15114,6 +15114,8 @@ __metadata: "@chromatic-com/storybook": "npm:^2.0.2" "@emotion/react": "npm:^11.13.3" "@emotion/styled": "npm:^11.13.0" + "@lingui/detect-locale": "npm:^4.6.0" + "@lingui/react": "npm:^4.6.0" "@mui/icons-material": "npm:^6.1.4" "@mui/material": "npm:^6.1.4" "@mui/utils": "npm:^6.1.4" @@ -15150,9 +15152,12 @@ __metadata: "@web3-onboard/trust": "npm:^2.1.2" "@web3-onboard/walletconnect": "npm:^2.6.1" ajv: "npm:^8.17.1" + dayjs: "npm:^1.11.7" eslint: "npm:*" eslint-config-custom: "npm:*" ethers: "npm:^6.13.4" + make-plural: "npm:^7.1.0" + numbro: "npm:^2.4.0" prop-types: "npm:^15.8.1" react: "npm:*" react-docgen-typescript: "npm:^2.2.2" @@ -15348,7 +15353,6 @@ __metadata: "@lingui/cli": "npm:^4.6.0" "@lingui/loader": "npm:^4.6.0" "@lingui/macro": "npm:^4.6.0" - "@lingui/react": "npm:^4.6.0" "@lingui/swc-plugin": "npm:^4.0.4" "@next/bundle-analyzer": "npm:^13.5.6" "@supercharge/promise-pool": "npm:^2.3.2" @@ -15361,7 +15365,6 @@ __metadata: "@types/validator": "npm:^13.12.1" bignumber.js: "npm:^9.1.2" curve-ui-kit: "npm:*" - dayjs: "npm:^1.11.7" eslint-config-custom: "npm:*" ethers: "npm:^6.13.4" focus-visible: "npm:5.2.0" @@ -15370,7 +15373,6 @@ __metadata: intersection-observer: "npm:^0.12.0" lightweight-charts: "npm:4.1.2" lodash: "npm:4.17.21" - make-plural: "npm:^7.1.0" memoizee: "npm:^0.4.17" next: "npm:^13.5.6" next-images: "npm:^1.8.5" @@ -20682,10 +20684,8 @@ __metadata: dependencies: "@curvefi/lending-api": "npm:^2.4.0" "@lingui/cli": "npm:^4.6.0" - "@lingui/detect-locale": "npm:^4.6.0" "@lingui/loader": "npm:^4.6.0" "@lingui/macro": "npm:^4.6.0" - "@lingui/react": "npm:^4.6.0" "@lingui/swc-plugin": "npm:^4.0.4" "@next/bundle-analyzer": "npm:^13.5.6" "@supercharge/promise-pool": "npm:^2.3.2" @@ -20698,7 +20698,6 @@ __metadata: bignumber.js: "npm:^9.1.2" cross-fetch: "npm:^3.1.5" curve-ui-kit: "npm:*" - dayjs: "npm:^1.11.7" eslint-config-custom: "npm:*" ethers: "npm:^6.13.4" external-rewards: "npm:*" @@ -20707,11 +20706,9 @@ __metadata: immer: "npm:^9.0.12" intersection-observer: "npm:^0.12.0" lodash: "npm:4.17.21" - make-plural: "npm:^7.1.0" memoizee: "npm:^0.4.17" next: "npm:^13.5.6" next-images: "npm:^1.8.5" - numbro: "npm:^2.4.0" pinst: "npm:^2.1.4" prop-types: "npm:^15.6.0" react: "npm:*" @@ -20955,10 +20952,8 @@ __metadata: "@curvefi/lending-api": "npm:^2.4.0" "@curvefi/stablecoin-api": "npm:^1.5.7" "@lingui/cli": "npm:^4.6.0" - "@lingui/detect-locale": "npm:^4.6.0" "@lingui/loader": "npm:^4.6.0" "@lingui/macro": "npm:^4.6.0" - "@lingui/react": "npm:^4.6.0" "@lingui/swc-plugin": "npm:^4.0.4" "@next/bundle-analyzer": "npm:^13.5.6" "@supercharge/promise-pool": "npm:^2.3.2" @@ -20972,7 +20967,6 @@ __metadata: bignumber.js: "npm:^9.1.2" cross-fetch: "npm:^3.1.5" curve-ui-kit: "npm:*" - dayjs: "npm:^1.11.7" eslint-config-custom: "npm:*" ethers: "npm:^6.13.4" focus-visible: "npm:5.2.0" @@ -20980,11 +20974,9 @@ __metadata: immer: "npm:^9.0.12" intersection-observer: "npm:^0.12.0" lodash: "npm:4.17.21" - make-plural: "npm:^7.1.0" memoizee: "npm:^0.4.17" next: "npm:^13.5.6" next-images: "npm:^1.8.5" - numbro: "npm:^2.4.0" pinst: "npm:^2.1.4" prop-types: "npm:^15.6.0" react: "npm:*" @@ -21392,7 +21384,6 @@ __metadata: "@lingui/cli": "npm:^4.6.0" "@lingui/loader": "npm:^4.6.0" "@lingui/macro": "npm:^4.6.0" - "@lingui/react": "npm:^4.6.0" "@lingui/swc-plugin": "npm:^4.0.4" "@next/bundle-analyzer": "npm:^13.5.6" "@supercharge/promise-pool": "npm:^2.3.2" @@ -21406,7 +21397,6 @@ __metadata: bignumber.js: "npm:^9.1.2" cross-fetch: "npm:^3.1.5" curve-ui-kit: "npm:*" - dayjs: "npm:^1.11.7" eslint-config-custom: "npm:*" ethers: "npm:^6.13.4" external-rewards: "npm:*" @@ -21416,11 +21406,9 @@ __metadata: intersection-observer: "npm:^0.12.0" lightweight-charts: "npm:4.1.2" lodash: "npm:4.17.21" - make-plural: "npm:^7.1.0" memoizee: "npm:^0.4.17" next: "npm:^13.5.6" next-images: "npm:^1.8.5" - numbro: "npm:^2.4.0" pinst: "npm:^2.1.4" react: "npm:*" react-aria: "npm:3.22.0" @@ -27115,7 +27103,6 @@ __metadata: resolution: "ui@workspace:packages/ui" dependencies: "@carbon/icons-react": "npm:11.17.0" - "@lingui/detect-locale": "npm:^4.6.0" "@types/carbon__icons-react": "npm:11.16.0" "@types/react": "npm:*" "@types/react-dom": "npm:*" From 14efd11d5aae1eab519353b0585fdae820b82754 Mon Sep 17 00:00:00 2001 From: Alunara <> Date: Wed, 15 Jan 2025 12:19:57 +0100 Subject: [PATCH 09/12] refactor: inline 1 time use function --- packages/ui/src/utils/utilsFormat.ts | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) diff --git a/packages/ui/src/utils/utilsFormat.ts b/packages/ui/src/utils/utilsFormat.ts index d3b5ebd3e..da8ee92bf 100644 --- a/packages/ui/src/utils/utilsFormat.ts +++ b/packages/ui/src/utils/utilsFormat.ts @@ -6,16 +6,8 @@ import isNaN from 'lodash/isNaN' BigNumber.config({ EXPONENTIAL_AT: 20, ROUNDING_MODE: BigNumber.ROUND_HALF_UP }) export const BN = BigNumber -export function detectLocale() { - if (typeof window !== 'undefined') { - const DEFAULT_FALLBACK = () => 'en' - return detect(fromUrl('lang'), fromNavigator(), DEFAULT_FALLBACK) ?? 'en-US' - } else { - return 'en-US' - } -} - -const localeDetected = detectLocale() || 'en-US' +const localeDetected = + (typeof window !== 'undefined' && detect(fromUrl('lang'), fromNavigator(), () => 'en')) || 'en-US' // see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/NumberFormat/NumberFormat export interface NumberFormatOptions extends Intl.NumberFormatOptions { From 1184da99e7a7da0863f09331ccdb0d574a8d905b Mon Sep 17 00:00:00 2001 From: Alunara <> Date: Wed, 15 Jan 2025 12:21:45 +0100 Subject: [PATCH 10/12] chore: automatically use default lingui catalog for all apps --- apps/dao/lingui.config.ts | 3 +-- apps/lend/lingui.config.ts | 3 +-- apps/loan/lingui.config.ts | 3 +-- apps/main/lingui.config.ts | 3 +-- lingui.config.ts | 3 ++- 5 files changed, 6 insertions(+), 9 deletions(-) diff --git a/apps/dao/lingui.config.ts b/apps/dao/lingui.config.ts index b9b237579..9146d7fd4 100644 --- a/apps/dao/lingui.config.ts +++ b/apps/dao/lingui.config.ts @@ -1,6 +1,5 @@ -import { config, defaultCatalog } from '../../lingui.config' +import { config } from '../../lingui.config' export default { ...config, - catalogs: [defaultCatalog], } diff --git a/apps/lend/lingui.config.ts b/apps/lend/lingui.config.ts index b9b237579..9146d7fd4 100644 --- a/apps/lend/lingui.config.ts +++ b/apps/lend/lingui.config.ts @@ -1,6 +1,5 @@ -import { config, defaultCatalog } from '../../lingui.config' +import { config } from '../../lingui.config' export default { ...config, - catalogs: [defaultCatalog], } diff --git a/apps/loan/lingui.config.ts b/apps/loan/lingui.config.ts index b9b237579..9146d7fd4 100644 --- a/apps/loan/lingui.config.ts +++ b/apps/loan/lingui.config.ts @@ -1,6 +1,5 @@ -import { config, defaultCatalog } from '../../lingui.config' +import { config } from '../../lingui.config' export default { ...config, - catalogs: [defaultCatalog], } diff --git a/apps/main/lingui.config.ts b/apps/main/lingui.config.ts index b9b237579..9146d7fd4 100644 --- a/apps/main/lingui.config.ts +++ b/apps/main/lingui.config.ts @@ -1,6 +1,5 @@ -import { config, defaultCatalog } from '../../lingui.config' +import { config } from '../../lingui.config' export default { ...config, - catalogs: [defaultCatalog], } diff --git a/lingui.config.ts b/lingui.config.ts index d0f808881..9c4deda9e 100644 --- a/lingui.config.ts +++ b/lingui.config.ts @@ -1,4 +1,4 @@ -export const defaultCatalog = { +const defaultCatalog = { path: 'src/locales/{locale}/messages', include: [ 'src/components', @@ -21,4 +21,5 @@ export const config = { default: 'en', }, format: 'po', + catalogs: [defaultCatalog], } as const From 7384be58aee13f3a64085e3d43a6eac3eaa8a093 Mon Sep 17 00:00:00 2001 From: Alunara <> Date: Wed, 15 Jan 2025 12:24:32 +0100 Subject: [PATCH 11/12] chore: move lingui dev dependencies back to the correct section --- apps/dao/package.json | 8 ++++---- apps/lend/package.json | 8 ++++---- apps/loan/package.json | 8 ++++---- apps/main/package.json | 8 ++++---- 4 files changed, 16 insertions(+), 16 deletions(-) diff --git a/apps/dao/package.json b/apps/dao/package.json index 35f462946..8dab93838 100644 --- a/apps/dao/package.json +++ b/apps/dao/package.json @@ -29,10 +29,6 @@ "@curvefi/api": "^2.65.27", "@hookform/error-message": "^2.0.1", "@hookform/resolvers": "^3.9.0", - "@lingui/cli": "^4.6.0", - "@lingui/loader": "^4.6.0", - "@lingui/macro": "^4.6.0", - "@lingui/swc-plugin": "^4.0.4", "@supercharge/promise-pool": "^2.3.2", "bignumber.js": "^9.1.2", "curve-ui-kit": "*", @@ -61,6 +57,10 @@ "zustand": "^4.5.5" }, "devDependencies": { + "@lingui/cli": "^4.6.0", + "@lingui/loader": "^4.6.0", + "@lingui/macro": "^4.6.0", + "@lingui/swc-plugin": "^4.0.4", "@next/bundle-analyzer": "^13.5.6", "@svgr/webpack": "^8.1.0", "@types/lodash": "^4.14.182", diff --git a/apps/lend/package.json b/apps/lend/package.json index 6d9d32ad4..38bb5357c 100644 --- a/apps/lend/package.json +++ b/apps/lend/package.json @@ -27,10 +27,6 @@ }, "dependencies": { "@curvefi/lending-api": "^2.4.0", - "@lingui/cli": "^4.6.0", - "@lingui/loader": "^4.6.0", - "@lingui/macro": "^4.6.0", - "@lingui/swc-plugin": "^4.0.4", "@supercharge/promise-pool": "^2.3.2", "bignumber.js": "^9.1.2", "cross-fetch": "^3.1.5", @@ -59,6 +55,10 @@ "zustand": "^4.5.5" }, "devDependencies": { + "@lingui/cli": "^4.6.0", + "@lingui/loader": "^4.6.0", + "@lingui/macro": "^4.6.0", + "@lingui/swc-plugin": "^4.0.4", "@next/bundle-analyzer": "^13.5.6", "@svgr/webpack": "^8.1.0", "@types/lodash": "^4.14.182", diff --git a/apps/loan/package.json b/apps/loan/package.json index 079217b00..a27b97f82 100644 --- a/apps/loan/package.json +++ b/apps/loan/package.json @@ -28,10 +28,6 @@ "dependencies": { "@curvefi/lending-api": "^2.4.0", "@curvefi/stablecoin-api": "^1.5.7", - "@lingui/cli": "^4.6.0", - "@lingui/loader": "^4.6.0", - "@lingui/macro": "^4.6.0", - "@lingui/swc-plugin": "^4.0.4", "@supercharge/promise-pool": "^2.3.2", "@tanstack/react-table": "^8.20.6", "bignumber.js": "^9.1.2", @@ -60,6 +56,10 @@ "zustand": "^4.5.5" }, "devDependencies": { + "@lingui/cli": "^4.6.0", + "@lingui/loader": "^4.6.0", + "@lingui/macro": "^4.6.0", + "@lingui/swc-plugin": "^4.0.4", "@next/bundle-analyzer": "^13.5.6", "@svgr/webpack": "^8.1.0", "@types/lodash": "^4.14.182", diff --git a/apps/main/package.json b/apps/main/package.json index af9cff3db..7340a5eea 100644 --- a/apps/main/package.json +++ b/apps/main/package.json @@ -29,10 +29,6 @@ "@curvefi/api": "^2.65.27", "@hookform/error-message": "^2.0.1", "@hookform/resolvers": "^3.9.0", - "@lingui/cli": "^4.6.0", - "@lingui/loader": "^4.6.0", - "@lingui/macro": "^4.6.0", - "@lingui/swc-plugin": "^4.0.4", "@supercharge/promise-pool": "^2.3.2", "bignumber.js": "^9.1.2", "cross-fetch": "^3.1.5", @@ -65,6 +61,10 @@ "zustand": "^4.5.5" }, "devDependencies": { + "@lingui/cli": "^4.6.0", + "@lingui/loader": "^4.6.0", + "@lingui/macro": "^4.6.0", + "@lingui/swc-plugin": "^4.0.4", "@next/bundle-analyzer": "^13.5.6", "@svgr/webpack": "^8.1.0", "@types/lodash": "^4.14.182", From 1b147d91af617a2b9599a31c7390e9da02c630d9 Mon Sep 17 00:00:00 2001 From: Alunara <> Date: Wed, 15 Jan 2025 12:53:11 +0100 Subject: [PATCH 12/12] chore: one-liner app specific lingui.config --- apps/dao/lingui.config.ts | 6 +----- apps/lend/lingui.config.ts | 6 +----- apps/loan/lingui.config.ts | 6 +----- apps/main/lingui.config.ts | 6 +----- 4 files changed, 4 insertions(+), 20 deletions(-) diff --git a/apps/dao/lingui.config.ts b/apps/dao/lingui.config.ts index 9146d7fd4..b6c0e4aa9 100644 --- a/apps/dao/lingui.config.ts +++ b/apps/dao/lingui.config.ts @@ -1,5 +1 @@ -import { config } from '../../lingui.config' - -export default { - ...config, -} +export { config as default } from '../../lingui.config' diff --git a/apps/lend/lingui.config.ts b/apps/lend/lingui.config.ts index 9146d7fd4..b6c0e4aa9 100644 --- a/apps/lend/lingui.config.ts +++ b/apps/lend/lingui.config.ts @@ -1,5 +1 @@ -import { config } from '../../lingui.config' - -export default { - ...config, -} +export { config as default } from '../../lingui.config' diff --git a/apps/loan/lingui.config.ts b/apps/loan/lingui.config.ts index 9146d7fd4..b6c0e4aa9 100644 --- a/apps/loan/lingui.config.ts +++ b/apps/loan/lingui.config.ts @@ -1,5 +1 @@ -import { config } from '../../lingui.config' - -export default { - ...config, -} +export { config as default } from '../../lingui.config' diff --git a/apps/main/lingui.config.ts b/apps/main/lingui.config.ts index 9146d7fd4..b6c0e4aa9 100644 --- a/apps/main/lingui.config.ts +++ b/apps/main/lingui.config.ts @@ -1,5 +1 @@ -import { config } from '../../lingui.config' - -export default { - ...config, -} +export { config as default } from '../../lingui.config'