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
3 changes: 1 addition & 2 deletions apps/dao/lingui.config.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import { config, defaultCatalog } from '../../lingui.config'
import { config } from '../../lingui.config'

export default {
...config,
0xAlunara marked this conversation as resolved.
Show resolved Hide resolved
catalogs: [defaultCatalog],
}
8 changes: 4 additions & 4 deletions apps/dao/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": "*",
Expand Down Expand Up @@ -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",
Expand Down
3 changes: 1 addition & 2 deletions apps/lend/lingui.config.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import { config, defaultCatalog } from '../../lingui.config'
import { config } from '../../lingui.config'

export default {
...config,
catalogs: [defaultCatalog],
}
8 changes: 4 additions & 4 deletions apps/lend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down Expand Up @@ -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",
Expand Down
3 changes: 1 addition & 2 deletions apps/loan/lingui.config.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import { config, defaultCatalog } from '../../lingui.config'
import { config } from '../../lingui.config'

export default {
...config,
catalogs: [defaultCatalog],
}
8 changes: 4 additions & 4 deletions apps/loan/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down Expand Up @@ -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",
Expand Down
3 changes: 1 addition & 2 deletions apps/main/lingui.config.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import { config, defaultCatalog } from '../../lingui.config'
import { config } from '../../lingui.config'

export default {
...config,
catalogs: [defaultCatalog],
}
8 changes: 4 additions & 4 deletions apps/main/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down Expand Up @@ -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",
Expand Down
3 changes: 2 additions & 1 deletion lingui.config.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
export const defaultCatalog = {
const defaultCatalog = {
path: 'src/locales/{locale}/messages',
include: [
'src/components',
Expand All @@ -21,4 +21,5 @@ export const config = {
default: 'en',
},
format: 'po',
catalogs: [defaultCatalog],
} as const
12 changes: 2 additions & 10 deletions packages/ui/src/utils/utilsFormat.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
Loading