From 73b45479d301558343ed16366361370855630496 Mon Sep 17 00:00:00 2001 From: Catrya <140891948+Catrya@users.noreply.github.com> Date: Tue, 3 Feb 2026 11:01:55 -0600 Subject: [PATCH 1/2] Internationalize hardcoded SnackBar messages --- .../chat/widgets/encrypted_file_message.dart | 4 +- lib/features/chat/widgets/message_input.dart | 2 +- .../widgets/dispute_input_section.dart | 4 +- .../widgets/dispute_message_bubble.dart | 2 +- .../screens/add_lightning_invoice_screen.dart | 2 +- .../notification_settings_screen.dart | 4 +- lib/l10n/intl_en.arb | 37 ++++++++++++++++++ lib/l10n/intl_es.arb | 39 ++++++++++++++++++- lib/l10n/intl_it.arb | 39 ++++++++++++++++++- lib/shared/widgets/clickable_text_widget.dart | 3 +- lib/shared/widgets/exchange_rate_widget.dart | 3 +- 11 files changed, 126 insertions(+), 13 deletions(-) diff --git a/lib/features/chat/widgets/encrypted_file_message.dart b/lib/features/chat/widgets/encrypted_file_message.dart index 91320dc3e..b245ec190 100644 --- a/lib/features/chat/widgets/encrypted_file_message.dart +++ b/lib/features/chat/widgets/encrypted_file_message.dart @@ -497,7 +497,7 @@ class _EncryptedFileMessageState extends ConsumerState { if (result.type != ResultType.done) { SnackBarHelper.showTopSnackBar( context, - 'Could not open file: ${result.message}', + S.of(context)!.couldNotOpenFileWithMessage(result.message), duration: const Duration(seconds: 3), backgroundColor: Colors.orange, ); @@ -507,7 +507,7 @@ class _EncryptedFileMessageState extends ConsumerState { if (mounted) { SnackBarHelper.showTopSnackBar( context, - 'Error opening file: $e', + S.of(context)!.errorOpeningFileWithMessage(e.toString()), backgroundColor: Colors.red, ); } diff --git a/lib/features/chat/widgets/message_input.dart b/lib/features/chat/widgets/message_input.dart index 1de7090a7..f16a94d63 100644 --- a/lib/features/chat/widgets/message_input.dart +++ b/lib/features/chat/widgets/message_input.dart @@ -130,7 +130,7 @@ class _MessageInputState extends ConsumerState { if (mounted) { SnackBarHelper.showTopSnackBar( context, - 'Error uploading file: $e', + S.of(context)!.errorUploadingFile(e.toString()), backgroundColor: Colors.red, ); } diff --git a/lib/features/disputes/widgets/dispute_input_section.dart b/lib/features/disputes/widgets/dispute_input_section.dart index 3f2880e12..a23d36388 100644 --- a/lib/features/disputes/widgets/dispute_input_section.dart +++ b/lib/features/disputes/widgets/dispute_input_section.dart @@ -130,7 +130,7 @@ class _DisputeInputSectionState extends State { if (mounted) { SnackBarHelper.showTopSnackBar( context, - 'Message sent: $message', + S.of(context)!.messageSent(message), backgroundColor: Colors.green, ); } @@ -138,7 +138,7 @@ class _DisputeInputSectionState extends State { if (mounted) { SnackBarHelper.showTopSnackBar( context, - 'Failed to send message: $error', + S.of(context)!.failedSendMessage(error.toString()), backgroundColor: Colors.red, ); } diff --git a/lib/features/disputes/widgets/dispute_message_bubble.dart b/lib/features/disputes/widgets/dispute_message_bubble.dart index c8612fed3..95afdd3bf 100644 --- a/lib/features/disputes/widgets/dispute_message_bubble.dart +++ b/lib/features/disputes/widgets/dispute_message_bubble.dart @@ -91,7 +91,7 @@ class DisputeMessageBubble extends StatelessWidget { Clipboard.setData(ClipboardData(text: text)); SnackBarHelper.showTopSnackBar( context, - S.of(context)?.messageCopiedToClipboard ?? 'Message copied to clipboard', + S.of(context)!.messageCopiedToClipboard, duration: const Duration(seconds: 1), backgroundColor: Colors.green, ); diff --git a/lib/features/order/screens/add_lightning_invoice_screen.dart b/lib/features/order/screens/add_lightning_invoice_screen.dart index 47886db69..644269283 100644 --- a/lib/features/order/screens/add_lightning_invoice_screen.dart +++ b/lib/features/order/screens/add_lightning_invoice_screen.dart @@ -82,7 +82,7 @@ class _AddLightningInvoiceScreenState if (context.mounted) { SnackBarHelper.showTopSnackBar( context, - 'Failed to cancel order: ${e.toString()}', + S.of(context)!.failedToCancelOrder(e.toString()), ); } } diff --git a/lib/features/settings/notification_settings_screen.dart b/lib/features/settings/notification_settings_screen.dart index 25c844b62..6b9e07042 100644 --- a/lib/features/settings/notification_settings_screen.dart +++ b/lib/features/settings/notification_settings_screen.dart @@ -105,7 +105,7 @@ class NotificationSettingsScreen extends ConsumerWidget { .updatePushNotificationsEnabled(value); } : null, - activeColor: AppTheme.activeColor, + activeThumbColor: AppTheme.activeColor, ), ], ), @@ -277,7 +277,7 @@ class NotificationSettingsScreen extends ConsumerWidget { Switch( value: value, onChanged: enabled ? onChanged : null, - activeColor: AppTheme.activeColor, + activeThumbColor: AppTheme.activeColor, ), ], ), diff --git a/lib/l10n/intl_en.arb b/lib/l10n/intl_en.arb index cc856bedf..392c9af8e 100644 --- a/lib/l10n/intl_en.arb +++ b/lib/l10n/intl_en.arb @@ -696,6 +696,13 @@ "copy": "Copy", "share": "Share", "failedToShareInvoice": "Failed to share invoice. Please try copying instead.", + "failedToCancelOrder": "Failed to cancel order: {error}", + "@failedToCancelOrder": { + "placeholders": { + "error": { "type": "String" } + } + }, + "refreshingExchangeRate": "Refreshing exchange rate...", "language": "Language", "systemDefault": "System Default", "english": "English", @@ -832,6 +839,12 @@ "notAvailable": "Not available", "unknownDate": "Unknown date", "messageCopiedToClipboard": "Message copied to clipboard", + "textCopiedToClipboard": "{text} copied to clipboard", + "@textCopiedToClipboard": { + "placeholders": { + "text": { "type": "String" } + } + }, "@_comment_deep_link_errors": "Deep Link Error Messages", "deepLinkInvalidFormat": "Invalid mostro: URL format", @@ -973,6 +986,12 @@ "error": { "type": "String" } } }, + "messageSent": "Message sent: {message}", + "@messageSent": { + "placeholders": { + "message": { "type": "String" } + } + }, "waitingAdminAssignmentInput": "Waiting for admin assignment...", "typeYourMessage": "Type your message...", @@ -1235,7 +1254,25 @@ "imageDecryptionError": "Error decrypting image", "imageNotAvailable": "Image not available", "couldNotOpenFile": "Could not open file", + "couldNotOpenFileWithMessage": "Could not open file: {message}", + "@couldNotOpenFileWithMessage": { + "placeholders": { + "message": { "type": "String" } + } + }, "errorOpeningFile": "Error opening file", + "errorOpeningFileWithMessage": "Error opening file: {error}", + "@errorOpeningFileWithMessage": { + "placeholders": { + "error": { "type": "String" } + } + }, + "errorUploadingFile": "Error uploading file: {error}", + "@errorUploadingFile": { + "placeholders": { + "error": { "type": "String" } + } + }, "@_comment_backup_reminder": "Backup reminder notification", "backupAccountReminder": "You must back up your account", diff --git a/lib/l10n/intl_es.arb b/lib/l10n/intl_es.arb index 1e0b7976d..397e96ccf 100644 --- a/lib/l10n/intl_es.arb +++ b/lib/l10n/intl_es.arb @@ -609,7 +609,14 @@ "copy": "Copiar", "share": "Compartir", "failedToShareInvoice": "Error al compartir factura. Por favor intenta copiarla en su lugar.", - + "failedToCancelOrder": "Error al cancelar orden: {error}", + "@failedToCancelOrder": { + "placeholders": { + "error": { "type": "String" } + } + }, + "refreshingExchangeRate": "Actualizando tasa de cambio...", + "@_comment_trade_detail_screen_new": "Nuevas cadenas de Pantalla de Detalles de Intercambio", "orderDetailsTitle": "DETALLES DE ORDEN", "buyOrderDetailsTitle": "DETALLES DE ORDEN DE COMPRA", @@ -835,6 +842,12 @@ "notAvailable": "No disponible", "unknownDate": "Fecha desconocida", "messageCopiedToClipboard": "Mensaje copiado al portapapeles", + "textCopiedToClipboard": "{text} copiado al portapapeles", + "@textCopiedToClipboard": { + "placeholders": { + "text": { "type": "String" } + } + }, "@_comment_about_screen_new": "About Screen New Strings", @@ -1114,6 +1127,12 @@ "error": { "type": "String" } } }, + "messageSent": "Mensaje enviado: {message}", + "@messageSent": { + "placeholders": { + "message": { "type": "String" } + } + }, "waitingAdminAssignmentInput": "Esperando asignación de administrador...", "typeYourMessage": "Escribe tu mensaje...", @@ -1211,7 +1230,25 @@ "imageDecryptionError": "Error al desencriptar la imagen", "imageNotAvailable": "Imagen no disponible", "couldNotOpenFile": "No se pudo abrir el archivo", + "couldNotOpenFileWithMessage": "No se pudo abrir el archivo: {message}", + "@couldNotOpenFileWithMessage": { + "placeholders": { + "message": { "type": "String" } + } + }, "errorOpeningFile": "Error al abrir archivo", + "errorOpeningFileWithMessage": "Error al abrir archivo: {error}", + "@errorOpeningFileWithMessage": { + "placeholders": { + "error": { "type": "String" } + } + }, + "errorUploadingFile": "Error al subir archivo: {error}", + "@errorUploadingFile": { + "placeholders": { + "error": { "type": "String" } + } + }, "@_comment_backup_reminder": "Recordatorio de respaldo de cuenta", "backupAccountReminder": "Debes respaldar tu cuenta", diff --git a/lib/l10n/intl_it.arb b/lib/l10n/intl_it.arb index b2f4159ac..5c74145ad 100644 --- a/lib/l10n/intl_it.arb +++ b/lib/l10n/intl_it.arb @@ -639,7 +639,14 @@ "copy": "Copia", "share": "Condividi", "failedToShareInvoice": "Errore nel condividere la fattura. Per favore prova a copiarla invece.", - + "failedToCancelOrder": "Impossibile annullare l'ordine: {error}", + "@failedToCancelOrder": { + "placeholders": { + "error": { "type": "String" } + } + }, + "refreshingExchangeRate": "Aggiornamento tasso di cambio...", + "@_comment_trade_detail_screen_new": "Nuove Stringhe Schermata Dettagli Scambio", "orderDetailsTitle": "DETTAGLI ORDINE", "buyOrderDetailsTitle": "DETTAGLI ORDINE DI ACQUISTO", @@ -889,6 +896,12 @@ "notAvailable": "Non disponibile", "unknownDate": "Data sconosciuta", "messageCopiedToClipboard": "Messaggio copiato negli appunti", + "textCopiedToClipboard": "{text} copiato negli appunti", + "@textCopiedToClipboard": { + "placeholders": { + "text": { "type": "String" } + } + }, "@_comment_about_screen_new": "About Screen New Strings", "documentation": "Documentazione", @@ -1170,6 +1183,12 @@ "error": { "type": "String" } } }, + "messageSent": "Messaggio inviato: {message}", + "@messageSent": { + "placeholders": { + "message": { "type": "String" } + } + }, "waitingAdminAssignmentInput": "In attesa dell'assegnazione dell'amministratore...", "typeYourMessage": "Scrivi il tuo messaggio...", @@ -1266,7 +1285,25 @@ "imageDecryptionError": "Errore nella decrittazione dell'immagine", "imageNotAvailable": "Immagine non disponibile", "couldNotOpenFile": "Impossibile aprire il file", + "couldNotOpenFileWithMessage": "Impossibile aprire il file: {message}", + "@couldNotOpenFileWithMessage": { + "placeholders": { + "message": { "type": "String" } + } + }, "errorOpeningFile": "Errore nell'apertura del file", + "errorOpeningFileWithMessage": "Errore nell'apertura del file: {error}", + "@errorOpeningFileWithMessage": { + "placeholders": { + "error": { "type": "String" } + } + }, + "errorUploadingFile": "Errore nel caricamento del file: {error}", + "@errorUploadingFile": { + "placeholders": { + "error": { "type": "String" } + } + }, "@_comment_backup_reminder": "Promemoria backup account", "backupAccountReminder": "Devi fare il backup del tuo account", diff --git a/lib/shared/widgets/clickable_text_widget.dart b/lib/shared/widgets/clickable_text_widget.dart index 67cfdf94a..8a7946618 100644 --- a/lib/shared/widgets/clickable_text_widget.dart +++ b/lib/shared/widgets/clickable_text_widget.dart @@ -2,6 +2,7 @@ import 'package:flutter/gestures.dart'; import 'package:flutter/material.dart'; import 'package:flutter/services.dart'; import 'package:mostro_mobile/core/app_theme.dart'; +import 'package:mostro_mobile/generated/l10n.dart'; import 'package:mostro_mobile/shared/utils/snack_bar_helper.dart'; class ClickableText extends StatefulWidget { @@ -38,7 +39,7 @@ class _ClickableTextState extends State { void _handleTap() async { SnackBarHelper.showTopSnackBar( context, - '${widget.leftText} ${widget.clickableText} copied to clipboard', + S.of(context)!.textCopiedToClipboard(widget.clickableText), duration: const Duration(seconds: 2), ); await Clipboard.setData(ClipboardData(text: widget.clickableText)); diff --git a/lib/shared/widgets/exchange_rate_widget.dart b/lib/shared/widgets/exchange_rate_widget.dart index 128a074c8..3e22c6b5b 100644 --- a/lib/shared/widgets/exchange_rate_widget.dart +++ b/lib/shared/widgets/exchange_rate_widget.dart @@ -2,6 +2,7 @@ import 'package:flutter/material.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart'; import 'package:intl/intl.dart'; import 'package:mostro_mobile/core/app_theme.dart'; +import 'package:mostro_mobile/generated/l10n.dart'; import 'package:mostro_mobile/shared/providers/exchange_service_provider.dart'; import 'package:mostro_mobile/shared/utils/snack_bar_helper.dart'; @@ -48,7 +49,7 @@ class ExchangeRateWidget extends ConsumerWidget { // Trigger refresh for this specific currency SnackBarHelper.showTopSnackBar( context, - 'Refreshing exchange rate...', + S.of(context)!.refreshingExchangeRate, duration: const Duration(seconds: 1), ); ref From 9b3da3ce1cc16e6a13e81d58efcca6406cc95f76 Mon Sep 17 00:00:00 2001 From: Catrya <140891948+Catrya@users.noreply.github.com> Date: Tue, 3 Feb 2026 11:09:41 -0600 Subject: [PATCH 2/2] fix test --- lib/features/settings/notification_settings_screen.dart | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/features/settings/notification_settings_screen.dart b/lib/features/settings/notification_settings_screen.dart index 6b9e07042..25c844b62 100644 --- a/lib/features/settings/notification_settings_screen.dart +++ b/lib/features/settings/notification_settings_screen.dart @@ -105,7 +105,7 @@ class NotificationSettingsScreen extends ConsumerWidget { .updatePushNotificationsEnabled(value); } : null, - activeThumbColor: AppTheme.activeColor, + activeColor: AppTheme.activeColor, ), ], ), @@ -277,7 +277,7 @@ class NotificationSettingsScreen extends ConsumerWidget { Switch( value: value, onChanged: enabled ? onChanged : null, - activeThumbColor: AppTheme.activeColor, + activeColor: AppTheme.activeColor, ), ], ),