fix: translate wallet no account error
Some checks failed
Deploy Staging (terry-wallet-login) / deploy (push) Failing after 32s

This commit is contained in:
TerryM
2026-06-04 11:14:52 +08:00
parent 65dee3a37e
commit ae64f96bbe
5 changed files with 49 additions and 4 deletions

View File

@@ -0,0 +1,30 @@
---
title: "Wallet No Account Message — Quick Fix"
type: quick-fix
date: 2026-06-04
---
# Wallet No Account Message — Quick Fix
## Bug
When a wallet provider was detected but returned no account, the wallet login UI displayed the raw internal error key `walletNoAccount`.
## Root Cause
`connectInjectedWallet` throws `Error("walletNoAccount")`, but the modal and toast paths rendered `error.message` directly. The locale dictionaries also did not define a friendly `walletNoAccount` message.
## Fix
Translate wallet error keys before rendering them, and add user-facing English and Simplified Chinese text for `walletNoAccount`.
### Files Modified
- `src/wallet/WalletLoginModal.tsx` — translate wallet error messages before showing modal errors.
- `src/wallet/WalletProvider.tsx` — translate wallet error messages before showing toast errors.
- `src/locales/en.ts` — added English `walletNoAccount` copy.
- `src/locales/zh-CN.ts` — added Simplified Chinese `walletNoAccount` copy.
## Verification
- `npx tsc --noEmit`
- `npm run format:check`
- `npm test`
## Notes
The underlying login behavior is unchanged. This only replaces the raw internal key with a user-friendly explanation to unlock/select a wallet account and retry.