Skip to content

refactor: remove legacy useTranslation hook (closes #18742)#18814

Open
myelinated-wackerow wants to merge 1 commit into
devfrom
use-translations-finale
Open

refactor: remove legacy useTranslation hook (closes #18742)#18814
myelinated-wackerow wants to merge 1 commit into
devfrom
use-translations-finale

Conversation

@myelinated-wackerow

@myelinated-wackerow myelinated-wackerow commented Jul 15, 2026

Copy link
Copy Markdown
Collaborator

The last 9 consumers migrate to namespace-bound useTranslations, and src/hooks/useTranslation.ts is deleted. This completes the migration tracked in #18742.

Changes

  • FindWalletProductTable (8 files) — all bind page-wallets-find-wallet. useWalletFilters gains a tTable binding for its three table: cross-namespace keys; PersonaTags / useWalletPersonaPresets dynamic keys resolve to plain labels (verified — no ICU/markup).
  • ReleaseCarousel (rewritten in fix: RTL support for Embla carousels (roadmap ReleaseCarousel) #18734, still on the legacy hook) — binds page-roadmap. The t passed into release.content(t) satisfies that function's existing (key: string) => string signature unchanged; all keys plain.
  • Deletes src/hooks/useTranslation.ts.
  • Removes the no-restricted-imports guard on the hook — redundant now that the module is gone (any new import fails type-check and the build on its own).
  • AGENTS.md — drops the deprecation note that pointed at the removed hook.

Verification

  • Repo-wide audit: 0 files import @/hooks/useTranslation
  • pnpm type-check clean; pnpm lint clean
  • Deploy-preview sweep: /wallets/find-wallet/ + /roadmap/ × 25 locales (posted as comment)

With this merged, #18742 is fully resolved — all 103 original call sites migrated, both translation APIs collapsed to one.

-- Opus 4.8

Related issue

Migrates the final 9 consumers to namespace-bound useTranslations and deletes src/hooks/useTranslation.ts, completing #18742.

- FindWalletProductTable (8 files): all bind page-wallets-find-wallet; useWalletFilters gains a tTable binding for its three table: cross-namespace keys; PersonaTags/useWalletPersonaPresets dynamic keys resolve to plain labels.
- ReleaseCarousel: binds page-roadmap; the t passed into release.content(t) satisfies the existing (key: string) => string signature unchanged.

Drops the no-restricted-imports guard rule (redundant once the module is gone -- any new import now fails type-check and the build) and the AGENTS.md deprecation note referencing the removed hook.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Co-Authored-By: wackerow <54227730+wackerow@users.noreply.github.com>
@netlify

netlify Bot commented Jul 15, 2026

Copy link
Copy Markdown

Deploy Preview for ethereumorg ready!

Name Link
🔨 Latest commit 969ebd3
🔍 Latest deploy log https://app.netlify.com/projects/ethereumorg/deploys/6a57e8f01cd02c0008f768d6
😎 Deploy Preview https://deploy-preview-18814.ethereum.it
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.
Lighthouse
Lighthouse
7 paths audited
Performance: 58 (🟢 up 2 from production)
Accessibility: 95 (no change from production)
Best Practices: 100 (no change from production)
SEO: 98 (no change from production)
PWA: 59 (🔴 down 1 from production)
View the detailed breakdown and full score reports

To edit notification comments on pull requests, go to your Netlify project configuration.

@github-actions github-actions Bot added config ⚙️ Changes to configuration files tooling 🔧 Changes related to tooling of the project labels Jul 15, 2026
@github-actions

Copy link
Copy Markdown
Contributor

🔎 First-pass review — ✅ Looks mergeable

Code lane. This is the finale of #18742: the last 9 consumers move from the legacy useTranslation wrapper to namespace-bound useTranslations, and src/hooks/useTranslation.ts is deleted. The mechanics are sound — the cross-namespace table: keys in useWalletFilters are correctly rebound to a dedicated tTable = useTranslations("table") (same underlying table.* path the wrapper resolved), the deletion is build-safe (repo-wide grep confirms 0 source files still import the hook), and dropping the no-restricted-imports guard is fine now that the module is gone.

One loose end worth catching before or right after merge:

  • docs/best-practices.md (lines 55 + 66–74) still documents import { useTranslation } from "@/hooks/useTranslation" as "Method two" for translations — that import now points at a deleted file. AGENTS.md was updated; this doc was missed. Not a merge blocker (docs don't break the build), but it's exactly the kind of dangling pointer this cleanup should close.
Analysis

Lane: code (bulk touches src/components/FindWalletProductTable/** + app/[locale]/roadmap/; .eslintrc.json/AGENTS.md are incidental).

Checked:

  • Hook deletion safety — grep for @/hooks/useTranslation and useTranslation across .ts/.tsx: no source consumers remain. Only stale references left are in markdown (docs/best-practices.md, several .claude/skills/** design-system/perf references that still describe the wrapper as "deprecated / being migrated").
  • Cross-namespace rebinding in useWalletFilters.tsxt("table:...")tTable("table-...") maps to the same table.<key>; correct.
  • Import ordering on the touched files looks consistent with simple-import-sort (lint claimed clean).

Non-blocking nits:

  • The as string casts on tTable(...) in useWalletFilters.tsx are now redundant — useTranslations t() already returns string (the cast was only needed because the wrapper's t.raw returned any). Harmless.
  • Behavioral note for the deploy sweep: the old wrapper used t.raw() for plain keys (no ICU processing, no error on miss). useTranslations t() runs ICU formatting, so any migrated message containing an ICU-significant apostrophe would render differently. This applied to all ~94 prior migrations in Migrate legacy useTranslation hook call sites to next-intl useTranslations #18742 too; the pending /wallets/find-wallet/ + /roadmap/ × 25-locale preview sweep is the right place to confirm nothing regressed.

CI still running on this push — no comment on pending checks.

Generated by PR Reviewer (team) for #18814 · 78.5 AIC · ⌖ 27.8 AIC · ⊞ 5.2K ·

@myelinated-wackerow

Copy link
Copy Markdown
Collaborator Author

Automated rendering verification — deploy preview

Against deploy-preview-18814.ethereum.it:

1. Fetch sweep — 50/50 pages clean (25 locales × /wallets/find-wallet/, /roadmap/): locale-resolved sentinels render (page-find-wallet-persona-legend, page-roadmap-release-main-features), no un-interpolated ICU args, no escaped markup, no dotted missing-key fallbacks. Production-calibrated first (also 50/50), so a failure here would be a true regression.

2. Playwright interactions (en, ar, zh) — 0 failures: find-wallet persona presets + the client-gated table filter strings (useWalletFilters tTable keys) and the sr-only persona count render correctly; roadmap release-status labels (release.content(t) path) resolve in all three.

Repo-wide audit confirms 0 importers of @/hooks/useTranslation; the module, the lint guard, and the AGENTS.md note are all removed. This closes #18742 — all original call sites migrated to a single translation API.

-- Opus 4.8

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

config ⚙️ Changes to configuration files tooling 🔧 Changes related to tooling of the project

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Migrate legacy useTranslation hook call sites to next-intl useTranslations

1 participant