Skip to content

feat: localization of core/exchange - #1638

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

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

Conversation

@gluneau

@gluneau gluneau commented Dec 8, 2025

Copy link
Copy Markdown
Contributor

Localization: core/exchange

Overview

  • Feature: lib/core/exchange/domain/errors/
  • Strings localized: 12 new ARB keys + toTranslated() methods for 4 error classes
  • Files modified: 7 (4 Dart files + 3 ARB files)
  • Branch: localization/core-exchange

Changes

  • Added toTranslated(BuildContext context) method to all 4 error classes
  • Added ARB keys with existing feature-prefix naming convention
  • Validated with validation scripts
  • Tested with flutter analyze

Implementation Pattern

Following the same toTranslated() method pattern as BitBoxError:

  • Error classes now have a toTranslated(BuildContext context) method
  • UI code can call error.toTranslated(context) for localized display
  • unexpected error types pass through their message directly

Modified Error Classes

  1. BuyError - Added toTranslated() with 7 error types
  2. SellError - Added toTranslated() with 7 error types
  3. PayError - Added toTranslated() with 7 error types
  4. WithdrawError - Added toTranslated() with 6 error types

New ARB Keys (12)

Buy Errors:

  • buyUnauthenticatedError, buyBelowMinAmountError, buyAboveMaxAmountError
  • buyInsufficientFundsError, buyOrderNotFoundError, buyOrderAlreadyConfirmedError

Withdraw Errors:

  • withdrawUnauthenticatedError, withdrawBelowMinAmountError, withdrawAboveMaxAmountError
  • withdrawOrderNotFoundError, withdrawOrderAlreadyConfirmedError

Note: Sell and Pay error keys already existed in ARB files.

Validation Results

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

Testing

  • All localization keys exist in ARB files
  • Changed files pass flutter analyze
  • Follows existing naming conventions (feature-prefix for feature-consumed errors)

@gluneau
gluneau marked this pull request as draft December 8, 2025 17:10
@ethicnology

Copy link
Copy Markdown
Member

#740

- Add toTranslated() method to BuyError, SellError, PayError, WithdrawError
- Add 12 new ARB keys for buy and withdraw error messages
- Update UI screens to use error.toTranslated(context) instead of switch expressions
- Simplify _SellError and _PayError widgets to use centralized error translation
- Remove redundant error type pattern matching in favor of toTranslated()
- Languages: English, French, Spanish
@gluneau
gluneau force-pushed the localization/core-exchange branch from 39521d6 to 66e12e2 Compare December 8, 2025 17:17
@gluneau
gluneau marked this pull request as ready for review December 8, 2025 17:21
@ethicnology
ethicnology self-requested a review December 8, 2025 17:24
@ethicnology ethicnology self-assigned this Dec 8, 2025

@ethicnology ethicnology left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well done, thanks!

@ethicnology
ethicnology merged commit e4e0341 into SatoshiPortal:develop Dec 8, 2025
1 check passed
@gluneau

gluneau commented Dec 8, 2025

Copy link
Copy Markdown
Contributor Author

Yeah, I like it when it removes more lines than it creates

@ethicnology

Copy link
Copy Markdown
Member

@gluneau agreed 🤟

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