Skip to content

feat: localization of core/bitbox - #1631

Merged
ethicnology merged 1 commit into
SatoshiPortal:developfrom
gluneau:localization/core-bitbox
Dec 5, 2025
Merged

feat: localization of core/bitbox#1631
ethicnology merged 1 commit into
SatoshiPortal:developfrom
gluneau:localization/core-bitbox

Conversation

@gluneau

@gluneau gluneau commented Dec 5, 2025

Copy link
Copy Markdown
Contributor

Localization: core/bitbox

Overview

  • Feature: lib/core/bitbox and lib/features/bitbox
  • Strings localized: 68
  • Files modified: 8 (5 Dart files + 3 ARB files)
  • Branch: localization/core-bitbox

Changes

  • Added BuildContextX import to affected files
  • Replaced hardcoded strings with context.loc calls
  • Added ARB keys with proper naming convention
  • Validated with validation scripts
  • Tested with flutter analyze

Implementation Pattern

This follows the toTranslated() method pattern (like RecoverBullError):

  • BitBoxError stores error object in state (not String)
  • UI calls error.toTranslated(context) for localized display
  • Logging uses $e (toString of error)
  • Pattern matching replaces string comparison for error type checks

Localized Strings

Error Messages (14 keys):

  • bitboxErrorPermissionDenied, bitboxErrorNoDevicesFound, bitboxErrorMultipleDevicesFound
  • bitboxErrorDeviceNotFound, bitboxErrorConnectionTypeNotInitialized, bitboxErrorNoActiveConnection
  • bitboxErrorDeviceMismatch, bitboxErrorInvalidMagicBytes, bitboxErrorDeviceNotPaired
  • bitboxErrorHandshakeFailed, bitboxErrorOperationTimeout, bitboxErrorConnectionFailed
  • bitboxErrorInvalidResponse, bitboxErrorOperationCancelled

BitBox Actions (30 keys):

  • Titles, buttons, processing texts, success messages, and subtexts for:
    • Unlock Device, Pair Device, Import Wallet, Sign Transaction, Verify Address

Screen UI (24 keys):

  • Status messages (connect, scanning, connecting, pairing, password, verify, error)
  • Button labels (Try Again, Manage Permissions, Need Help)
  • Script type selection (Segwit BIP84, Nested Segwit BIP49)
  • Troubleshooting instructions (3 steps)

Code Changes

  1. bitbox_errors.dart: Added toTranslated(BuildContext context) method
  2. bitbox_action.dart: Converted getters to methods (titletoTitle(context))
  3. bitbox_operation_state.dart: Changed String? errorMessage to BitBoxError? error
  4. bitbox_operation_cubit.dart: Store error objects instead of strings
  5. bitbox_action_screen.dart: Use context.loc.* and pattern matching for errors

Validation Results

✅ validate_localizations.py - All 2658 keys synchronized
✅ flutter analyze --fatal-warnings --fatal-infos - No issues found

Testing

  • All localization keys exist in ARB files
  • No hardcoded strings remain
  • Changed files pass flutter analyze
  • Follows naming conventions

Add localization for BitBox hardware wallet integration:
- Convert BitBoxAction getters to methods with BuildContext parameter
- Localize all BitBoxError messages with toTranslated pattern
- Update bitbox_action_screen.dart with localized UI strings
- Add 68 new ARB keys for screen status, buttons, and error messages
@ethicnology ethicnology self-assigned this Dec 5, 2025
@ethicnology
ethicnology merged commit 5c2aefd into SatoshiPortal:develop Dec 5, 2025
1 check passed
@ethicnology

Copy link
Copy Markdown
Member

#740

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.

2 participants