Skip to content

Internationalize hardcoded SnackBar messages #414

@coderabbitai

Description

@coderabbitai

Description

Several SnackBar messages in the codebase use hardcoded English strings instead of localized strings from the ARB files. These should be internationalized to support the existing Spanish and Italian translations.

Context

This issue was identified during the review of PR #413 (moving SnackBars to top). While that PR focused on SnackBar positioning, it revealed pre-existing hardcoded text that should be localized.

Files and strings requiring internationalization

lib/features/chat/widgets/encrypted_file_message.dart

Lines 498-509:

  • 'Could not open file: ${result.message}'
  • 'Error opening file: $e'

Suggested keys:

  • couldNotOpenFile with parameter for result.message
  • errorOpeningFile with parameter for error

lib/features/chat/widgets/message_input.dart

Line 131:

  • 'Error uploading file: $e'

Suggested keys:

  • errorUploadingFile with parameter for error
  • Consider logging raw exception to console/logs instead of showing to user

lib/features/disputes/widgets/dispute_input_section.dart

Lines 131, 139:

  • 'Message sent: $message'
  • 'Failed to send message: $error'

Suggested keys:

  • messageSent with parameter for message content
  • failedToSendMessage with parameter for error

lib/features/disputes/widgets/dispute_message_bubble.dart

Line 92:

  • Uses nullable access S.of(context)?.messageCopiedToClipboard with fallback 'Message copied to clipboard'

Action needed:

  • Change to non-nullable: S.of(context)!.messageCopiedToClipboard
  • Remove the ?? 'Message copied to clipboard' fallback

lib/features/order/screens/add_lightning_invoice_screen.dart

Line 84:

  • 'Failed to cancel order: ${e.toString()}'

Suggested keys:

  • failedToCancelOrder with parameter for error message

lib/shared/widgets/clickable_text_widget.dart

Line 39:

  • '${widget.leftText} ${widget.clickableText} copied to clipboard'

Suggested keys:

  • textCopiedToClipboard with parameters for the concatenated text, or
  • A more generic copiedToClipboard message

lib/shared/widgets/exchange_rate_widget.dart

Line 49:

  • 'Refreshing exchange rate...'

Suggested keys:

  • refreshingExchangeRate

Implementation checklist

  • Add new keys to lib/l10n/intl_en.arb with English text
  • Add corresponding translations to lib/l10n/intl_es.arb (Spanish)
  • Add corresponding translations to lib/l10n/intl_it.arb (Italian)
  • Update each file to use S.of(context)!.<key> instead of hardcoded strings
  • For messages with dynamic content (errors, file names), use parameterized localization keys
  • Consider logging technical error details separately from user-facing messages

Notes

Several files in PR #413 already use proper localization (e.g., add_order_screen.dart, trade_detail_screen.dart, message_bubble.dart), so follow those patterns.

Related

cc @Catrya

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions