Skip to content

[Bug] VaultPanel tab labels bypass i18n due to variable shadowing #425

Description

@collinsezedike

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

  1. Switch the app's locale to French.
  2. Open the vault panel while a wallet is connected.
  3. 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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Stellar WaveIssues in the Stellar wave programbugSomething isn't workingfrontendInvolves React components, Tailwind styling, or Next.js pagesi18nInternationalization, locale detection, or translation filestrivialSelf-contained task, completable in < 2 hours with no deep protocol knowledge required

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions