diff --git a/lib/features/order/screens/add_order_screen.dart b/lib/features/order/screens/add_order_screen.dart index ed3cf9db5..4c8756530 100644 --- a/lib/features/order/screens/add_order_screen.dart +++ b/lib/features/order/screens/add_order_screen.dart @@ -296,7 +296,11 @@ class _AddOrderScreenState extends ConsumerState { if (_showCustomPaymentMethod && _customPaymentMethodController.text.isNotEmpty) { - paymentMethods.remove("Other"); + // Remove localized "Other" (case-insensitive, trimmed) from the list + final localizedOther = S.of(context)!.other.trim().toLowerCase(); + paymentMethods.removeWhere( + (method) => method.trim().toLowerCase() == localizedOther, + ); String sanitizedPaymentMethod = _customPaymentMethodController.text; diff --git a/lib/features/order/widgets/payment_methods_section.dart b/lib/features/order/widgets/payment_methods_section.dart index 377d90209..712a70f2a 100644 --- a/lib/features/order/widgets/payment_methods_section.dart +++ b/lib/features/order/widgets/payment_methods_section.dart @@ -12,6 +12,20 @@ class PaymentMethodsSection extends ConsumerWidget { final TextEditingController customController; final Function(List, bool) onMethodsChanged; + /// Helper function to translate payment method names + String _translatePaymentMethod(String method, BuildContext context) { + switch (method) { + case 'Bank Transfer': + return S.of(context)!.bankTransfer; + case 'Cash in person': + return S.of(context)!.cashInPerson; + case 'Other': + return S.of(context)!.other; + default: + return method; + } + } + const PaymentMethodsSection({ super.key, required this.selectedMethods, @@ -63,10 +77,13 @@ class PaymentMethodsSection extends ConsumerWidget { List availableMethods = []; if (data.containsKey(selectedFiatCode)) { - availableMethods = List.from(data[selectedFiatCode]); + availableMethods = List.from(data[selectedFiatCode]) + .map((method) => _translatePaymentMethod(method, context)) + .toList(); } else { - availableMethods = List.from(data['default'] ?? - ['Bank Transfer', 'Cash in person', 'Other']); + availableMethods = List.from(data['default'] ?? ['Bank Transfer', 'Cash in person', 'Other']) + .map((method) => _translatePaymentMethod(method, context)) + .toList(); } return InkWell( @@ -110,12 +127,17 @@ class PaymentMethodsSection extends ConsumerWidget { Function(List, bool) onMethodsChanged, TextEditingController customController, ) { - if (!availableMethods.contains('Other')) { - availableMethods = [...availableMethods, 'Other']; + final translatedOther = _translatePaymentMethod('Other', context); + if (!availableMethods.contains(translatedOther)) { + availableMethods = [...availableMethods, translatedOther]; } - List dialogSelectedMethods = List.from(selectedMethods); - bool dialogShowOtherField = dialogSelectedMethods.contains('Other'); + // Normalize to current locale so checkbox states align with localized labels + final localizedSelected = selectedMethods + .map((m) => _translatePaymentMethod(m, context)) + .toList(); + List dialogSelectedMethods = List.from(localizedSelected); + bool dialogShowOtherField = dialogSelectedMethods.contains(translatedOther); showDialog( context: context, @@ -145,12 +167,12 @@ class PaymentMethodsSection extends ConsumerWidget { setDialogState(() { if (selected == true) { dialogSelectedMethods.add(method); - if (method == 'Other') { + if (method == translatedOther) { dialogShowOtherField = true; } } else { dialogSelectedMethods.remove(method); - if (method == 'Other') { + if (method == translatedOther) { dialogShowOtherField = false; } } diff --git a/lib/features/walkthrough/screens/walkthrough_screen.dart b/lib/features/walkthrough/screens/walkthrough_screen.dart index 90b60392c..41360219b 100644 --- a/lib/features/walkthrough/screens/walkthrough_screen.dart +++ b/lib/features/walkthrough/screens/walkthrough_screen.dart @@ -20,6 +20,7 @@ class _WalkthroughScreenState extends ConsumerState { bool isSecurityStep = false, bool isChatStep = false, bool isOrderBookStep = false, + bool isCreateOfferStep = false, }) { const defaultStyle = TextStyle(fontSize: 16, color: Color(0xFF9aa1b6)); const highlightStyle = TextStyle( @@ -39,9 +40,15 @@ class _WalkthroughScreenState extends ConsumerState { ? HighlightConfig.chat : isOrderBookStep ? HighlightConfig.orderBook - : HighlightConfig.firstStep; - - final RegExp highlightRegex = RegExp(config.pattern, caseSensitive: true); + : isCreateOfferStep + ? HighlightConfig.createOffer + : HighlightConfig.firstStep; + + final RegExp highlightRegex = RegExp( + config.pattern, + caseSensitive: false, + unicode: true, + ); int start = 0; for (final match in highlightRegex.allMatches(text)) { @@ -149,7 +156,8 @@ class _WalkthroughScreenState extends ConsumerState { ), PageViewModel( title: S.of(context)!.cantFindWhatYouNeed, - bodyWidget: _buildHighlightedText(S.of(context)!.createYourOwnOffer), + bodyWidget: _buildHighlightedText(S.of(context)!.createYourOwnOffer, + isCreateOfferStep: true), image: buildPageImage("assets/images/wt-6.png"), decoration: pageDecoration, ), diff --git a/lib/features/walkthrough/utils/highlight_config.dart b/lib/features/walkthrough/utils/highlight_config.dart index e50cc7748..a2e0a3bfc 100644 --- a/lib/features/walkthrough/utils/highlight_config.dart +++ b/lib/features/walkthrough/utils/highlight_config.dart @@ -13,7 +13,7 @@ class HighlightConfig { ); static const security = HighlightConfig( - pattern: r'\b(Hold Invoices|Facturas de Retención|Fatture di Blocco)\b', + pattern: r'\b(Hold Invoices|Facturas Retenidas|Fatture di Blocco)\b', ); static const chat = HighlightConfig( @@ -24,4 +24,8 @@ class HighlightConfig { static const orderBook = HighlightConfig( pattern: r'\b(order book|libro de órdenes|libro ordini)\b', ); + + static const createOffer = HighlightConfig( + pattern: r'\b(create your own offer|crear tu propia oferta|creare la tua offerta)\b', + ); } diff --git a/lib/l10n/intl_en.arb b/lib/l10n/intl_en.arb index c43f77c24..0b8be7b0f 100644 --- a/lib/l10n/intl_en.arb +++ b/lib/l10n/intl_en.arb @@ -275,6 +275,8 @@ "buyingBitcoin": "Buying Bitcoin", "sellingBitcoin": "Selling Bitcoin", "bankTransfer": "Bank Transfer", + "cashInPerson": "Cash in person", + "other": "Other", "createdByYou": "Created by you", "takenByYou": "Taken by you", "active": "Active", diff --git a/lib/l10n/intl_es.arb b/lib/l10n/intl_es.arb index f42d88e0f..f69dd0bcd 100644 --- a/lib/l10n/intl_es.arb +++ b/lib/l10n/intl_es.arb @@ -227,6 +227,8 @@ "buyingBitcoin": "Comprando Bitcoin", "sellingBitcoin": "Vendiendo Bitcoin", "bankTransfer": "Transferencia Bancaria", + "cashInPerson": "Efectivo", + "other": "Otro", "createdByYou": "Creado por ti", "takenByYou": "Tomado por ti", "active": "Activo", diff --git a/lib/l10n/intl_it.arb b/lib/l10n/intl_it.arb index c5a5b5482..57a3bc211 100644 --- a/lib/l10n/intl_it.arb +++ b/lib/l10n/intl_it.arb @@ -236,6 +236,8 @@ "buyingBitcoin": "Comprando Bitcoin", "sellingBitcoin": "Vendendo Bitcoin", "bankTransfer": "Bonifico Bancario", + "cashInPerson": "Contanti di persona", + "other": "Altro", "createdByYou": "Creato da te", "takenByYou": "Preso da te", "active": "Attivo",