Description
VaultPanel's tab switcher renders "Deposit"/"Withdraw" in English only, regardless of the active locale, because of a variable-shadowing bug: t is destructured from useTranslation() for the whole component, then re-bound as the loop variable in (["deposit", "withdraw"] as Tab[]).map((t) => ...). Inside that map, t.charAt(0).toUpperCase() + t.slice(1) capitalizes the raw tab id string instead of calling the translation function, since t no longer refers to the translator at that point.
Steps to Reproduce
- Switch the app's locale to French.
- Open the vault panel while a wallet is connected.
- Look at the tab switcher above the deposit/withdraw form.
Expected Behavior
Tab labels should read the French translations (the rest of the component consistently uses t("vaultPanel.xxx") for every other label).
Actual Behavior
Tab labels always show the raw capitalized English strings "Deposit"/"Withdraw", never translated, in any locale.
Environment
| Field |
Value |
| Network |
N/A |
| Wallet |
N/A |
| Protocol affected |
Frontend |
| Browser (if frontend) |
Any |
| Node.js version |
N/A |
| pnpm version |
N/A |
Transaction Details (if on-chain)
N/A, frontend-only bug.
Logs / Screenshots
N/A, visually confirmed by reading apps/web/src/components/dashboard/VaultPanel.tsx (the tab switcher block, around where useTranslation()'s t is shadowed by the .map((t) => ...) parameter over ["deposit", "withdraw"]).
Possible Cause / Fix
Rename the map callback's parameter (e.g. tabId) so it stops shadowing the translator, and call t("vaultPanel.deposit")/t("vaultPanel.withdraw") instead of capitalizing the raw id. Check apps/web/messages/en.json/fr.json for whether matching keys already exist under vaultPanel.* before adding new ones.
Description
VaultPanel's tab switcher renders "Deposit"/"Withdraw" in English only, regardless of the active locale, because of a variable-shadowing bug:tis destructured fromuseTranslation()for the whole component, then re-bound as the loop variable in(["deposit", "withdraw"] as Tab[]).map((t) => ...). Inside that map,t.charAt(0).toUpperCase() + t.slice(1)capitalizes the raw tab id string instead of calling the translation function, sincetno longer refers to the translator at that point.Steps to Reproduce
Expected Behavior
Tab labels should read the French translations (the rest of the component consistently uses
t("vaultPanel.xxx")for every other label).Actual Behavior
Tab labels always show the raw capitalized English strings "Deposit"/"Withdraw", never translated, in any locale.
Environment
Transaction Details (if on-chain)
N/A, frontend-only bug.
Logs / Screenshots
N/A, visually confirmed by reading
apps/web/src/components/dashboard/VaultPanel.tsx(the tab switcher block, around whereuseTranslation()'stis shadowed by the.map((t) => ...)parameter over["deposit", "withdraw"]).Possible Cause / Fix
Rename the map callback's parameter (e.g.
tabId) so it stops shadowing the translator, and callt("vaultPanel.deposit")/t("vaultPanel.withdraw")instead of capitalizing the raw id. Checkapps/web/messages/en.json/fr.jsonfor whether matching keys already exist undervaultPanel.*before adding new ones.