Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: improve translation in packages #600

Merged
merged 13 commits into from
Jan 15, 2025
Merged
15 changes: 0 additions & 15 deletions apps/dao/lingui.config.js

This file was deleted.

1 change: 1 addition & 0 deletions apps/dao/lingui.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export { config as default } from '../../lingui.config'
3 changes: 0 additions & 3 deletions apps/dao/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,19 +29,16 @@
"@curvefi/api": "^2.65.27",
"@hookform/error-message": "^2.0.1",
"@hookform/resolvers": "^3.9.0",
"@lingui/react": "^4.6.0",
"@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",
"immer": "^9.0.12",
"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",
Expand Down
15 changes: 0 additions & 15 deletions apps/lend/lingui.config.js

This file was deleted.

1 change: 1 addition & 0 deletions apps/lend/lingui.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export { config as default } from '../../lingui.config'
5 changes: 0 additions & 5 deletions apps/lend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,25 +27,20 @@
},
"dependencies": {
"@curvefi/lending-api": "^2.4.0",
"@lingui/detect-locale": "^4.6.0",
"@lingui/react": "^4.6.0",
"@supercharge/promise-pool": "^2.3.2",
"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",
"fuse.js": "^6.6.2",
"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",
"numbro": "^2.4.0",
"react": "*",
"react-aria": "3.22.0",
"react-dom": "*",
Expand Down
15 changes: 0 additions & 15 deletions apps/loan/lingui.config.js

This file was deleted.

1 change: 1 addition & 0 deletions apps/loan/lingui.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export { config as default } from '../../lingui.config'
5 changes: 0 additions & 5 deletions apps/loan/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,25 +28,20 @@
"dependencies": {
"@curvefi/lending-api": "^2.4.0",
"@curvefi/stablecoin-api": "^1.5.8",
"@lingui/detect-locale": "^4.6.0",
"@lingui/react": "^4.6.0",
"@supercharge/promise-pool": "^2.3.2",
"@tanstack/react-table": "^8.20.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",
"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",
"numbro": "^2.4.0",
"react": "*",
"react-aria": "3.22.0",
"react-dom": "*",
Expand Down
25 changes: 0 additions & 25 deletions apps/main/lingui.config.js

This file was deleted.

1 change: 1 addition & 0 deletions apps/main/lingui.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export { config as default } from '../../lingui.config'
4 changes: 0 additions & 4 deletions apps/main/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,10 @@
"@curvefi/api": "^2.65.27",
"@hookform/error-message": "^2.0.1",
"@hookform/resolvers": "^3.9.0",
"@lingui/react": "^4.6.0",
"@supercharge/promise-pool": "^2.3.2",
"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",
Expand All @@ -43,11 +41,9 @@
"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",
"numbro": "^2.4.0",
"react": "*",
"react-aria": "3.22.0",
"react-dom": "*",
Expand Down
25 changes: 25 additions & 0 deletions lingui.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
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',
catalogs: [defaultCatalog],
} as const
5 changes: 5 additions & 0 deletions packages/curve-ui-kit/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand All @@ -38,7 +40,10 @@
"@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",
"make-plural": "^7.1.0",
"numbro": "^2.4.0",
"react": "*",
"react-dom": "*"
},
Expand Down
1 change: 0 additions & 1 deletion packages/curve-ui-kit/src/lib/i18n.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
1 change: 0 additions & 1 deletion packages/ui/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
1 change: 0 additions & 1 deletion packages/ui/src/utils/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down
6 changes: 3 additions & 3 deletions packages/ui/src/utils/utilsFormat.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
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

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 {
Expand Down
10 changes: 0 additions & 10 deletions packages/ui/src/utils/utilsLocale.ts

This file was deleted.

Loading
Loading