Skip to content

Commit 76f00c1

Browse files
authored
Enhancement: Pass Wallet to More Translate Functions in Connect Interface (#1659)
1 parent 36a0522 commit 76f00c1

File tree

19 files changed

+70
-17
lines changed

19 files changed

+70
-17
lines changed

assets/custom-connect-1.png

118 KB
Loading

assets/custom-connect-2.png

200 KB
Loading

assets/custom-connect-default.png

124 KB
Loading

docs/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@
5656
"type": "module",
5757
"dependencies": {
5858
"@web3-onboard/coinbase": "^2.2.2-alpha.1",
59-
"@web3-onboard/core": "^2.16.2-alpha.2",
59+
"@web3-onboard/core": "^2.17.0-alpha.2",
6060
"@web3-onboard/dcent": "^2.2.5-alpha.1",
6161
"@web3-onboard/enkrypt": "^2.0.2-alpha.1",
6262
"@web3-onboard/fortmatic": "^2.0.17-alpha.1",
118 KB
Loading
200 KB
Loading
124 KB
Loading

docs/src/routes/docs/[...3]modules/core.md

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,9 @@
33
import notifyCustomImg from '$lib/assets/notify-custom-example.png'
44
import notifyImg from '$lib/assets/notify-example.png'
55
import notifyPreflightImg from '$lib/assets/notify-preflight-example.png'
6+
import customConnect1 from '$lib/assets/custom-connect-1.png'
7+
import customConnect2 from '$lib/assets/custom-connect-2.png'
8+
import customConnectDefault from '$lib/assets/custom-connect-default.png'
69
</script>
710

811
# Core
@@ -252,6 +255,29 @@ type i18nOptions = Record<Locale, i18n>
252255
To see a list of all of the text values that can be internationalized or replaced, check out the [default en file](https://github.com/blocknative/web3-onboard/blob/develop/packages/core/src/i18n/en.json).
253256
Onboard is using the [ICU syntax](https://formatjs.io/docs/core-concepts/icu-syntax/) for formatting under the hood.
254257
258+
For example, to update the connect interface language for Metamask, while giving a different message for other wallets, you can include the following:
259+
260+
```typescript
261+
i18n: {
262+
en: {
263+
connect: {
264+
connectingWallet: {
265+
paragraph: "{wallet, select, MetaMask {{wallet} can only present one account, so connect just the one account you want.} other {Please connect to all of your accounts in {wallet}.}}"
266+
}
267+
}
268+
}
269+
}
270+
```
271+
272+
MetaMask message:
273+
<img src="{customConnect2}" alt="Web3-Onboard connect wallet modal with custom message"/>
274+
275+
All other wallets:
276+
<img src="{customConnect1}" alt="Web3-Onboard connect wallet modal with custom message"/>
277+
278+
Default Message- with no i18n override:
279+
<img src="{customConnectDefault}" alt="Web3-Onboard connect wallet modal with default message"/>
280+
255281
---
256282
257283
#### theme

examples/with-sveltekit/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@
3232
"type": "module",
3333
"dependencies": {
3434
"@fontsource/fira-mono": "^4.5.10",
35-
"@web3-onboard/core": "^2.16.1-alpha.2",
35+
"@web3-onboard/core": "^2.17.0-alpha.2",
3636
"@web3-onboard/injected-wallets": "^2.8.3-alpha.1",
3737
"@web3-onboard/walletconnect": "^2.3.3-alpha.1",
3838
"buffer": "^6.0.3"

examples/with-vanilla-js/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
},
1818
"dependencies": {
1919
"@web3-onboard/coinbase": "^2.2.2",
20-
"@web3-onboard/core": "^2.16.2",
20+
"@web3-onboard/core": "^2.17.0-alpha.2",
2121
"@web3-onboard/injected-wallets": "^2.8.4",
2222
"@web3-onboard/walletconnect": "^2.3.5"
2323
}

0 commit comments

Comments
 (0)