Skip to content

Commit 7b54d8a

Browse files
authored
FIX/UPDATE - i18n wallets connected string handling, formatting and version bumps (#2326)
* Update i18n string usage for connected wallets * Add new def to the zh translation file * Add docs info for chinese translation * Merge in changes and bump version * Bump versions for release * Refine types * Format * Revert demo changes for testing * Bump Wallet connect deps
1 parent 9db4d8e commit 7b54d8a

File tree

15 files changed

+620
-62
lines changed

15 files changed

+620
-62
lines changed

docs/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@
5757
"@web3-onboard/capsule": "^2.4.0-alpha.1",
5858
"@web3-onboard/cede-store": "^2.3.1",
5959
"@web3-onboard/coinbase": "^2.3.1",
60-
"@web3-onboard/core": "^2.23.0",
60+
"@web3-onboard/core": "^2.23.1-alpha.1",
6161
"@web3-onboard/dcent": "^2.2.8",
6262
"@web3-onboard/enkrypt": "^2.1.1",
6363
"@web3-onboard/finoaconnect": "^2.0.0",

docs/src/routes/docs/[...3]modules/[...1]core/+page.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -317,9 +317,12 @@ type ConnectModalOptions = {
317317
#### i18n
318318
319319
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.
320+
Currently there is built-in support for:
321+
- English (`en`) - Default
322+
- Simplified Chinese (`zh`)
320323
321324
```typescript
322-
type Locale = string // eg 'en', 'es'
325+
type Locale = string // eg 'en', 'zh', 'es'
323326
type i18nOptions = Record<Locale, i18n>
324327
```
325328

packages/core/README.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -296,9 +296,12 @@ type disableFontDownload = boolean // defaults to false
296296
297297
**`i18n`**
298298
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.
299+
Currently there is built-in support for:
300+
- English (`en`) - Default
301+
- Simplified Chinese (`zh`)
299302
300303
```typescript
301-
type Locale = string // eg 'en', 'es'
304+
type Locale = string // eg 'en', 'zh', 'es'
302305
type i18nOptions = Record<Locale, i18n>
303306
```
304307

packages/core/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@web3-onboard/core",
3-
"version": "2.23.0",
3+
"version": "2.23.1-alpha.1",
44
"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.",
55
"keywords": [
66
"Ethereum",
@@ -96,7 +96,7 @@
9696
"nanoid": "^4.0.0",
9797
"rxjs": "^7.5.5",
9898
"svelte": "^3.49.0",
99-
"svelte-i18n": "^3.3.13",
99+
"svelte-i18n": "^4.0.1",
100100
"viem": "2.12.0"
101101
},
102102
"engines": {

packages/core/src/i18n/en.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,9 @@
3939
"subheading": "Connection Successful!",
4040
"paragraph": "Your wallet is now connected to {app}"
4141
},
42-
"mainText": "Connected"
42+
"mainText": "Connected",
43+
"accountSelected": "Account Selected",
44+
"availableWallet": "available wallet"
4345
}
4446
},
4547
"modals": {

packages/core/src/i18n/zh.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,9 @@
3939
"subheading": "连接成功!",
4040
"paragraph": "您的钱包现已连接到{app}"
4141
},
42-
"mainText": "已连接"
42+
"mainText": "已连接",
43+
"accountSelected": "已选择账户",
44+
"availableWallet": "可用钱包"
4345
}
4446
},
4547
"modals": {

packages/core/src/provider.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { fromEventPattern, Observable } from 'rxjs'
1+
import { fromEventPattern, type Observable } from 'rxjs'
22
import { filter, takeUntil, take, share, switchMap } from 'rxjs/operators'
33
import partition from 'lodash.partition'
44
import { isAddress, weiHexToEth } from '@web3-onboard/common'

packages/core/src/views/connect/Index.svelte

Lines changed: 20 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,5 @@
11
<script lang="ts">
2-
import {
3-
ProviderRpcErrorCode,
4-
type WalletModule
5-
} from '@web3-onboard/common'
2+
import { ProviderRpcErrorCode, type WalletModule } from '@web3-onboard/common'
63
import EventEmitter from 'eventemitter3'
74
import { _ } from 'svelte-i18n'
85
import en from '../../i18n/en.json'
@@ -210,11 +207,14 @@
210207
try {
211208
let address
212209
let wagmiConnector: Connector | undefined
213-
210+
214211
if (wagmi) {
215212
const { buildWagmiConfig, wagmiConnect, getWagmiConnector } = wagmi
216213
217-
const wagmiConfig: Config = await buildWagmiConfig(chains, { label, provider })
214+
const wagmiConfig: Config = await buildWagmiConfig(chains, {
215+
label,
216+
provider
217+
})
218218
updateWagmiConfig(wagmiConfig)
219219
wagmiConnector = getWagmiConnector(label)
220220
@@ -284,7 +284,10 @@
284284
285285
const chain = await getChainId(provider)
286286
287-
const update: Pick<WalletState, 'accounts' | 'chains' | 'wagmiConnector'> = {
287+
const update: Pick<
288+
WalletState,
289+
'accounts' | 'chains' | 'wagmiConnector'
290+
> = {
288291
accounts: [{ address, ens: null, uns: null, balance: null }],
289292
chains: [{ namespace: 'evm', id: chain }],
290293
wagmiConnector
@@ -601,8 +604,16 @@
601604
</div>
602605
<div class="mobile-subheader">
603606
{$modalStep$ === 'selectingWallet'
604-
? `${availableWallets} available wallets`
605-
: '1 account selected'}
607+
? availableWallets > 1
608+
? `${availableWallets} ${$_(
609+
'connect.selectingWallet.header'
610+
).toLowerCase()}`
611+
: `1 ${$_(
612+
'connect.connectedWallet.availableWallet'
613+
).toLowerCase()}`
614+
: `1 ${$_(
615+
'connect.connectedWallet.accountSelected'
616+
).toLowerCase()}`}
606617
</div>
607618
</div>
608619
</div>

packages/demo/package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434
"@web3-onboard/bloom": "2.0.0",
3535
"@web3-onboard/capsule": "^2.4.0-alpha.1",
3636
"@web3-onboard/cede-store": "^2.3.1",
37-
"@web3-onboard/core": "2.23.0",
37+
"@web3-onboard/core": "2.23.1-alpha.1",
3838
"@web3-onboard/coinbase": "^2.4.1",
3939
"@web3-onboard/dcent": "^2.2.7",
4040
"@web3-onboard/enkrypt": "^2.1.1",
@@ -45,7 +45,7 @@
4545
"@web3-onboard/gas": "^2.2.1",
4646
"@web3-onboard/gnosis": "^2.3.1",
4747
"@web3-onboard/infinity-wallet": "^2.1.1",
48-
"@web3-onboard/injected-wallets": "^2.11.2",
48+
"@web3-onboard/injected-wallets": "^2.11.3-alpha.1",
4949
"@web3-onboard/keepkey": "^2.3.8",
5050
"@web3-onboard/keplr": "2.0.0",
5151
"@web3-onboard/keystone": "^2.3.8",
@@ -67,7 +67,7 @@
6767
"@web3-onboard/uauth": "^2.2.1",
6868
"@web3-onboard/venly": "^2.1.1",
6969
"@web3-onboard/wagmi": "^2.0.1",
70-
"@web3-onboard/walletconnect": "^2.6.1",
70+
"@web3-onboard/walletconnect": "^2.6.2-alpha.1",
7171
"@web3-onboard/web3auth": "^2.4.0",
7272
"@web3-onboard/xdefi": "^2.1.1",
7373
"@web3-onboard/zeal": "^2.1.1",

packages/injected/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@web3-onboard/injected-wallets",
3-
"version": "2.11.2",
3+
"version": "2.11.3-alpha.1",
44
"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.",
55
"keywords": [
66
"Ethereum",

0 commit comments

Comments
 (0)