Skip to content

feat(i18n): add TypeScript type safety for translations - #116

Merged
Gaubee merged 2 commits into
mainfrom
feat/i18n-type-safety
Dec 25, 2025
Merged

Gaubee merged 2 commits into
mainfrom
feat/i18n-type-safety

Conversation

@Gaubee

@Gaubee Gaubee commented Dec 25, 2025

Copy link
Copy Markdown
Contributor

Summary

Add compile-time detection of non-existent translation keys using i18next TypeScript integration.

Changes

  • Add src/i18n/i18next.d.ts type declaration file that imports all namespace JSON types
  • Fix all translation key usages across 30+ files to be type-safe
  • Add missing translation keys detected by type checking:
    • security.password, security.walletLock.verifyTitle, security.passwordConfirm.verifying
    • security.twoStepSecret.confirmTitle
    • common.verifying, common.confirm
    • authorize.passwordConfirm.title
  • Refactor dynamic key patterns (e.g., labelKey) to use useMemo with direct t() calls
  • Ensure proper namespace declarations in useTranslation hooks

Benefits

  • Compile-time safety: TypeScript will now catch typos in translation keys
  • IDE autocomplete: Get suggestions for valid translation keys
  • Refactoring support: Renaming keys will show errors in all usages

Testing

  • All 1421 tests pass
  • TypeScript check passes with 0 errors

- Add src/i18n/i18next.d.ts type declaration file
- Fix all translation key usages to be type-safe
- Add missing translation keys detected by type checking
- Refactor dynamic key patterns to use useMemo with direct t() calls
- Ensure proper namespace declarations in useTranslation hooks

This enables compile-time detection of non-existent translation keys.
@Gaubee
Gaubee merged commit a37375f into main Dec 25, 2025
5 checks passed
@Gaubee
Gaubee deleted the feat/i18n-type-safety branch January 4, 2026 07:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant