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

FIX/UPDATE - i18n wallets connected string handling, formatting and version bumps #2326

Merged
merged 11 commits into from
Dec 27, 2024
2 changes: 1 addition & 1 deletion docs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@
"@web3-onboard/capsule": "^2.4.0-alpha.1",
"@web3-onboard/cede-store": "^2.3.1",
"@web3-onboard/coinbase": "^2.3.1",
"@web3-onboard/core": "^2.23.0",
"@web3-onboard/core": "^2.23.1-alpha.1",
"@web3-onboard/dcent": "^2.2.8",
"@web3-onboard/enkrypt": "^2.1.1",
"@web3-onboard/finoaconnect": "^2.0.0",
Expand Down
5 changes: 4 additions & 1 deletion docs/src/routes/docs/[...3]modules/[...1]core/+page.md
Original file line number Diff line number Diff line change
Expand Up @@ -317,9 +317,12 @@ type ConnectModalOptions = {
#### i18n

An object that defines the display text for different locales. Can also be used to override the default text. To override the default text, pass in an object for the `en` locale.
Currently there is built-in support for:
- English (`en`) - Default
- Simplified Chinese (`zh`)

```typescript
type Locale = string // eg 'en', 'es'
type Locale = string // eg 'en', 'zh', 'es'
type i18nOptions = Record<Locale, i18n>
```

Expand Down
5 changes: 4 additions & 1 deletion packages/core/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -296,9 +296,12 @@ type disableFontDownload = boolean // defaults to false

**`i18n`**
An object that defines the display text for different locales. Can also be used to override the default text. To override the default text, pass in a object for the `en` locale.
Currently there is built-in support for:
- English (`en`) - Default
- Simplified Chinese (`zh`)

```typescript
type Locale = string // eg 'en', 'es'
type Locale = string // eg 'en', 'zh', 'es'
type i18nOptions = Record<Locale, i18n>
```

Expand Down
4 changes: 2 additions & 2 deletions packages/core/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@web3-onboard/core",
"version": "2.23.0",
"version": "2.23.1-alpha.1",
"description": "Web3-Onboard makes it simple to connect Ethereum hardware and software wallets to your dapp. Features standardized spec compliant web3 providers for all supported wallets, framework agnostic modern javascript UI with code splitting, CSS customization, multi-chain and multi-account support, reactive wallet state subscriptions and real-time transaction state change notifications.",
"keywords": [
"Ethereum",
Expand Down Expand Up @@ -96,7 +96,7 @@
"nanoid": "^4.0.0",
"rxjs": "^7.5.5",
"svelte": "^3.49.0",
"svelte-i18n": "^3.3.13",
"svelte-i18n": "^4.0.1",
"viem": "2.12.0"
},
"engines": {
Expand Down
4 changes: 3 additions & 1 deletion packages/core/src/i18n/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,9 @@
"subheading": "Connection Successful!",
"paragraph": "Your wallet is now connected to {app}"
},
"mainText": "Connected"
"mainText": "Connected",
"accountSelected": "Account Selected",
"availableWallet": "available wallet"
}
},
"modals": {
Expand Down
4 changes: 3 additions & 1 deletion packages/core/src/i18n/zh.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,9 @@
"subheading": "连接成功!",
"paragraph": "您的钱包现已连接到{app}"
},
"mainText": "已连接"
"mainText": "已连接",
"accountSelected": "已选择账户",
"availableWallet": "可用钱包"
}
},
"modals": {
Expand Down
2 changes: 1 addition & 1 deletion packages/core/src/provider.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { fromEventPattern, Observable } from 'rxjs'
import { fromEventPattern, type Observable } from 'rxjs'
import { filter, takeUntil, take, share, switchMap } from 'rxjs/operators'
import partition from 'lodash.partition'
import { isAddress, weiHexToEth } from '@web3-onboard/common'
Expand Down
29 changes: 20 additions & 9 deletions packages/core/src/views/connect/Index.svelte
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
<script lang="ts">
import {
ProviderRpcErrorCode,
type WalletModule
} from '@web3-onboard/common'
import { ProviderRpcErrorCode, type WalletModule } from '@web3-onboard/common'
import EventEmitter from 'eventemitter3'
import { _ } from 'svelte-i18n'
import en from '../../i18n/en.json'
Expand Down Expand Up @@ -210,11 +207,14 @@
try {
let address
let wagmiConnector: Connector | undefined

if (wagmi) {
const { buildWagmiConfig, wagmiConnect, getWagmiConnector } = wagmi

const wagmiConfig: Config = await buildWagmiConfig(chains, { label, provider })
const wagmiConfig: Config = await buildWagmiConfig(chains, {
label,
provider
})
updateWagmiConfig(wagmiConfig)
wagmiConnector = getWagmiConnector(label)

Expand Down Expand Up @@ -284,7 +284,10 @@

const chain = await getChainId(provider)

const update: Pick<WalletState, 'accounts' | 'chains' | 'wagmiConnector'> = {
const update: Pick<
WalletState,
'accounts' | 'chains' | 'wagmiConnector'
> = {
accounts: [{ address, ens: null, uns: null, balance: null }],
chains: [{ namespace: 'evm', id: chain }],
wagmiConnector
Expand Down Expand Up @@ -601,8 +604,16 @@
</div>
<div class="mobile-subheader">
{$modalStep$ === 'selectingWallet'
? `${availableWallets} available wallets`
: '1 account selected'}
? availableWallets > 1
? `${availableWallets} ${$_(
'connect.selectingWallet.header'
).toLowerCase()}`
: `1 ${$_(
'connect.connectedWallet.availableWallet'
).toLowerCase()}`
: `1 ${$_(
'connect.connectedWallet.accountSelected'
).toLowerCase()}`}
</div>
</div>
</div>
Expand Down
6 changes: 3 additions & 3 deletions packages/demo/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
"@web3-onboard/bloom": "2.0.0",
"@web3-onboard/capsule": "^2.4.0-alpha.1",
"@web3-onboard/cede-store": "^2.3.1",
"@web3-onboard/core": "2.23.0",
"@web3-onboard/core": "2.23.1-alpha.1",
"@web3-onboard/coinbase": "^2.4.1",
"@web3-onboard/dcent": "^2.2.7",
"@web3-onboard/enkrypt": "^2.1.1",
Expand All @@ -45,7 +45,7 @@
"@web3-onboard/gas": "^2.2.1",
"@web3-onboard/gnosis": "^2.3.1",
"@web3-onboard/infinity-wallet": "^2.1.1",
"@web3-onboard/injected-wallets": "^2.11.2",
"@web3-onboard/injected-wallets": "^2.11.3-alpha.1",
"@web3-onboard/keepkey": "^2.3.8",
"@web3-onboard/keplr": "2.0.0",
"@web3-onboard/keystone": "^2.3.8",
Expand All @@ -67,7 +67,7 @@
"@web3-onboard/uauth": "^2.2.1",
"@web3-onboard/venly": "^2.1.1",
"@web3-onboard/wagmi": "^2.0.1",
"@web3-onboard/walletconnect": "^2.6.1",
"@web3-onboard/walletconnect": "^2.6.2-alpha.1",
"@web3-onboard/web3auth": "^2.4.0",
"@web3-onboard/xdefi": "^2.1.1",
"@web3-onboard/zeal": "^2.1.1",
Expand Down
2 changes: 1 addition & 1 deletion packages/injected/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@web3-onboard/injected-wallets",
"version": "2.11.2",
"version": "2.11.3-alpha.1",
"description": "Injected wallet module for connecting browser extension and mobile wallets to Web3-Onboard. Web3-Onboard makes it simple to connect Ethereum hardware and software wallets to your dapp. Features standardised spec compliant web3 providers for all supported wallets, framework agnostic modern javascript UI with code splitting, CSS customization, multi-chain and multi-account support, reactive wallet state subscriptions and real-time transaction state change notifications.",
"keywords": [
"Ethereum",
Expand Down
2 changes: 1 addition & 1 deletion packages/react/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@
"typescript": "^5.4.5"
},
"dependencies": {
"@web3-onboard/core": "2.23.0",
"@web3-onboard/core": "2.23.1-alpha.1",
"@web3-onboard/common": "^2.4.1",
"use-sync-external-store": "1.0.0"
},
Expand Down
2 changes: 1 addition & 1 deletion packages/solid/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@
},
"dependencies": {
"@web3-onboard/common": "^2.4.1",
"@web3-onboard/core": "2.23.0",
"@web3-onboard/core": "2.23.1-alpha.1",
"solid-js": "^1.8.1"
}
}
2 changes: 1 addition & 1 deletion packages/vue/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@
"@vueuse/core": "^8.4.2",
"@vueuse/rxjs": "^8.2.0",
"@web3-onboard/common": "^2.4.1",
"@web3-onboard/core": "2.23.0",
"@web3-onboard/core": "2.23.1-alpha.1",
"vue-demi": "^0.12.4"
},
"peerDependencies": {
Expand Down
6 changes: 3 additions & 3 deletions packages/walletconnect/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@web3-onboard/walletconnect",
"version": "2.6.1",
"version": "2.6.2-alpha.1",
"description": "WalletConnect SDK module for connecting to Web3-Onboard. Web3-Onboard makes it simple to connect Ethereum hardware and software wallets to your dapp. Features standardised spec compliant web3 providers for all supported wallets, framework agnostic modern javascript UI with code splitting, CSS customization, multi-chain and multi-account support, reactive wallet state subscriptions and real-time transaction state change notifications.",
"keywords": [
"Ethereum",
Expand Down Expand Up @@ -56,10 +56,10 @@
"license": "MIT",
"devDependencies": {
"typescript": "^5.4.5",
"@walletconnect/types": "^2.13.0"
"@walletconnect/types": "^2.17.3"
},
"dependencies": {
"@walletconnect/ethereum-provider": "^2.13.0",
"@walletconnect/ethereum-provider": "^2.17.3",
"@web3-onboard/common": "^2.4.1",
"joi": "17.9.1",
"rxjs": "^7.5.2"
Expand Down
Loading
Loading