From 9e201bf12ef31014a95ec4ac49301cb5e968a7c2 Mon Sep 17 00:00:00 2001 From: Mark M2 Macbook Date: Sun, 22 Nov 2026 16:08:17 +0100 Subject: [PATCH] prod --- app/android/app/build.gradle.kts | 4 - app/l10n.yaml | 4 + app/lib/core/constants/app_constants.dart | 3 +- app/lib/core/l10n/l10n_extensions.dart | 26 + app/lib/core/services/ad_service.dart | 17 +- .../core/services/subscription_service.dart | 117 +- .../presentation/screens/connect_screen.dart | 108 +- .../widgets/connection_status_chip.dart | 8 +- .../widgets/qr_pairing_modal.dart | 17 +- .../widgets/server_selection_sheet.dart | 77 +- .../cubit/monetization_cubit.dart | 30 +- .../presentation/widgets/paywall_sheet.dart | 647 ++++++++ .../widgets/reward_session_dialog.dart | 60 +- .../presentation/screens/history_screen.dart | 35 +- .../presentation/screens/scanner_screen.dart | 27 +- .../widgets/ar_frozen_picker.dart | 18 +- .../presentation/widgets/last_scan_card.dart | 19 +- .../widgets/manual_input_dialog.dart | 31 +- .../widgets/scanner_controls_bar.dart | 25 +- .../presentation/widgets/scanner_overlay.dart | 10 +- .../settings_local_datasource.dart | 6 + .../settings_repository_impl.dart | 5 + .../domain/entities/app_settings.dart | 9 + .../repositories/settings_repository.dart | 1 + .../presentation/cubit/settings_cubit.dart | 6 + .../presentation/screens/settings_screen.dart | 243 +-- app/lib/l10n/app_en.arb | 314 ++++ app/lib/l10n/app_it.arb | 202 +++ app/lib/l10n/generated/app_localizations.dart | 1328 +++++++++++++++++ .../l10n/generated/app_localizations_en.dart | 705 +++++++++ .../l10n/generated/app_localizations_it.dart | 713 +++++++++ app/lib/main.dart | 32 +- app/pubspec.lock | 21 +- app/pubspec.yaml | 7 +- app/test/widget_test.dart | 12 + server/config.py | 1 + server/gui.py | 211 +-- server/i18n.py | 253 ++++ server/tests/test_server_app.py | 9 +- server/tray.py | 25 +- 40 files changed, 4896 insertions(+), 490 deletions(-) create mode 100644 app/l10n.yaml create mode 100644 app/lib/core/l10n/l10n_extensions.dart create mode 100644 app/lib/features/monetization/presentation/widgets/paywall_sheet.dart create mode 100644 app/lib/l10n/app_en.arb create mode 100644 app/lib/l10n/app_it.arb create mode 100644 app/lib/l10n/generated/app_localizations.dart create mode 100644 app/lib/l10n/generated/app_localizations_en.dart create mode 100644 app/lib/l10n/generated/app_localizations_it.dart create mode 100644 server/i18n.py diff --git a/app/android/app/build.gradle.kts b/app/android/app/build.gradle.kts index b334ca4..175175c 100644 --- a/app/android/app/build.gradle.kts +++ b/app/android/app/build.gradle.kts @@ -69,10 +69,6 @@ kotlin { } } -tasks.matching { it.name.contains("AarMetadata") }.configureEach { - enabled = false -} - flutter { source = "../.." } diff --git a/app/l10n.yaml b/app/l10n.yaml new file mode 100644 index 0000000..75b21aa --- /dev/null +++ b/app/l10n.yaml @@ -0,0 +1,4 @@ +arb-dir: lib/l10n +template-arb-file: app_en.arb +output-localization-file: app_localizations.dart +output-dir: lib/l10n/generated diff --git a/app/lib/core/constants/app_constants.dart b/app/lib/core/constants/app_constants.dart index 7c1690f..e55a167 100644 --- a/app/lib/core/constants/app_constants.dart +++ b/app/lib/core/constants/app_constants.dart @@ -2,7 +2,7 @@ class AppConstants { AppConstants._(); static const String appName = 'Catelli Barcode Reader'; - static const String appVersion = '1.0.0'; + static const String appVersion = '1.1.0'; static const String organization = 'Catelli Srl'; // Network defaults @@ -24,6 +24,7 @@ class AppConstants { static const String keyVibrate = 'vibrate_enabled'; static const String keySound = 'sound_enabled'; static const String keyAimMode = 'scan_aim_mode'; + static const String keyLanguageCode = 'app_language_code'; static const String keyHistory = 'scan_history'; // Suffix options diff --git a/app/lib/core/l10n/l10n_extensions.dart b/app/lib/core/l10n/l10n_extensions.dart new file mode 100644 index 0000000..d371f4e --- /dev/null +++ b/app/lib/core/l10n/l10n_extensions.dart @@ -0,0 +1,26 @@ +import 'package:flutter/widgets.dart'; + +import '../../features/scanner/domain/entities/scan_aim_mode.dart'; +import '../../l10n/generated/app_localizations.dart'; + +export '../../l10n/generated/app_localizations.dart'; + +extension AppLocalizationsX on BuildContext { + /// Returns the active [AppLocalizations], falling back to Italian if a widget + /// is pumped in an isolated test harness without localization delegates. + AppLocalizations get l10n => + AppLocalizations.of(this) ?? lookupAppLocalizations(const Locale('it')); +} + +extension ScanAimModeL10n on ScanAimMode { + String localizedLabel(AppLocalizations l10n) { + switch (this) { + case ScanAimMode.standard: + return l10n.aimModeStandard; + case ScanAimMode.precision: + return l10n.aimModePrecision; + case ScanAimMode.arMulti: + return l10n.aimModeArMulti; + } + } +} diff --git a/app/lib/core/services/ad_service.dart b/app/lib/core/services/ad_service.dart index 4e4ae05..4afb4d4 100644 --- a/app/lib/core/services/ad_service.dart +++ b/app/lib/core/services/ad_service.dart @@ -15,10 +15,8 @@ class AdService { static const String androidTestRewardedAdUnitId = 'ca-app-pub-3940256099942544/5224354917'; - // Set to true only when publishing the final public release to production. - // Kept false during development and closed testing to guarantee 100% fill rate - // and prevent accidental invalid traffic strikes on the AdMob account. - static const bool useProductionAds = false; + // Production Rewarded Ads enabled for release builds (debug builds still use test ads). + static const bool useProductionAds = true; RewardedAd? _rewardedAd; bool _isLoading = false; @@ -90,15 +88,8 @@ class AdService { _isLoading = true; try { - // 1. Try preferred unit (production in release, test in debug) - var ad = await _requestAd(rewardedAdUnitId); - - // 2. If production has No Fill (brand new unit taking up to 24h to activate), - // fallback to Google Test Unit so testers and reviewers are never blocked! - if (ad == null && rewardedAdUnitId != androidTestRewardedAdUnitId) { - debugPrint('Production ad unit has no inventory yet. Falling back to test unit...'); - ad = await _requestAd(androidTestRewardedAdUnitId); - } + // Request preferred unit (production in release, official test unit in debug). + final ad = await _requestAd(rewardedAdUnitId); _rewardedAd = ad; _isLoading = false; diff --git a/app/lib/core/services/subscription_service.dart b/app/lib/core/services/subscription_service.dart index 818e004..70a057b 100644 --- a/app/lib/core/services/subscription_service.dart +++ b/app/lib/core/services/subscription_service.dart @@ -2,20 +2,26 @@ import 'dart:async'; import 'dart:io' show Platform; import 'package:flutter/foundation.dart'; +import 'package:flutter/services.dart'; import 'package:purchases_flutter/purchases_flutter.dart'; -import 'package:purchases_ui_flutter/purchases_ui_flutter.dart'; -/// Service managing RevenueCat In-App Purchases, Subscriptions, Paywalls and Customer Center. +enum PurchaseOutcome { + purchased, + cancelled, + error, +} + +/// Service managing RevenueCat In-App Purchases and Subscriptions. class SubscriptionService { SubscriptionService(); - // RevenueCat Google / Android API Key - static const String apiKey = 'test_WfBStIXoLdiBaGJjDFgiLQSPjnl'; + // RevenueCat Google Play Production API Key + static const String apiKey = 'goog_DwjzlZrJpLkGrgGjZttqXUmPBdM'; // Entitlement ID granting unlimited scanning static const String entitlementId = 'barcode_reader_pc_unlimited'; - // Product IDs configured in RevenueCat + // Product / Package identifiers configured in RevenueCat static const String productLifetime = 'lifetime'; static const String productYearly = 'yearly'; static const String productMonthly = 'monthly'; @@ -72,7 +78,7 @@ class SubscriptionService { return entitlement != null && entitlement.isActive; } - /// Fetches available offerings and subscription packages from RevenueCat. + /// Fetches available offerings from RevenueCat. Future getOfferings() async { if (_isFlutterTest || kIsWeb || !_isConfigured) return null; try { @@ -83,6 +89,56 @@ class SubscriptionService { } } + /// Returns the current offering's available packages ordered as: + /// Yearly -> Lifetime -> Monthly -> any other package. + Future> getAvailablePackages() async { + final offerings = await getOfferings(); + final packages = List.from( + offerings?.current?.availablePackages ?? const [], + ); + + int rank(Package pkg) { + final id = pkg.identifier.toLowerCase(); + if (pkg.packageType == PackageType.annual || id.contains('year') || id.contains('annual')) { + return 0; + } + if (pkg.packageType == PackageType.lifetime || id.contains('life')) { + return 1; + } + if (pkg.packageType == PackageType.monthly || id.contains('month')) { + return 2; + } + return 3; + } + + packages.sort((a, b) => rank(a).compareTo(rank(b))); + return packages; + } + + /// Purchases a specific RevenueCat [Package]. + Future purchasePackage(Package package) async { + if (_isFlutterTest || kIsWeb || !_isConfigured) { + return PurchaseOutcome.error; + } + try { + final result = await Purchases.purchase(PurchaseParams.package(package)); + _customerInfoController.add(result.customerInfo); + return isCustomerEntitled(result.customerInfo) + ? PurchaseOutcome.purchased + : PurchaseOutcome.error; + } on PlatformException catch (e) { + final errorCode = PurchasesErrorHelper.getErrorCode(e); + if (errorCode == PurchasesErrorCode.purchaseCancelledError) { + return PurchaseOutcome.cancelled; + } + debugPrint('Purchase error ($errorCode): $e'); + return PurchaseOutcome.error; + } catch (e) { + debugPrint('Unexpected purchase error: $e'); + return PurchaseOutcome.error; + } + } + /// Restores existing purchases (e.g. after reinstalling the app or switching devices). Future restorePurchases() async { if (_isFlutterTest || kIsWeb || !_isConfigured) return null; @@ -96,56 +152,7 @@ class SubscriptionService { } } - /// Presents the official RevenueCat Paywall UI. - Future presentPaywall({Offering? offering}) async { - if (_isFlutterTest || kIsWeb || !_isConfigured) { - return PaywallResult.notPresented; - } - try { - final result = await RevenueCatUI.presentPaywall(offering: offering); - if (result == PaywallResult.purchased || result == PaywallResult.restored) { - final info = await Purchases.getCustomerInfo(); - _customerInfoController.add(info); - } - return result; - } catch (e) { - debugPrint('Error presenting Paywall: $e'); - return PaywallResult.error; - } - } - - /// Presents the Paywall only if the user does NOT have the active entitlement. - Future presentPaywallIfNeeded() async { - if (_isFlutterTest || kIsWeb || !_isConfigured) { - return PaywallResult.notPresented; - } - try { - final result = await RevenueCatUI.presentPaywallIfNeeded(entitlementId); - if (result == PaywallResult.purchased || result == PaywallResult.restored) { - final info = await Purchases.getCustomerInfo(); - _customerInfoController.add(info); - } - return result; - } catch (e) { - debugPrint('Error presenting Paywall if needed: $e'); - return PaywallResult.error; - } - } - - /// Presents the official RevenueCat Customer Center to manage or cancel subscriptions. - Future presentCustomerCenter() async { - if (_isFlutterTest || kIsWeb || !_isConfigured) return; - try { - await RevenueCatUI.presentCustomerCenter(); - final info = await Purchases.getCustomerInfo(); - _customerInfoController.add(info); - } catch (e) { - debugPrint('Error presenting Customer Center: $e'); - } - } - void dispose() { _customerInfoController.close(); } } - diff --git a/app/lib/features/connection/presentation/screens/connect_screen.dart b/app/lib/features/connection/presentation/screens/connect_screen.dart index 0c0f66a..cea10da 100644 --- a/app/lib/features/connection/presentation/screens/connect_screen.dart +++ b/app/lib/features/connection/presentation/screens/connect_screen.dart @@ -1,5 +1,6 @@ import 'package:flutter/material.dart'; import 'package:flutter_bloc/flutter_bloc.dart'; +import '../../../../core/l10n/l10n_extensions.dart'; import '../../../../core/theme/app_theme.dart'; import '../../domain/entities/server_connection_info.dart'; import '../../domain/repositories/connection_repository.dart'; @@ -46,6 +47,7 @@ class _ConnectScreenState extends State { } void _onManualConnect() { + final l10n = context.l10n; final name = _nameController.text.trim(); final ip = _ipController.text.trim(); final port = int.tryParse(_portController.text.trim()) ?? 8765; @@ -53,8 +55,8 @@ class _ConnectScreenState extends State { if (ip.isEmpty) { ScaffoldMessenger.of(context).showSnackBar( - const SnackBar( - content: Text('Inserisci un indirizzo IP valido del PC'), + SnackBar( + content: Text(l10n.enterValidIp), backgroundColor: AppTheme.error, ), ); @@ -65,7 +67,7 @@ class _ConnectScreenState extends State { ip: ip, port: port, pin: pin, - serverName: name.isNotEmpty ? name : 'PC Negozio', + serverName: name.isNotEmpty ? name : l10n.defaultStorePcName, ); final timeout = context @@ -80,7 +82,7 @@ class _ConnectScreenState extends State { ScaffoldMessenger.of(context).showSnackBar( SnackBar( - content: Text('Connessione a $ip:$port in corso...'), + content: Text(l10n.connectingToHost(ip, port)), backgroundColor: AppTheme.primary, ), ); @@ -89,12 +91,13 @@ class _ConnectScreenState extends State { @override Widget build(BuildContext context) { + final l10n = context.l10n; final timeout = context.watch().state.settings.inactivityTimeoutMinutes; return Scaffold( appBar: AppBar( - title: const Text('Connessione Postazioni PC'), + title: Text(l10n.pcConnectionsTitle), ), body: BlocConsumer( listener: (context, state) { @@ -125,9 +128,10 @@ class _ConnectScreenState extends State { borderRadius: BorderRadius.circular(14)), ), icon: const Icon(Icons.qr_code_scanner_rounded, size: 22), - label: const Text( - 'Inquadra QR Code sul PC', - style: TextStyle(fontSize: 16, fontWeight: FontWeight.bold), + label: Text( + l10n.scanPcQrCode, + style: const TextStyle( + fontSize: 16, fontWeight: FontWeight.bold), ), onPressed: () { showModalBottomSheet( @@ -144,16 +148,16 @@ class _ConnectScreenState extends State { Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ - const Text( - 'Postazioni Salvate nel Negozio', - style: TextStyle( + Text( + l10n.savedStoreWorkstations, + style: const TextStyle( fontSize: 15, fontWeight: FontWeight.w700, color: AppTheme.darkTextPrimary, ), ), Text( - '${favorites.length} preferiti', + l10n.favoritesCount(favorites.length), style: const TextStyle( fontSize: 12, color: AppTheme.darkTextSecondary), ), @@ -217,7 +221,8 @@ class _ConnectScreenState extends State { timeoutMinutes: timeout); Navigator.pop(context); }, - child: Text(isCurrent ? 'Attivo' : 'Connetti'), + child: + Text(isCurrent ? l10n.active : l10n.connect), ), ], ), @@ -232,9 +237,9 @@ class _ConnectScreenState extends State { Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ - const Text( - 'PC Rilevati in Wi-Fi', - style: TextStyle( + Text( + l10n.detectedWifiPcs, + style: const TextStyle( fontSize: 15, fontWeight: FontWeight.w700, color: AppTheme.darkTextPrimary, @@ -251,7 +256,7 @@ class _ConnectScreenState extends State { strokeWidth: 2, color: AppTheme.primary), ) : const Icon(Icons.refresh_rounded, size: 20), - tooltip: 'Aggiorna ricerca', + tooltip: l10n.refreshDiscoveryTooltip, onPressed: discoveryState.isScanning ? null : () => @@ -274,18 +279,18 @@ class _ConnectScreenState extends State { borderRadius: BorderRadius.circular(14), border: Border.all(color: AppTheme.darkBorder), ), - child: const Row( + child: Row( children: [ - SizedBox( + const SizedBox( width: 20, height: 20, child: CircularProgressIndicator(strokeWidth: 2), ), - SizedBox(width: 16), + const SizedBox(width: 16), Expanded( child: Text( - 'Ricerca server PC in corso sulla rete...', - style: TextStyle( + l10n.searchingPcServers, + style: const TextStyle( color: AppTheme.darkTextSecondary, fontSize: 13), ), @@ -303,9 +308,9 @@ class _ConnectScreenState extends State { borderRadius: BorderRadius.circular(14), border: Border.all(color: AppTheme.darkBorder), ), - child: const Text( - 'Nessun server PC rilevato automaticamente sulla rete.\nAssicurati che il programma sul PC sia avviato e connesso allo stesso Wi-Fi.', - style: TextStyle( + child: Text( + l10n.noPcServersFound, + style: const TextStyle( color: AppTheme.darkTextSecondary, fontSize: 13, height: 1.4), @@ -340,18 +345,18 @@ class _ConnectScreenState extends State { fontWeight: FontWeight.bold, fontSize: 15), ), subtitle: Text( - '${srv.ip}:${srv.port} ${srv.pinRequired ? "• Richiede PIN" : ""}', + '${srv.ip}:${srv.port} ${srv.pinRequired ? "• ${l10n.requiresPin}" : ""}', style: const TextStyle( fontSize: 12, color: AppTheme.darkTextSecondary), ), trailing: isCurrent - ? const Chip( - label: Text('Connesso', - style: TextStyle( + ? Chip( + label: Text(l10n.connected, + style: const TextStyle( fontSize: 12, color: AppTheme.success)), - backgroundColor: Color(0xFF064E3B), + backgroundColor: const Color(0xFF064E3B), side: BorderSide.none, ) : FilledButton( @@ -371,7 +376,7 @@ class _ConnectScreenState extends State { ); Navigator.pop(context); }, - child: const Text('Connetti'), + child: Text(l10n.connect), ), ), ); @@ -383,9 +388,9 @@ class _ConnectScreenState extends State { const SizedBox(height: 28), // Method 3: Manual Setup - const Text( - 'Configurazione Manuale', - style: TextStyle( + Text( + l10n.manualSetup, + style: const TextStyle( fontSize: 15, fontWeight: FontWeight.w700, color: AppTheme.darkTextPrimary, @@ -395,20 +400,20 @@ class _ConnectScreenState extends State { TextField( controller: _nameController, - decoration: const InputDecoration( - labelText: 'Nome Postazione / PC (opzionale)', - hintText: 'Es. Cassa 1, Magazzino, Ufficio', - prefixIcon: Icon(Icons.badge_outlined, size: 20), + decoration: InputDecoration( + labelText: l10n.workstationNameLabel, + hintText: l10n.workstationNameHint, + prefixIcon: const Icon(Icons.badge_outlined, size: 20), ), ), const SizedBox(height: 12), TextField( controller: _ipController, - decoration: const InputDecoration( - labelText: 'Indirizzo IP del PC', - hintText: 'Es. 192.168.1.100', - prefixIcon: Icon(Icons.lan_outlined, size: 20), + decoration: InputDecoration( + labelText: l10n.pcIpLabel, + hintText: l10n.pcIpHint, + prefixIcon: const Icon(Icons.lan_outlined, size: 20), ), keyboardType: TextInputType.url, ), @@ -420,10 +425,10 @@ class _ConnectScreenState extends State { flex: 2, child: TextField( controller: _portController, - decoration: const InputDecoration( - labelText: 'Porta', + decoration: InputDecoration( + labelText: l10n.portLabel, hintText: '8765', - prefixIcon: Icon(Icons.tag_rounded, size: 20), + prefixIcon: const Icon(Icons.tag_rounded, size: 20), ), keyboardType: TextInputType.number, ), @@ -433,10 +438,11 @@ class _ConnectScreenState extends State { flex: 3, child: TextField( controller: _pinController, - decoration: const InputDecoration( - labelText: 'PIN (se impostato)', - hintText: 'Codice PIN', - prefixIcon: Icon(Icons.lock_outline_rounded, size: 20), + decoration: InputDecoration( + labelText: l10n.pinOptionalLabel, + hintText: l10n.pinHint, + prefixIcon: + const Icon(Icons.lock_outline_rounded, size: 20), ), keyboardType: TextInputType.number, obscureText: true, @@ -451,7 +457,7 @@ class _ConnectScreenState extends State { padding: const EdgeInsets.symmetric(vertical: 14), ), icon: const Icon(Icons.save_rounded, size: 20), - label: const Text('Salva e Connetti Manualmente'), + label: Text(l10n.saveAndConnectManually), onPressed: _onManualConnect, ), @@ -460,7 +466,7 @@ class _ConnectScreenState extends State { TextButton.icon( style: TextButton.styleFrom(foregroundColor: AppTheme.error), icon: const Icon(Icons.link_off_rounded, size: 20), - label: const Text('Disconnetti dal PC'), + label: Text(l10n.disconnectFromPc), onPressed: () { context.read().disconnect(); }, diff --git a/app/lib/features/connection/presentation/widgets/connection_status_chip.dart b/app/lib/features/connection/presentation/widgets/connection_status_chip.dart index 403166e..5133a6e 100644 --- a/app/lib/features/connection/presentation/widgets/connection_status_chip.dart +++ b/app/lib/features/connection/presentation/widgets/connection_status_chip.dart @@ -1,5 +1,6 @@ import 'package:flutter/material.dart'; import 'package:flutter_bloc/flutter_bloc.dart'; +import '../../../../core/l10n/l10n_extensions.dart'; import '../../../../core/theme/app_theme.dart'; import '../../domain/repositories/connection_repository.dart'; import '../cubit/connection_cubit.dart'; @@ -11,6 +12,7 @@ class ConnectionStatusChip extends StatelessWidget { @override Widget build(BuildContext context) { + final l10n = context.l10n; return BlocBuilder( builder: (context, state) { Color dotColor; @@ -23,15 +25,15 @@ class ConnectionStatusChip extends StatelessWidget { break; case ConnectionStatus.connecting: dotColor = AppTheme.warning; - label = 'Connessione...'; + label = l10n.connecting; break; case ConnectionStatus.error: dotColor = AppTheme.error; - label = 'Errore PIN/Rete'; + label = l10n.pinOrNetworkError; break; case ConnectionStatus.disconnected: dotColor = AppTheme.darkTextSecondary; - label = 'Non connesso'; + label = l10n.notConnected; break; } diff --git a/app/lib/features/connection/presentation/widgets/qr_pairing_modal.dart b/app/lib/features/connection/presentation/widgets/qr_pairing_modal.dart index 7c90fc1..e35c71c 100644 --- a/app/lib/features/connection/presentation/widgets/qr_pairing_modal.dart +++ b/app/lib/features/connection/presentation/widgets/qr_pairing_modal.dart @@ -2,6 +2,7 @@ import 'dart:convert'; import 'package:flutter/material.dart'; import 'package:flutter_bloc/flutter_bloc.dart'; import 'package:mobile_scanner/mobile_scanner.dart'; +import '../../../../core/l10n/l10n_extensions.dart'; import '../../../../core/theme/app_theme.dart'; import '../../domain/entities/server_connection_info.dart'; import '../../../settings/presentation/cubit/settings_cubit.dart'; @@ -12,6 +13,7 @@ class QrPairingModal extends StatelessWidget { @override Widget build(BuildContext context) { + final l10n = context.l10n; return Container( height: MediaQuery.of(context).size.height * 0.75, decoration: const BoxDecoration( @@ -35,9 +37,9 @@ class QrPairingModal extends StatelessWidget { children: [ const Icon(Icons.qr_code_scanner, color: AppTheme.primary), const SizedBox(width: 8), - const Text( - 'Inquadra QR Code del Server', - style: TextStyle( + Text( + l10n.qrModalTitle, + style: const TextStyle( fontSize: 17, fontWeight: FontWeight.w700, color: AppTheme.darkTextPrimary, @@ -51,11 +53,12 @@ class QrPairingModal extends StatelessWidget { ], ), ), - const Padding( - padding: EdgeInsets.symmetric(horizontal: 20, vertical: 4), + Padding( + padding: const EdgeInsets.symmetric(horizontal: 20, vertical: 4), child: Text( - 'Inquadra il codice QR mostrato nel terminale o nella dashboard web del PC.', - style: TextStyle(color: AppTheme.darkTextSecondary, fontSize: 13), + l10n.qrModalSubtitle, + style: const TextStyle( + color: AppTheme.darkTextSecondary, fontSize: 13), textAlign: TextAlign.center, ), ), diff --git a/app/lib/features/connection/presentation/widgets/server_selection_sheet.dart b/app/lib/features/connection/presentation/widgets/server_selection_sheet.dart index 5f3ef3f..ebbabe7 100644 --- a/app/lib/features/connection/presentation/widgets/server_selection_sheet.dart +++ b/app/lib/features/connection/presentation/widgets/server_selection_sheet.dart @@ -1,5 +1,6 @@ import 'package:flutter/material.dart'; import 'package:flutter_bloc/flutter_bloc.dart'; +import '../../../../core/l10n/l10n_extensions.dart'; import '../../../../core/theme/app_theme.dart'; import '../../domain/entities/server_connection_info.dart'; import '../../../settings/presentation/cubit/settings_cubit.dart'; @@ -31,7 +32,7 @@ class ServerSelectionSheet extends StatelessWidget { Navigator.of(context).pop(); ScaffoldMessenger.of(context).showSnackBar( SnackBar( - content: Text('Connessione a ${server.displayName}...'), + content: Text(context.l10n.connectingToName(server.displayName)), backgroundColor: AppTheme.primary, duration: const Duration(seconds: 1), ), @@ -40,17 +41,18 @@ class ServerSelectionSheet extends StatelessWidget { void _confirmDelete( BuildContext context, ServerConnectionInfo server) { + final l10n = context.l10n; showDialog( context: context, builder: (ctx) => AlertDialog( - title: const Text('Rimuovere postazione?'), + title: Text(l10n.removeWorkstationTitle), content: Text( - 'Vuoi eliminare "${server.displayName}" (${server.ip}) dai PC preferiti?', + l10n.removeWorkstationMessage(server.displayName, server.ip), ), actions: [ TextButton( onPressed: () => Navigator.pop(ctx), - child: const Text('Annulla'), + child: Text(l10n.cancel), ), FilledButton( style: FilledButton.styleFrom(backgroundColor: AppTheme.error), @@ -58,7 +60,7 @@ class ServerSelectionSheet extends StatelessWidget { context.read().removeFavorite(server.effectiveId); Navigator.pop(ctx); }, - child: const Text('Rimuovi'), + child: Text(l10n.remove), ), ], ), @@ -67,6 +69,7 @@ class ServerSelectionSheet extends StatelessWidget { @override Widget build(BuildContext context) { + final l10n = context.l10n; return BlocBuilder( builder: (context, settingsState) { final settings = settingsState.settings; @@ -114,22 +117,22 @@ class ServerSelectionSheet extends StatelessWidget { color: AppTheme.primary, size: 24), ), const SizedBox(width: 12), - const Expanded( + Expanded( child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ Text( - 'Seleziona Postazione PC', - style: TextStyle( + l10n.selectPcWorkstation, + style: const TextStyle( fontSize: 17, fontWeight: FontWeight.w700, color: AppTheme.darkTextPrimary, ), ), - SizedBox(height: 2), + const SizedBox(height: 2), Text( - 'Scegli il computer del negozio su cui scrivere', - style: TextStyle( + l10n.selectPcSubtitle, + style: const TextStyle( fontSize: 12, color: AppTheme.darkTextSecondary, ), @@ -159,15 +162,15 @@ class ServerSelectionSheet extends StatelessWidget { border: Border.all( color: AppTheme.warning.withValues(alpha: 0.4)), ), - child: const Row( + child: Row( children: [ - Icon(Icons.timer_outlined, + const Icon(Icons.timer_outlined, color: AppTheme.warning, size: 18), - SizedBox(width: 10), + const SizedBox(width: 10), Expanded( child: Text( - 'Disconnesso per inattività. Seleziona la postazione prima di scansionare.', - style: TextStyle( + l10n.inactivityAlert, + style: const TextStyle( fontSize: 12, color: AppTheme.warning), ), ), @@ -190,17 +193,17 @@ class ServerSelectionSheet extends StatelessWidget { color: AppTheme.darkTextSecondary .withValues(alpha: 0.4)), const SizedBox(height: 12), - const Text( - 'Nessun PC preferito salvato', - style: TextStyle( + Text( + l10n.noFavoritePcs, + style: const TextStyle( fontWeight: FontWeight.bold, fontSize: 15), ), const SizedBox(height: 4), - const Text( - 'Aggiungi i computer del negozio per collegarti con 1 tocco ed evitare errori tra colleghi.', + Text( + l10n.noFavoritePcsHint, textAlign: TextAlign.center, - style: TextStyle( + style: const TextStyle( fontSize: 12, color: AppTheme.darkTextSecondary), ), @@ -298,9 +301,9 @@ class ServerSelectionSheet extends StatelessWidget { BorderRadius .circular(6), ), - child: const Text( - 'ATTIVO', - style: TextStyle( + child: Text( + l10n.activeUppercase, + style: const TextStyle( color: AppTheme.success, fontSize: 10, @@ -313,7 +316,7 @@ class ServerSelectionSheet extends StatelessWidget { ), const SizedBox(height: 2), Text( - '${item.ip}:${item.port} ${item.pin.isNotEmpty ? "• Con PIN" : ""}', + '${item.ip}:${item.port} ${item.pin.isNotEmpty ? "• ${l10n.withPin}" : ""}', style: const TextStyle( fontFamily: 'monospace', fontSize: 12, @@ -332,7 +335,7 @@ class ServerSelectionSheet extends StatelessWidget { Icons.delete_outline_rounded, size: 20), color: AppTheme.darkTextSecondary, - tooltip: 'Rimuovi dai preferiti', + tooltip: l10n.removeFavoriteTooltip, onPressed: () => _confirmDelete(context, item), ), @@ -356,8 +359,8 @@ class ServerSelectionSheet extends StatelessWidget { settings.inactivityTimeoutMinutes, ), child: Text(isCurrent - ? 'Riconnetti' - : 'Connetti'), + ? l10n.reconnect + : l10n.connect), ), ], ), @@ -381,9 +384,9 @@ class ServerSelectionSheet extends StatelessWidget { borderRadius: BorderRadius.circular(12)), ), icon: const Icon(Icons.add_rounded, size: 20), - label: const Text( - 'Aggiungi Nuovo PC (Wi-Fi o QR Code)', - style: TextStyle(fontWeight: FontWeight.bold), + label: Text( + l10n.addNewPcButton, + style: const TextStyle(fontWeight: FontWeight.bold), ), onPressed: () { Navigator.pop(context); @@ -406,20 +409,20 @@ class ServerSelectionSheet extends StatelessWidget { const Icon(Icons.flash_auto_rounded, size: 20, color: AppTheme.secondary), const SizedBox(width: 10), - const Expanded( + Expanded( child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ Text( - 'Collega automaticamente all\'avvio', - style: TextStyle( + l10n.autoConnectOnStartup, + style: const TextStyle( fontSize: 13, fontWeight: FontWeight.w600, ), ), Text( - 'Disattivato: richiede la selezione del PC (consigliato in negozio)', - style: TextStyle( + l10n.autoConnectSubtitleShort, + style: const TextStyle( fontSize: 11, color: AppTheme.darkTextSecondary, ), diff --git a/app/lib/features/monetization/presentation/cubit/monetization_cubit.dart b/app/lib/features/monetization/presentation/cubit/monetization_cubit.dart index 4461db2..a94c86c 100644 --- a/app/lib/features/monetization/presentation/cubit/monetization_cubit.dart +++ b/app/lib/features/monetization/presentation/cubit/monetization_cubit.dart @@ -1,7 +1,7 @@ import 'dart:async'; import 'package:flutter_bloc/flutter_bloc.dart'; -import 'package:purchases_ui_flutter/purchases_ui_flutter.dart'; +import 'package:purchases_flutter/purchases_flutter.dart'; import 'package:shared_preferences/shared_preferences.dart'; import '../../../../core/services/ad_service.dart'; @@ -150,20 +150,26 @@ class MonetizationCubit extends Cubit { return success; } - /// Presents the official RevenueCat Paywall UI. - Future presentPaywall() async { - final result = await _subscriptionService.presentPaywall(); - if (result == PaywallResult.purchased || result == PaywallResult.restored) { - emit(state.copyWith(isPremium: true)); - } - return result; + /// Fetches available subscription / lifetime packages from RevenueCat. + Future> loadPackages() async { + return _subscriptionService.getAvailablePackages(); } - /// Presents the RevenueCat Customer Center to view/manage subscription. - Future presentCustomerCenter() async { - await _subscriptionService.presentCustomerCenter(); + /// Purchases a selected package via RevenueCat and updates premium state. + Future purchasePackage(Package package) async { + final outcome = await _subscriptionService.purchasePackage(package); + if (outcome == PurchaseOutcome.purchased && !isClosed) { + emit(state.copyWith(isPremium: true)); + } + return outcome; + } + + /// Refreshes the entitlement status from RevenueCat. + Future refreshEntitlement() async { final isEntitled = await _subscriptionService.isEntitled(); - emit(state.copyWith(isPremium: isEntitled)); + if (!isClosed) { + emit(state.copyWith(isPremium: isEntitled)); + } } /// Restores previous purchases across device reinstalls. diff --git a/app/lib/features/monetization/presentation/widgets/paywall_sheet.dart b/app/lib/features/monetization/presentation/widgets/paywall_sheet.dart new file mode 100644 index 0000000..6d4d05c --- /dev/null +++ b/app/lib/features/monetization/presentation/widgets/paywall_sheet.dart @@ -0,0 +1,647 @@ +import 'package:flutter/material.dart'; +import 'package:flutter_bloc/flutter_bloc.dart'; +import 'package:purchases_flutter/purchases_flutter.dart'; + +import '../../../../core/l10n/l10n_extensions.dart'; +import '../../../../core/services/subscription_service.dart'; +import '../../../../core/theme/app_theme.dart'; +import '../cubit/monetization_cubit.dart'; + +/// Custom native Flutter Paywall powered by RevenueCat Offerings & Packages. +class PaywallSheet extends StatefulWidget { + const PaywallSheet({super.key}); + + /// Shows the custom paywall modal and returns `true` if Premium was unlocked. + static Future show(BuildContext context) async { + final result = await showModalBottomSheet( + context: context, + isScrollControlled: true, + backgroundColor: Colors.transparent, + builder: (_) => BlocProvider.value( + value: context.read(), + child: const PaywallSheet(), + ), + ); + return result == true; + } + + /// Shows a clean dialog for users who already have an active Premium plan. + static Future showPremiumManageDialog(BuildContext context) { + final l10n = context.l10n; + return showDialog( + context: context, + builder: (ctx) => AlertDialog( + title: Row( + children: [ + const Icon( + Icons.workspace_premium_rounded, + color: Color(0xFFFBBF24), + ), + const SizedBox(width: 10), + Expanded(child: Text(l10n.premiumManageTitle)), + ], + ), + content: Text( + l10n.premiumManageBody, + style: const TextStyle(height: 1.45), + ), + actions: [ + FilledButton( + onPressed: () => Navigator.of(ctx).pop(), + child: Text(l10n.closeButton), + ), + ], + ), + ); + } + + @override + State createState() => _PaywallSheetState(); +} + +class _PaywallSheetState extends State { + static const _gold = Color(0xFFFBBF24); + + List _packages = const []; + Package? _selectedPackage; + bool _isLoading = true; + bool _isPurchasing = false; + bool _isRestoring = false; + + @override + void initState() { + super.initState(); + _loadOfferings(); + } + + Future _loadOfferings() async { + setState(() => _isLoading = true); + final packages = await context.read().loadPackages(); + if (!mounted) return; + setState(() { + _packages = packages; + _selectedPackage = packages.isNotEmpty ? packages.first : null; + _isLoading = false; + }); + } + + Future _onPurchasePressed() async { + final pkg = _selectedPackage; + if (pkg == null || _isPurchasing || _isRestoring) return; + + setState(() => _isPurchasing = true); + final outcome = await context.read().purchasePackage(pkg); + if (!mounted) return; + setState(() => _isPurchasing = false); + + final l10n = context.l10n; + if (outcome == PurchaseOutcome.purchased) { + Navigator.of(context).pop(true); + ScaffoldMessenger.of(context).showSnackBar( + SnackBar( + content: Text('🎉 ${l10n.welcomePremiumSnackbar}'), + backgroundColor: AppTheme.success, + duration: const Duration(milliseconds: 2200), + ), + ); + } else if (outcome == PurchaseOutcome.error) { + ScaffoldMessenger.of(context).showSnackBar( + SnackBar( + content: Text(l10n.paywallPurchaseError), + backgroundColor: AppTheme.error, + ), + ); + } + } + + Future _onRestorePressed() async { + if (_isPurchasing || _isRestoring) return; + setState(() => _isRestoring = true); + final restored = await context.read().restorePurchases(); + if (!mounted) return; + setState(() => _isRestoring = false); + + final l10n = context.l10n; + if (restored) { + Navigator.of(context).pop(true); + ScaffoldMessenger.of(context).showSnackBar( + SnackBar( + content: Text(l10n.restorePurchasesSuccess), + backgroundColor: AppTheme.success, + ), + ); + } else { + ScaffoldMessenger.of(context).showSnackBar( + SnackBar( + content: Text(l10n.restorePurchasesEmpty), + backgroundColor: AppTheme.darkCard, + ), + ); + } + } + + int? _yearlySavingsPercent() { + Package? monthly; + Package? yearly; + for (final p in _packages) { + final id = p.identifier.toLowerCase(); + if (p.packageType == PackageType.monthly || id.contains('month')) { + monthly = p; + } else if (p.packageType == PackageType.annual || + id.contains('year') || + id.contains('annual')) { + yearly = p; + } + } + if (monthly == null || yearly == null) return null; + final annualAtMonthlyRate = monthly.storeProduct.price * 12.0; + if (annualAtMonthlyRate <= 0 || yearly.storeProduct.price >= annualAtMonthlyRate) { + return null; + } + final pct = ((1.0 - (yearly.storeProduct.price / annualAtMonthlyRate)) * 100).round(); + return pct >= 5 ? pct : null; + } + + @override + Widget build(BuildContext context) { + final l10n = context.l10n; + final savingsPct = _yearlySavingsPercent(); + + return Container( + constraints: BoxConstraints( + maxHeight: MediaQuery.of(context).size.height * 0.90, + ), + decoration: const BoxDecoration( + color: AppTheme.darkSurface, + borderRadius: BorderRadius.vertical(top: Radius.circular(28)), + border: Border( + top: BorderSide(color: AppTheme.darkBorder, width: 1.5), + ), + ), + child: SafeArea( + top: false, + child: Column( + mainAxisSize: MainAxisSize.min, + children: [ + // Drag handle + close button + Padding( + padding: const EdgeInsets.fromLTRB(16, 12, 8, 0), + child: Row( + children: [ + const SizedBox(width: 40), + const Spacer(), + Container( + width: 42, + height: 4, + decoration: BoxDecoration( + color: AppTheme.darkTextSecondary.withValues(alpha: 0.4), + borderRadius: BorderRadius.circular(2), + ), + ), + const Spacer(), + IconButton( + icon: const Icon(Icons.close_rounded), + color: AppTheme.darkTextSecondary, + onPressed: _isPurchasing + ? null + : () => Navigator.of(context).pop(false), + ), + ], + ), + ), + + Flexible( + child: SingleChildScrollView( + padding: const EdgeInsets.fromLTRB(22, 4, 22, 20), + child: Column( + crossAxisAlignment: CrossAxisAlignment.stretch, + children: [ + // Crown icon + Center( + child: Container( + width: 68, + height: 68, + decoration: BoxDecoration( + gradient: LinearGradient( + begin: Alignment.topLeft, + end: Alignment.bottomRight, + colors: [ + _gold.withValues(alpha: 0.25), + AppTheme.primary.withValues(alpha: 0.20), + ], + ), + shape: BoxShape.circle, + border: Border.all( + color: _gold.withValues(alpha: 0.6), + width: 2, + ), + ), + child: const Icon( + Icons.workspace_premium_rounded, + color: _gold, + size: 36, + ), + ), + ), + const SizedBox(height: 14), + + Text( + l10n.paywallTitle, + textAlign: TextAlign.center, + style: const TextStyle( + fontSize: 22, + fontWeight: FontWeight.w800, + color: Colors.white, + letterSpacing: -0.4, + ), + ), + const SizedBox(height: 6), + Text( + l10n.paywallSubtitle, + textAlign: TextAlign.center, + style: const TextStyle( + fontSize: 13.5, + color: AppTheme.darkTextSecondary, + height: 1.35, + ), + ), + const SizedBox(height: 18), + + // Benefits Card + Container( + padding: const EdgeInsets.symmetric( + horizontal: 16, vertical: 14), + decoration: BoxDecoration( + color: AppTheme.darkCard, + borderRadius: BorderRadius.circular(16), + border: Border.all(color: AppTheme.darkBorder), + ), + child: Column( + children: [ + _BenefitRow( + icon: Icons.all_inclusive_rounded, + text: l10n.paywallBenefitUnlimited, + ), + const SizedBox(height: 10), + _BenefitRow( + icon: Icons.block_rounded, + text: l10n.paywallBenefitNoAds, + ), + const SizedBox(height: 10), + _BenefitRow( + icon: Icons.view_in_ar_rounded, + text: l10n.paywallBenefitAllModes, + ), + const SizedBox(height: 10), + _BenefitRow( + icon: Icons.computer_rounded, + text: l10n.paywallBenefitMultiPc, + ), + ], + ), + ), + const SizedBox(height: 18), + + // Plans section + if (_isLoading) + Padding( + padding: const EdgeInsets.symmetric(vertical: 28), + child: Column( + children: [ + const CircularProgressIndicator(color: _gold), + const SizedBox(height: 12), + Text( + l10n.paywallLoadingPlans, + style: const TextStyle( + color: AppTheme.darkTextSecondary, + fontSize: 13, + ), + ), + ], + ), + ) + else if (_packages.isEmpty) + Container( + padding: const EdgeInsets.all(20), + decoration: BoxDecoration( + color: AppTheme.darkCard, + borderRadius: BorderRadius.circular(16), + border: Border.all(color: AppTheme.darkBorder), + ), + child: Column( + children: [ + const Icon( + Icons.cloud_off_rounded, + color: AppTheme.darkTextSecondary, + size: 32, + ), + const SizedBox(height: 10), + Text( + l10n.paywallUnavailableTitle, + textAlign: TextAlign.center, + style: const TextStyle( + fontWeight: FontWeight.w700, + fontSize: 15, + ), + ), + const SizedBox(height: 6), + Text( + l10n.paywallUnavailableSubtitle, + textAlign: TextAlign.center, + style: const TextStyle( + fontSize: 12.5, + color: AppTheme.darkTextSecondary, + ), + ), + const SizedBox(height: 14), + OutlinedButton.icon( + onPressed: _loadOfferings, + icon: const Icon(Icons.refresh_rounded, size: 18), + label: Text(l10n.paywallRetryButton), + ), + ], + ), + ) + else ...[ + for (final pkg in _packages) ...[ + _PlanCard( + package: pkg, + isSelected: _selectedPackage?.identifier == pkg.identifier, + savingsPercent: savingsPct, + onTap: () => setState(() => _selectedPackage = pkg), + ), + const SizedBox(height: 10), + ], + const SizedBox(height: 8), + + // Primary Purchase CTA + SizedBox( + height: 54, + child: FilledButton( + onPressed: (_selectedPackage == null || _isPurchasing) + ? null + : _onPurchasePressed, + style: FilledButton.styleFrom( + backgroundColor: _gold, + foregroundColor: Colors.black87, + shape: RoundedRectangleBorder( + borderRadius: BorderRadius.circular(16), + ), + ), + child: _isPurchasing + ? const SizedBox( + width: 22, + height: 22, + child: CircularProgressIndicator( + strokeWidth: 2.5, + color: Colors.black87, + ), + ) + : Text( + _selectedPackage != null + ? l10n.paywallContinueWithPrice( + _selectedPackage!.storeProduct.priceString, + ) + : l10n.paywallContinueButton, + style: const TextStyle( + fontSize: 16, + fontWeight: FontWeight.w800, + ), + ), + ), + ), + ], + + const SizedBox(height: 12), + + // Restore Purchases + Center( + child: TextButton( + onPressed: + (_isPurchasing || _isRestoring) ? null : _onRestorePressed, + child: _isRestoring + ? const SizedBox( + width: 16, + height: 16, + child: CircularProgressIndicator(strokeWidth: 2), + ) + : Text( + l10n.restorePurchasesTitle, + style: const TextStyle( + color: AppTheme.secondary, + fontWeight: FontWeight.w600, + ), + ), + ), + ), + + const SizedBox(height: 4), + Text( + l10n.paywallLegalNote, + textAlign: TextAlign.center, + style: TextStyle( + fontSize: 11, + color: AppTheme.darkTextSecondary.withValues(alpha: 0.75), + height: 1.35, + ), + ), + ], + ), + ), + ), + ], + ), + ), + ); + } +} + +class _BenefitRow extends StatelessWidget { + final IconData icon; + final String text; + + const _BenefitRow({required this.icon, required this.text}); + + @override + Widget build(BuildContext context) { + return Row( + children: [ + Icon(icon, color: const Color(0xFFFBBF24), size: 20), + const SizedBox(width: 12), + Expanded( + child: Text( + text, + style: const TextStyle( + fontSize: 13.5, + fontWeight: FontWeight.w500, + color: AppTheme.darkTextPrimary, + ), + ), + ), + ], + ); + } +} + +class _PlanCard extends StatelessWidget { + final Package package; + final bool isSelected; + final int? savingsPercent; + final VoidCallback onTap; + + const _PlanCard({ + required this.package, + required this.isSelected, + required this.savingsPercent, + required this.onTap, + }); + + @override + Widget build(BuildContext context) { + final l10n = context.l10n; + const gold = Color(0xFFFBBF24); + final id = package.identifier.toLowerCase(); + + final isYearly = package.packageType == PackageType.annual || + id.contains('year') || + id.contains('annual'); + final isLifetime = + package.packageType == PackageType.lifetime || id.contains('life'); + final isMonthly = + package.packageType == PackageType.monthly || id.contains('month'); + + final title = isYearly + ? l10n.paywallPlanYearly + : isLifetime + ? l10n.paywallPlanLifetime + : isMonthly + ? l10n.paywallPlanMonthly + : package.storeProduct.title; + + final periodLabel = isYearly + ? l10n.paywallPerYear + : isLifetime + ? l10n.paywallOneTime + : isMonthly + ? l10n.paywallPerMonth + : ''; + + String? badge; + if (isYearly) { + badge = savingsPercent != null + ? l10n.paywallSavePercent(savingsPercent!) + : l10n.paywallBestValue; + } else if (isLifetime) { + badge = l10n.paywallOneTimeBadge; + } + + return InkWell( + onTap: onTap, + borderRadius: BorderRadius.circular(16), + child: AnimatedContainer( + duration: const Duration(milliseconds: 160), + padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 14), + decoration: BoxDecoration( + color: isSelected + ? gold.withValues(alpha: 0.12) + : AppTheme.darkCard, + borderRadius: BorderRadius.circular(16), + border: Border.all( + color: isSelected ? gold : AppTheme.darkBorder, + width: isSelected ? 2 : 1, + ), + ), + child: Row( + children: [ + Container( + width: 22, + height: 22, + decoration: BoxDecoration( + shape: BoxShape.circle, + border: Border.all( + color: isSelected ? gold : AppTheme.darkTextSecondary, + width: 2, + ), + ), + child: isSelected + ? Center( + child: Container( + width: 11, + height: 11, + decoration: const BoxDecoration( + shape: BoxShape.circle, + color: gold, + ), + ), + ) + : null, + ), + const SizedBox(width: 14), + Expanded( + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Row( + children: [ + Flexible( + child: Text( + title, + style: const TextStyle( + fontSize: 15.5, + fontWeight: FontWeight.w700, + color: Colors.white, + ), + ), + ), + if (badge != null) ...[ + const SizedBox(width: 8), + Container( + padding: const EdgeInsets.symmetric( + horizontal: 7, vertical: 2), + decoration: BoxDecoration( + color: isYearly + ? gold + : AppTheme.primary.withValues(alpha: 0.25), + borderRadius: BorderRadius.circular(6), + ), + child: Text( + badge, + style: TextStyle( + fontSize: 10, + fontWeight: FontWeight.w800, + color: isYearly ? Colors.black87 : AppTheme.secondary, + letterSpacing: 0.3, + ), + ), + ), + ], + ], + ), + if (periodLabel.isNotEmpty) ...[ + const SizedBox(height: 2), + Text( + periodLabel, + style: const TextStyle( + fontSize: 12, + color: AppTheme.darkTextSecondary, + ), + ), + ], + ], + ), + ), + const SizedBox(width: 10), + Text( + package.storeProduct.priceString, + style: TextStyle( + fontSize: 17, + fontWeight: FontWeight.w800, + color: isSelected ? gold : Colors.white, + ), + ), + ], + ), + ), + ); + } +} diff --git a/app/lib/features/monetization/presentation/widgets/reward_session_dialog.dart b/app/lib/features/monetization/presentation/widgets/reward_session_dialog.dart index 883de54..a262a69 100644 --- a/app/lib/features/monetization/presentation/widgets/reward_session_dialog.dart +++ b/app/lib/features/monetization/presentation/widgets/reward_session_dialog.dart @@ -1,10 +1,11 @@ import 'package:flutter/material.dart'; import 'package:flutter_bloc/flutter_bloc.dart'; -import 'package:purchases_ui_flutter/purchases_ui_flutter.dart'; +import '../../../../core/l10n/l10n_extensions.dart'; import '../../../../core/theme/app_theme.dart'; import '../cubit/monetization_cubit.dart'; import '../cubit/monetization_state.dart'; +import 'paywall_sheet.dart'; /// Bottom sheet dialog prompting user to watch a rewarded video for 15 min unlimited scanning. class RewardSessionDialog extends StatelessWidget { @@ -24,6 +25,7 @@ class RewardSessionDialog extends StatelessWidget { @override Widget build(BuildContext context) { + final l10n = context.l10n; return Container( padding: EdgeInsets.fromLTRB( 24, @@ -74,9 +76,9 @@ class RewardSessionDialog extends StatelessWidget { ), const SizedBox(height: 16), - const Text( - 'Scansioni Illimitate', - style: TextStyle( + Text( + l10n.unlimitedScansTitle, + style: const TextStyle( color: Colors.white, fontSize: 20, fontWeight: FontWeight.bold, @@ -86,7 +88,7 @@ class RewardSessionDialog extends StatelessWidget { const SizedBox(height: 8), Text( - 'Guarda un breve video per sbloccare 15 minuti di scansioni illimitate al PC senza interruzioni.', + l10n.unlimitedScansDescription, textAlign: TextAlign.center, style: TextStyle( color: AppTheme.darkTextSecondary, @@ -110,21 +112,17 @@ class RewardSessionDialog extends StatelessWidget { if (success) { Navigator.of(context).pop(true); ScaffoldMessenger.of(context).showSnackBar( - const SnackBar( - content: Text( - '15 minuti di scansioni illimitate sbloccati!', - ), - duration: Duration(milliseconds: 1600), + SnackBar( + content: Text(l10n.unlocked15MinSnackbar), + duration: const Duration(milliseconds: 1600), backgroundColor: AppTheme.success, ), ); } else { ScaffoldMessenger.of(context).showSnackBar( - const SnackBar( - content: Text( - 'Caricamento video in corso... Riprova tra pochi istanti.', - ), - duration: Duration(milliseconds: 1800), + SnackBar( + content: Text(l10n.loadingVideoRetrySnackbar), + duration: const Duration(milliseconds: 1800), backgroundColor: AppTheme.darkCard, ), ); @@ -149,7 +147,9 @@ class RewardSessionDialog extends StatelessWidget { ) : const Icon(Icons.ondemand_video_rounded, size: 22), label: Text( - state.isAdLoading ? 'Caricamento video...' : 'Guarda Video (+15 min)', + state.isAdLoading + ? l10n.loadingVideoButton + : l10n.watchVideoButton, style: const TextStyle( fontSize: 15, fontWeight: FontWeight.w600, @@ -159,25 +159,15 @@ class RewardSessionDialog extends StatelessWidget { ), const SizedBox(height: 12), - // Upgrade to Premium button (RevenueCat Paywall) + // Upgrade to Premium button (Custom Paywall) SizedBox( width: double.infinity, height: 50, child: OutlinedButton.icon( onPressed: () async { - final cubit = context.read(); - final result = await cubit.presentPaywall(); - if (context.mounted && - (result == PaywallResult.purchased || - result == PaywallResult.restored)) { + final unlocked = await PaywallSheet.show(context); + if (context.mounted && unlocked) { Navigator.of(context).pop(true); - ScaffoldMessenger.of(context).showSnackBar( - const SnackBar( - content: Text('🎉 Benvenuto in Premium Illimitato!'), - backgroundColor: AppTheme.success, - duration: Duration(milliseconds: 2000), - ), - ); } }, style: OutlinedButton.styleFrom( @@ -188,9 +178,9 @@ class RewardSessionDialog extends StatelessWidget { ), ), icon: const Icon(Icons.workspace_premium_rounded, size: 22), - label: const Text( - 'Passa a Premium Illimitato', - style: TextStyle( + label: Text( + l10n.upgradeToPremiumButton, + style: const TextStyle( fontSize: 15, fontWeight: FontWeight.w600, ), @@ -202,9 +192,9 @@ class RewardSessionDialog extends StatelessWidget { // Cancel button TextButton( onPressed: () => Navigator.of(context).pop(false), - child: const Text( - 'Più tardi', - style: TextStyle( + child: Text( + l10n.laterButton, + style: const TextStyle( color: AppTheme.darkTextSecondary, fontSize: 14, ), diff --git a/app/lib/features/scanner/presentation/screens/history_screen.dart b/app/lib/features/scanner/presentation/screens/history_screen.dart index 34bd5cb..560af25 100644 --- a/app/lib/features/scanner/presentation/screens/history_screen.dart +++ b/app/lib/features/scanner/presentation/screens/history_screen.dart @@ -1,6 +1,7 @@ import 'package:flutter/material.dart'; import 'package:flutter/services.dart'; import 'package:flutter_bloc/flutter_bloc.dart'; +import '../../../../core/l10n/l10n_extensions.dart'; import '../../../../core/theme/app_theme.dart'; import '../../domain/entities/scan_record.dart'; import '../cubit/history_cubit.dart'; @@ -24,17 +25,16 @@ class _HistoryScreenState extends State { } void _confirmClear() { + final l10n = context.l10n; showDialog( context: context, builder: (ctx) => AlertDialog( - title: const Text('Cancellare Cronologia?'), - content: const Text( - 'Tutti i codici salvati nella cronologia su questo dispositivo verranno rimossi.', - ), + title: Text(l10n.clearHistoryTitle), + content: Text(l10n.clearHistoryMessage), actions: [ TextButton( onPressed: () => Navigator.pop(ctx), - child: const Text('Annulla'), + child: Text(l10n.cancel), ), FilledButton( style: FilledButton.styleFrom(backgroundColor: AppTheme.error), @@ -42,7 +42,7 @@ class _HistoryScreenState extends State { context.read().clearHistory(); Navigator.pop(ctx); }, - child: const Text('Cancella Tutto'), + child: Text(l10n.clearAllButton), ), ], ), @@ -51,16 +51,17 @@ class _HistoryScreenState extends State { @override Widget build(BuildContext context) { + final l10n = context.l10n; return Scaffold( appBar: AppBar( - title: const Text('Cronologia Scansioni'), + title: Text(l10n.scanHistoryTitle), actions: [ BlocBuilder( builder: (context, state) { if (state.history.isEmpty) return const SizedBox.shrink(); return IconButton( icon: const Icon(Icons.delete_sweep_rounded), - tooltip: 'Cancella cronologia', + tooltip: l10n.clearHistoryTooltip, onPressed: _confirmClear, ); }, @@ -79,7 +80,7 @@ class _HistoryScreenState extends State { child: TextField( controller: _searchController, decoration: InputDecoration( - hintText: 'Cerca tra i codici...', + hintText: l10n.searchCodesHint, prefixIcon: const Icon(Icons.search_rounded, size: 20), suffixIcon: state.searchQuery.isNotEmpty ? IconButton( @@ -112,8 +113,8 @@ class _HistoryScreenState extends State { const SizedBox(height: 16), Text( state.searchQuery.isEmpty - ? 'Nessuna scansione in memoria' - : 'Nessun risultato per "${state.searchQuery}"', + ? l10n.noScansInHistory + : l10n.noResultsForQuery(state.searchQuery), style: const TextStyle( color: AppTheme.darkTextSecondary, fontSize: 15, @@ -197,26 +198,26 @@ class _HistoryTile extends StatelessWidget { children: [ IconButton( icon: const Icon(Icons.copy_rounded, size: 20), - tooltip: 'Copia codice', + tooltip: context.l10n.copyCodeTooltip, onPressed: () { Clipboard.setData(ClipboardData(text: item.code)); ScaffoldMessenger.of(context).showSnackBar( - const SnackBar( - content: Text('Copiato negli appunti'), - duration: Duration(seconds: 1), + SnackBar( + content: Text(context.l10n.copiedToClipboardSnackbar), + duration: const Duration(seconds: 1), ), ); }, ), IconButton( icon: const Icon(Icons.send_rounded, size: 20), - tooltip: 'Invia di nuovo al PC', + tooltip: context.l10n.resendToPcTooltip, color: AppTheme.primary, onPressed: () { context.read().resendScan(item); ScaffoldMessenger.of(context).showSnackBar( SnackBar( - content: Text('Inviato "${item.code}" al PC'), + content: Text(context.l10n.resentCodeSnackbar(item.code)), duration: const Duration(seconds: 1), ), ); diff --git a/app/lib/features/scanner/presentation/screens/scanner_screen.dart b/app/lib/features/scanner/presentation/screens/scanner_screen.dart index c5109a5..2fc9643 100644 --- a/app/lib/features/scanner/presentation/screens/scanner_screen.dart +++ b/app/lib/features/scanner/presentation/screens/scanner_screen.dart @@ -4,6 +4,7 @@ import 'package:flutter/material.dart'; import 'package:flutter_bloc/flutter_bloc.dart'; import 'package:mobile_scanner/mobile_scanner.dart'; +import '../../../../core/l10n/l10n_extensions.dart'; import '../../../../core/services/feedback_service.dart'; import '../../../../core/theme/app_theme.dart'; import '../../../connection/presentation/cubit/connection_cubit.dart'; @@ -11,6 +12,7 @@ import '../../../connection/presentation/widgets/connection_status_chip.dart'; import '../../../connection/presentation/widgets/server_selection_sheet.dart'; import '../../../monetization/presentation/cubit/monetization_cubit.dart'; import '../../../monetization/presentation/cubit/monetization_state.dart'; +import '../../../monetization/presentation/widgets/paywall_sheet.dart'; import '../../../monetization/presentation/widgets/reward_session_dialog.dart'; import '../../../settings/presentation/cubit/settings_cubit.dart'; import '../../../settings/presentation/cubit/settings_state.dart'; @@ -510,14 +512,15 @@ class _ScannerScreenState extends State } if (_frozenSnapshot == null) { + final l10n = context.l10n; ScaffoldMessenger.of(context) ..hideCurrentSnackBar() ..showSnackBar( SnackBar( content: Text( success - ? 'Inviato al PC: ${item.code}' - : 'Codice salvato in cronologia (PC non connesso)', + ? l10n.sentToPcSnackbar(item.code) + : l10n.savedToHistoryOfflineSnackbar, ), duration: const Duration(milliseconds: 1100), backgroundColor: AppTheme.darkCard, @@ -688,14 +691,15 @@ class _ScannerScreenState extends State color: scannerState.isTorchOn ? Colors.amber : Colors.white, - tooltip: 'Torcia', + tooltip: context.l10n.torchTooltip, onPressed: _toggleTorch, ), const SizedBox(width: 10), _CircleGlassButton( icon: Icons .flip_camera_ios_rounded, - tooltip: 'Inverti Fotocamera', + tooltip: context + .l10n.switchCameraTooltip, onPressed: _switchCamera, ), ], @@ -724,7 +728,8 @@ class _ScannerScreenState extends State offset: const Offset(-2, 2), child: _CircleGlassButton( icon: Icons.history_rounded, - tooltip: 'Cronologia', + tooltip: context + .l10n.historyTooltip, onPressed: () { Navigator.of(context).push( MaterialPageRoute( @@ -740,7 +745,8 @@ class _ScannerScreenState extends State const SizedBox(width: 10), _CircleGlassButton( icon: Icons.settings_outlined, - tooltip: 'Impostazioni', + tooltip: + context.l10n.settingsTooltip, onPressed: () { Navigator.of(context).push( MaterialPageRoute( @@ -911,7 +917,7 @@ class _SessionStatusChip extends StatelessWidget { return Material( color: Colors.transparent, child: InkWell( - onTap: () => context.read().presentCustomerCenter(), + onTap: () => PaywallSheet.showPremiumManageDialog(context), borderRadius: BorderRadius.circular(16), child: Container( padding: const EdgeInsets.symmetric(horizontal: 10, vertical: 5), @@ -947,15 +953,16 @@ class _SessionStatusChip extends StatelessWidget { ); } + final l10n = context.l10n; final isUnlimited = state.isUnlimited; final color = isUnlimited ? AppTheme.success : (state.freeScansRemaining > 0 ? AppTheme.primary : AppTheme.warning); final label = isUnlimited - ? '${state.formattedRemainingTime} Illimitati' + ? l10n.unlimitedSessionLabel(state.formattedRemainingTime) : (state.freeScansRemaining > 0 - ? '${state.freeScansRemaining} libere' - : 'Sblocca 15 min'); + ? l10n.freeScansShort(state.freeScansRemaining) + : l10n.unlock15Min); return Material( color: Colors.transparent, diff --git a/app/lib/features/scanner/presentation/widgets/ar_frozen_picker.dart b/app/lib/features/scanner/presentation/widgets/ar_frozen_picker.dart index 22bb09c..4aa4b01 100644 --- a/app/lib/features/scanner/presentation/widgets/ar_frozen_picker.dart +++ b/app/lib/features/scanner/presentation/widgets/ar_frozen_picker.dart @@ -1,4 +1,5 @@ import 'package:flutter/material.dart'; +import '../../../../core/l10n/l10n_extensions.dart'; import '../../../../core/theme/app_theme.dart'; import '../../domain/entities/detected_barcode_item.dart'; import 'ar_barcode_overlay.dart'; @@ -143,7 +144,8 @@ class _ArFrozenPickerState extends State { const SizedBox(width: 8), Flexible( child: Text( - 'Frame bloccato • ${snapshot.items.length} ${snapshot.items.length == 1 ? 'codice' : 'codici'}', + context.l10n.frozenFrameCount( + snapshot.items.length), maxLines: 1, overflow: TextOverflow.ellipsis, style: const TextStyle( @@ -171,7 +173,7 @@ class _ArFrozenPickerState extends State { ], _TopPillButton( icon: Icons.close_rounded, - label: 'Riprendi', + label: context.l10n.resumeButton, accent: true, onTap: widget.onResumeLive, ), @@ -215,10 +217,10 @@ class _ArFrozenPickerState extends State { padding: const EdgeInsets.fromLTRB(18, 12, 14, 8), child: Row( children: [ - const Expanded( + Expanded( child: Text( - 'Tocca un codice per inviarlo al PC', - style: TextStyle( + context.l10n.tapCodeToSend, + style: const TextStyle( color: AppTheme.darkTextSecondary, fontSize: 12.5, fontWeight: FontWeight.w600, @@ -231,7 +233,7 @@ class _ArFrozenPickerState extends State { Icons.videocam_rounded, size: 16, ), - label: const Text('Nuova scansione'), + label: Text(context.l10n.newScanButton), style: TextButton.styleFrom( foregroundColor: AppTheme.secondary, visualDensity: VisualDensity.compact, @@ -379,7 +381,9 @@ class _FrozenCodeRow extends StatelessWidget { ), const SizedBox(width: 4), Text( - isSent ? 'Inviato' : 'Invia', + isSent + ? context.l10n.sentLabel + : context.l10n.sendLabel, style: TextStyle( fontSize: 12, fontWeight: FontWeight.w700, diff --git a/app/lib/features/scanner/presentation/widgets/last_scan_card.dart b/app/lib/features/scanner/presentation/widgets/last_scan_card.dart index ba7d796..75f9189 100644 --- a/app/lib/features/scanner/presentation/widgets/last_scan_card.dart +++ b/app/lib/features/scanner/presentation/widgets/last_scan_card.dart @@ -1,6 +1,7 @@ import 'package:flutter/material.dart'; import 'package:flutter/services.dart'; import 'package:flutter_bloc/flutter_bloc.dart'; +import '../../../../core/l10n/l10n_extensions.dart'; import '../../../../core/theme/app_theme.dart'; import '../../domain/entities/scan_record.dart'; import '../cubit/scanner_cubit.dart'; @@ -12,6 +13,7 @@ class LastScanCard extends StatelessWidget { @override Widget build(BuildContext context) { + final l10n = context.l10n; final isSuccess = record.sentSuccessfully; return Container( @@ -80,9 +82,10 @@ class LastScanCard extends StatelessWidget { ), if (!isSuccess) ...[ const Spacer(), - const Text( - 'Non inviato', - style: TextStyle(fontSize: 11, color: AppTheme.warning), + Text( + l10n.notSent, + style: const TextStyle( + fontSize: 11, color: AppTheme.warning), ), ], ], @@ -105,14 +108,14 @@ class LastScanCard extends StatelessWidget { const SizedBox(width: 8), IconButton( icon: const Icon(Icons.copy_rounded, size: 20), - tooltip: 'Copia', + tooltip: l10n.copyTooltip, color: AppTheme.darkTextSecondary, onPressed: () { Clipboard.setData(ClipboardData(text: record.code)); ScaffoldMessenger.of(context).showSnackBar( - const SnackBar( - content: Text('Codice copiato negli appunti'), - duration: Duration(seconds: 1), + SnackBar( + content: Text(l10n.codeCopiedSnackbar), + duration: const Duration(seconds: 1), backgroundColor: AppTheme.darkCard, ), ); @@ -120,7 +123,7 @@ class LastScanCard extends StatelessWidget { ), IconButton( icon: const Icon(Icons.send_rounded, size: 20), - tooltip: 'Invia di nuovo al PC', + tooltip: l10n.resendToPcTooltip, color: AppTheme.primary, onPressed: () { context.read().resendScan(record); diff --git a/app/lib/features/scanner/presentation/widgets/manual_input_dialog.dart b/app/lib/features/scanner/presentation/widgets/manual_input_dialog.dart index d732e7a..06996a7 100644 --- a/app/lib/features/scanner/presentation/widgets/manual_input_dialog.dart +++ b/app/lib/features/scanner/presentation/widgets/manual_input_dialog.dart @@ -1,6 +1,7 @@ import 'package:flutter/material.dart'; import 'package:flutter/services.dart'; import 'package:flutter_bloc/flutter_bloc.dart'; +import '../../../../core/l10n/l10n_extensions.dart'; import '../../../../core/theme/app_theme.dart'; import '../cubit/scanner_cubit.dart'; @@ -39,21 +40,24 @@ class _ManualInputDialogState extends State { void _submit() { final code = _textController.text.trim(); if (code.isNotEmpty) { - context.read().processBarcode(code, format: 'Manuale'); + context + .read() + .processBarcode(code, format: context.l10n.manualFormat); Navigator.of(context).pop(); } } @override Widget build(BuildContext context) { + final l10n = context.l10n; return AlertDialog( - title: const Row( + title: Row( children: [ - Icon(Icons.keyboard_outlined, color: AppTheme.primary), - SizedBox(width: 10), + const Icon(Icons.keyboard_outlined, color: AppTheme.primary), + const SizedBox(width: 10), Text( - 'Digitazione Manuale', - style: TextStyle(fontSize: 18, fontWeight: FontWeight.bold), + l10n.manualInputTitle, + style: const TextStyle(fontSize: 18, fontWeight: FontWeight.bold), ), ], ), @@ -61,9 +65,10 @@ class _ManualInputDialogState extends State { mainAxisSize: MainAxisSize.min, crossAxisAlignment: CrossAxisAlignment.start, children: [ - const Text( - 'Digita o incolla il codice da digitare in tempo reale sul PC:', - style: TextStyle(fontSize: 13, color: AppTheme.darkTextSecondary), + Text( + l10n.manualInputSubtitle, + style: const TextStyle( + fontSize: 13, color: AppTheme.darkTextSecondary), ), const SizedBox(height: 14), TextField( @@ -71,10 +76,10 @@ class _ManualInputDialogState extends State { autofocus: true, style: const TextStyle(fontFamily: 'monospace', fontSize: 16), decoration: InputDecoration( - hintText: 'Es. 8001234567890 o ART-99', + hintText: l10n.manualInputHint, suffixIcon: IconButton( icon: const Icon(Icons.paste_rounded, size: 20), - tooltip: 'Incolla dagli appunti', + tooltip: l10n.pasteFromClipboardTooltip, onPressed: () async { final data = await Clipboard.getData('text/plain'); if (data?.text != null) { @@ -91,11 +96,11 @@ class _ManualInputDialogState extends State { actions: [ TextButton( onPressed: () => Navigator.of(context).pop(), - child: const Text('Annulla'), + child: Text(l10n.cancel), ), FilledButton.icon( icon: const Icon(Icons.send_rounded, size: 18), - label: const Text('Invia al PC'), + label: Text(l10n.sendToPcButton), onPressed: _submit, ), ], diff --git a/app/lib/features/scanner/presentation/widgets/scanner_controls_bar.dart b/app/lib/features/scanner/presentation/widgets/scanner_controls_bar.dart index f1d3220..053c0ae 100644 --- a/app/lib/features/scanner/presentation/widgets/scanner_controls_bar.dart +++ b/app/lib/features/scanner/presentation/widgets/scanner_controls_bar.dart @@ -1,4 +1,5 @@ import 'package:flutter/material.dart'; +import '../../../../core/l10n/l10n_extensions.dart'; import '../../../../core/theme/app_theme.dart'; import '../../domain/entities/scan_aim_mode.dart'; @@ -80,12 +81,13 @@ class _FreezeButton extends StatelessWidget { @override Widget build(BuildContext context) { + final l10n = context.l10n; final hasCodes = liveBarcodeCount > 0; final label = isPendingFreeze - ? 'In attesa dei codici… Tocca per annullare' + ? l10n.waitingForCodesCancel : hasCodes - ? 'Blocca frame ($liveBarcodeCount ${liveBarcodeCount == 1 ? 'codice' : 'codici'})' - : 'Blocca e scegli'; + ? l10n.freezeFrameCount(liveBarcodeCount) + : l10n.freezeAndPick; return SizedBox( width: double.infinity, @@ -247,14 +249,15 @@ class _ManualActionPill extends StatelessWidget { width: 1, ), ), - child: const Row( + child: Row( mainAxisSize: MainAxisSize.min, children: [ - Icon(Icons.keyboard_rounded, color: AppTheme.primary, size: 18), - SizedBox(width: 6), + const Icon(Icons.keyboard_rounded, + color: AppTheme.primary, size: 18), + const SizedBox(width: 6), Text( - 'Manuale', - style: TextStyle( + context.l10n.manualButton, + style: const TextStyle( fontSize: 12.5, fontWeight: FontWeight.w700, color: AppTheme.darkTextPrimary, @@ -293,19 +296,19 @@ class _AimModeSelector extends StatelessWidget { children: [ _ModeTab( icon: Icons.qr_code_scanner_rounded, - label: ScanAimMode.standard.label, + label: ScanAimMode.standard.localizedLabel(context.l10n), selected: selectedMode == ScanAimMode.standard, onTap: () => onChanged(ScanAimMode.standard), ), _ModeTab( icon: Icons.gps_fixed_rounded, - label: ScanAimMode.precision.label, + label: ScanAimMode.precision.localizedLabel(context.l10n), selected: selectedMode == ScanAimMode.precision, onTap: () => onChanged(ScanAimMode.precision), ), _ModeTab( icon: Icons.view_in_ar_rounded, - label: ScanAimMode.arMulti.label, + label: ScanAimMode.arMulti.localizedLabel(context.l10n), selected: selectedMode == ScanAimMode.arMulti, onTap: () => onChanged(ScanAimMode.arMulti), ), diff --git a/app/lib/features/scanner/presentation/widgets/scanner_overlay.dart b/app/lib/features/scanner/presentation/widgets/scanner_overlay.dart index a50536f..e59fd56 100644 --- a/app/lib/features/scanner/presentation/widgets/scanner_overlay.dart +++ b/app/lib/features/scanner/presentation/widgets/scanner_overlay.dart @@ -1,4 +1,5 @@ import 'package:flutter/material.dart'; +import '../../../../core/l10n/l10n_extensions.dart'; import '../../../../core/theme/app_theme.dart'; import '../../domain/entities/scan_aim_mode.dart'; import '../utils/barcode_geometry.dart'; @@ -223,8 +224,8 @@ class _ScannerOverlayState extends State ) : Text( isPrecision - ? 'Centra il mirino sul codice • Tocca per mettere a fuoco' - : 'Inquadra codice a barre o QR • Pizzica per zoomare', + ? context.l10n.precisionHelperText + : context.l10n.standardHelperText, textAlign: TextAlign.center, style: const TextStyle( color: Colors.white70, @@ -455,9 +456,10 @@ class _CooldownStatusPill extends StatelessWidget { duration: Duration(milliseconds: remainingMs), builder: (context, fraction, _) { final secsLeft = (fraction * totalMs / 1000.0).clamp(0.0, 99.9); + final secsText = secsLeft.toStringAsFixed(1); final label = succeeded - ? 'Inviato • Pausa ${secsLeft.toStringAsFixed(1)}s' - : 'Non inviato • Pausa ${secsLeft.toStringAsFixed(1)}s'; + ? context.l10n.cooldownSent(secsText) + : context.l10n.cooldownNotSent(secsText); return Container( padding: const EdgeInsets.symmetric(horizontal: 14, vertical: 8), diff --git a/app/lib/features/settings/data/datasources/settings_local_datasource.dart b/app/lib/features/settings/data/datasources/settings_local_datasource.dart index e7a6f1e..5e13370 100644 --- a/app/lib/features/settings/data/datasources/settings_local_datasource.dart +++ b/app/lib/features/settings/data/datasources/settings_local_datasource.dart @@ -22,6 +22,7 @@ class SettingsLocalDataSource { final aimMode = ScanAimMode.fromStorageKey( _prefs.getString(AppConstants.keyAimMode), ); + final languageCode = _prefs.getString(AppConstants.keyLanguageCode) ?? ''; return AppSettings( suffix: suffix, @@ -32,6 +33,7 @@ class SettingsLocalDataSource { autoConnect: autoConnect, inactivityTimeoutMinutes: inactivityTimeout, aimMode: aimMode, + languageCode: languageCode, ); } @@ -64,4 +66,8 @@ class SettingsLocalDataSource { Future saveAimMode(ScanAimMode mode) async { await _prefs.setString(AppConstants.keyAimMode, mode.storageKey); } + + Future saveLanguageCode(String languageCode) async { + await _prefs.setString(AppConstants.keyLanguageCode, languageCode); + } } diff --git a/app/lib/features/settings/data/repositories/settings_repository_impl.dart b/app/lib/features/settings/data/repositories/settings_repository_impl.dart index 09e9546..7a5468f 100644 --- a/app/lib/features/settings/data/repositories/settings_repository_impl.dart +++ b/app/lib/features/settings/data/repositories/settings_repository_impl.dart @@ -48,4 +48,9 @@ class SettingsRepositoryImpl implements SettingsRepository { Future saveAimMode(ScanAimMode mode) async { await _localDataSource.saveAimMode(mode); } + + @override + Future saveLanguageCode(String languageCode) async { + await _localDataSource.saveLanguageCode(languageCode); + } } diff --git a/app/lib/features/settings/domain/entities/app_settings.dart b/app/lib/features/settings/domain/entities/app_settings.dart index 8bd8489..3ee06f1 100644 --- a/app/lib/features/settings/domain/entities/app_settings.dart +++ b/app/lib/features/settings/domain/entities/app_settings.dart @@ -1,3 +1,5 @@ +import 'dart:ui'; + import 'package:equatable/equatable.dart'; import '../../../../core/constants/app_constants.dart'; import '../../../scanner/domain/entities/scan_aim_mode.dart'; @@ -11,6 +13,7 @@ class AppSettings extends Equatable { final bool autoConnect; // Default: false (ideal for multi-PC store) final int inactivityTimeoutMinutes; // Default: 5 or 10 min, 0 = disabled final ScanAimMode aimMode; + final String languageCode; // '' = system default, 'it', 'en' const AppSettings({ this.suffix = 'enter', @@ -21,8 +24,11 @@ class AppSettings extends Equatable { this.autoConnect = false, this.inactivityTimeoutMinutes = AppConstants.defaultInactivityTimeoutMinutes, this.aimMode = ScanAimMode.standard, + this.languageCode = '', }); + Locale? get locale => languageCode.isEmpty ? null : Locale(languageCode); + AppSettings copyWith({ String? suffix, bool? continuousMode, @@ -32,6 +38,7 @@ class AppSettings extends Equatable { bool? autoConnect, int? inactivityTimeoutMinutes, ScanAimMode? aimMode, + String? languageCode, }) { return AppSettings( suffix: suffix ?? this.suffix, @@ -43,6 +50,7 @@ class AppSettings extends Equatable { inactivityTimeoutMinutes: inactivityTimeoutMinutes ?? this.inactivityTimeoutMinutes, aimMode: aimMode ?? this.aimMode, + languageCode: languageCode ?? this.languageCode, ); } @@ -56,5 +64,6 @@ class AppSettings extends Equatable { autoConnect, inactivityTimeoutMinutes, aimMode, + languageCode, ]; } diff --git a/app/lib/features/settings/domain/repositories/settings_repository.dart b/app/lib/features/settings/domain/repositories/settings_repository.dart index d4463ab..d20bc34 100644 --- a/app/lib/features/settings/domain/repositories/settings_repository.dart +++ b/app/lib/features/settings/domain/repositories/settings_repository.dart @@ -10,4 +10,5 @@ abstract class SettingsRepository { Future saveAutoConnect(bool enabled); Future saveInactivityTimeout(int minutes); Future saveAimMode(ScanAimMode mode); + Future saveLanguageCode(String languageCode); } diff --git a/app/lib/features/settings/presentation/cubit/settings_cubit.dart b/app/lib/features/settings/presentation/cubit/settings_cubit.dart index 39a5f97..2c127a1 100644 --- a/app/lib/features/settings/presentation/cubit/settings_cubit.dart +++ b/app/lib/features/settings/presentation/cubit/settings_cubit.dart @@ -65,4 +65,10 @@ class SettingsCubit extends Cubit { emit(state.copyWith(settings: updated)); await _settingsRepository.saveAimMode(mode); } + + Future updateLanguageCode(String languageCode) async { + final updated = state.settings.copyWith(languageCode: languageCode); + emit(state.copyWith(settings: updated)); + await _settingsRepository.saveLanguageCode(languageCode); + } } diff --git a/app/lib/features/settings/presentation/screens/settings_screen.dart b/app/lib/features/settings/presentation/screens/settings_screen.dart index c8a4c81..ca03607 100644 --- a/app/lib/features/settings/presentation/screens/settings_screen.dart +++ b/app/lib/features/settings/presentation/screens/settings_screen.dart @@ -1,6 +1,7 @@ import 'package:flutter/material.dart'; import 'package:flutter_bloc/flutter_bloc.dart'; import '../../../../core/constants/app_constants.dart'; +import '../../../../core/l10n/l10n_extensions.dart'; import '../../../../core/theme/app_theme.dart'; import '../../../connection/presentation/cubit/connection_cubit.dart'; import '../../../connection/presentation/cubit/connection_state.dart'; @@ -8,6 +9,7 @@ import '../../../connection/presentation/screens/connect_screen.dart'; import '../../../connection/presentation/widgets/server_selection_sheet.dart'; import '../../../monetization/presentation/cubit/monetization_cubit.dart'; import '../../../monetization/presentation/cubit/monetization_state.dart'; +import '../../../monetization/presentation/widgets/paywall_sheet.dart'; import '../../../scanner/domain/entities/scan_aim_mode.dart'; import '../cubit/settings_cubit.dart'; import '../cubit/settings_state.dart'; @@ -17,9 +19,10 @@ class SettingsScreen extends StatelessWidget { @override Widget build(BuildContext context) { + final l10n = context.l10n; return Scaffold( appBar: AppBar( - title: const Text('Impostazioni'), + title: Text(l10n.settingsTitle), ), body: BlocBuilder( builder: (context, settingsState) { @@ -29,7 +32,7 @@ class SettingsScreen extends StatelessWidget { padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 12), children: [ // Subscription & Premium Section (RevenueCat) - const _SectionHeader(title: 'PIANO & ABBONAMENTO'), + _SectionHeader(title: l10n.sectionPlanSubscription), BlocBuilder( builder: (context, monState) { final isPremium = monState.isPremium; @@ -57,42 +60,42 @@ class SettingsScreen extends StatelessWidget { ), ), title: Text( - isPremium ? 'Piano Premium Attivo' : 'Versione Base Gratuita', + isPremium + ? l10n.premiumPlanActive + : l10n.freeBaseVersion, style: const TextStyle(fontWeight: FontWeight.w600), ), subtitle: Text( isPremium - ? 'Scansioni illimitate e zero pubblicità' + ? l10n.unlimitedAndAdFree : (monState.isUnlimited - ? 'Sessione attiva: ${monState.formattedRemainingTime}' - : '${monState.freeScansRemaining} scansioni libere rimanenti'), + ? l10n.activeSessionLabel( + monState.formattedRemainingTime) + : l10n.freeScansRemaining( + monState.freeScansRemaining)), ), trailing: isPremium ? OutlinedButton( - onPressed: () => context - .read() - .presentCustomerCenter(), - child: const Text('Gestisci'), + onPressed: () => + PaywallSheet.showPremiumManageDialog( + context), + child: Text(l10n.manageButton), ) : FilledButton( - onPressed: () => context - .read() - .presentPaywall(), + onPressed: () => PaywallSheet.show(context), style: FilledButton.styleFrom( backgroundColor: const Color(0xFFFBBF24), foregroundColor: Colors.black87, ), - child: const Text('Passa a Premium'), + child: Text(l10n.upgradePremiumShort), ), ), if (!isPremium) ...[ const Divider(height: 1), ListTile( leading: const Icon(Icons.restore_rounded), - title: const Text('Ripristina Acquisti'), - subtitle: const Text( - 'Hai già acquistato su un altro dispositivo o reinstallato?', - ), + title: Text(l10n.restorePurchasesTitle), + subtitle: Text(l10n.restorePurchasesSubtitle), onTap: () async { final restored = await context .read() @@ -102,8 +105,8 @@ class SettingsScreen extends StatelessWidget { SnackBar( content: Text( restored - ? 'Acquisti ripristinati con successo!' - : 'Nessun acquisto attivo trovato da ripristinare.', + ? l10n.restorePurchasesSuccess + : l10n.restorePurchasesEmpty, ), backgroundColor: restored ? AppTheme.success @@ -122,7 +125,7 @@ class SettingsScreen extends StatelessWidget { const SizedBox(height: 14), // PC Connection Section - const _SectionHeader(title: 'CONNESSIONE PC & NEGOZIO'), + _SectionHeader(title: l10n.sectionPcConnection), Card( child: Column( children: [ @@ -148,13 +151,14 @@ class SettingsScreen extends StatelessWidget { size: 22, ), ), - title: const Text('Stato Postazione'), + title: Text(l10n.workstationStatusTitle), subtitle: Text( isConnected - ? 'Connesso a ${connState.info.displayName}' + ? l10n.connectedToName( + connState.info.displayName) : (connState.info.isConfigured - ? 'Non connesso (${connState.info.ip})' - : 'Nessun PC configurato'), + ? l10n.notConnectedWithIp(connState.info.ip) + : l10n.noPcConfigured), style: const TextStyle(fontSize: 13), ), trailing: const Icon(Icons.chevron_right_rounded), @@ -184,11 +188,11 @@ class SettingsScreen extends StatelessWidget { child: const Icon(Icons.storefront_rounded, color: AppTheme.primary, size: 22), ), - title: const Text('Postazioni PC Preferite'), + title: Text(l10n.favoriteWorkstationsTitle), subtitle: Text( count > 0 - ? '$count computer registrati nel negozio' - : 'Nessun computer salvato', + ? l10n.registeredComputersCount(count) + : l10n.noComputersSaved, style: const TextStyle(fontSize: 13), ), trailing: const Icon(Icons.chevron_right_rounded), @@ -211,13 +215,14 @@ class SettingsScreen extends StatelessWidget { child: const Icon(Icons.flash_auto_rounded, color: AppTheme.secondary, size: 22), ), - title: const Text( - 'Autocollegamento all\'avvio/risveglio', - style: TextStyle(fontSize: 14, fontWeight: FontWeight.w600), + title: Text( + l10n.autoConnectFullTitle, + style: const TextStyle( + fontSize: 14, fontWeight: FontWeight.w600), ), - subtitle: const Text( - 'Disattivato: chiede sempre a quale PC connettersi (evita di sparare codici sul PC del collega)', - style: TextStyle(fontSize: 12), + subtitle: Text( + l10n.autoConnectFullSubtitle, + style: const TextStyle(fontSize: 12), ), value: settings.autoConnect, onChanged: (val) { @@ -237,14 +242,16 @@ class SettingsScreen extends StatelessWidget { child: const Icon(Icons.timer_outlined, color: AppTheme.warning, size: 22), ), - title: const Text( - 'Disconnessione per inattività', - style: TextStyle(fontSize: 14, fontWeight: FontWeight.w600), + title: Text( + l10n.inactivityDisconnectTitle, + style: const TextStyle( + fontSize: 14, fontWeight: FontWeight.w600), ), subtitle: Text( settings.inactivityTimeoutMinutes > 0 - ? 'Interrompe la connessione dopo ${settings.inactivityTimeoutMinutes} minuti senza scansioni' - : 'Disattivata (rimane sempre connesso)', + ? l10n.inactivityDisconnectActive( + settings.inactivityTimeoutMinutes) + : l10n.inactivityDisconnectOff, style: const TextStyle(fontSize: 12), ), trailing: DropdownButton( @@ -254,11 +261,15 @@ class SettingsScreen extends StatelessWidget { color: AppTheme.darkTextPrimary, fontWeight: FontWeight.bold), underline: const SizedBox.shrink(), - items: const [ - DropdownMenuItem(value: 5, child: Text('5 min (Consigliato)')), - DropdownMenuItem(value: 10, child: Text('10 min')), - DropdownMenuItem(value: 15, child: Text('15 min')), - DropdownMenuItem(value: 0, child: Text('Disattivata')), + items: [ + DropdownMenuItem( + value: 5, child: Text(l10n.inactivity5Min)), + DropdownMenuItem( + value: 10, child: Text(l10n.inactivity10Min)), + DropdownMenuItem( + value: 15, child: Text(l10n.inactivity15Min)), + DropdownMenuItem( + value: 0, child: Text(l10n.disabledOption)), ], onChanged: (val) { if (val != null) { @@ -285,10 +296,10 @@ class SettingsScreen extends StatelessWidget { child: const Icon(Icons.send_rounded, color: AppTheme.primary, size: 22), ), - title: const Text('Invia Test di Digitazione'), - subtitle: const Text( - 'Digita "TEST-CATELLI-123" sul PC attivo', - style: TextStyle(fontSize: 13), + title: Text(l10n.sendTypingTestTitle), + subtitle: Text( + l10n.sendTypingTestSubtitle, + style: const TextStyle(fontSize: 13), ), onTap: () { context.read().sendCode( @@ -296,9 +307,9 @@ class SettingsScreen extends StatelessWidget { suffix: settings.suffix, ); ScaffoldMessenger.of(context).showSnackBar( - const SnackBar( - content: Text('Test di digitazione inviato al PC!'), - duration: Duration(seconds: 1), + SnackBar( + content: Text(l10n.typingTestSentSnackbar), + duration: const Duration(seconds: 1), backgroundColor: AppTheme.darkCard, ), ); @@ -311,14 +322,13 @@ class SettingsScreen extends StatelessWidget { const SizedBox(height: 24), // Keyboard Emulation Section - const _SectionHeader(title: 'EMULAZIONE TASTIERA PC'), + _SectionHeader(title: l10n.sectionKeyboardEmulation), Card( child: Column( children: [ _RadioOption( - title: 'Tasto Invio (Enter)', - subtitle: - 'Preme Invio dopo ogni codice (consigliato per Excel, ERP, gestionali)', + title: l10n.suffixEnterTitle, + subtitle: l10n.suffixEnterSubtitle, isSelected: settings.suffix == AppConstants.suffixEnter, onTap: () { context @@ -328,8 +338,8 @@ class SettingsScreen extends StatelessWidget { ), const Divider(height: 1), _RadioOption( - title: 'Tasto Tabulatore (Tab)', - subtitle: 'Sposta il cursore al campo/cella successiva', + title: l10n.suffixTabTitle, + subtitle: l10n.suffixTabSubtitle, isSelected: settings.suffix == AppConstants.suffixTab, onTap: () { context @@ -339,8 +349,8 @@ class SettingsScreen extends StatelessWidget { ), const Divider(height: 1), _RadioOption( - title: 'Nessun tasto finale', - subtitle: 'Scrive solo la stringa pura del codice a barre', + title: l10n.suffixNoneTitle, + subtitle: l10n.suffixNoneSubtitle, isSelected: settings.suffix == AppConstants.suffixNone, onTap: () { context @@ -355,7 +365,7 @@ class SettingsScreen extends StatelessWidget { const SizedBox(height: 24), // Scan & Feedback Section - const _SectionHeader(title: 'SCANSIONE E FEEDBACK'), + _SectionHeader(title: l10n.sectionScanFeedback), Card( child: Column( children: [ @@ -369,10 +379,10 @@ class SettingsScreen extends StatelessWidget { child: const Icon(Icons.gps_fixed_rounded, color: AppTheme.primary, size: 22), ), - title: const Text('Modalità di mira'), - subtitle: const Text( - 'Standard, Precisione (mirino + zoom) o AR Multi-Codice', - style: TextStyle(fontSize: 12), + title: Text(l10n.aimModeTitle), + subtitle: Text( + l10n.aimModeSubtitle, + style: const TextStyle(fontSize: 12), ), trailing: DropdownButton( value: settings.aimMode, @@ -386,7 +396,7 @@ class SettingsScreen extends StatelessWidget { for (final mode in ScanAimMode.values) DropdownMenuItem( value: mode, - child: Text(mode.label), + child: Text(mode.localizedLabel(l10n)), ), ], onChanged: (mode) { @@ -407,9 +417,11 @@ class SettingsScreen extends StatelessWidget { child: const Icon(Icons.hourglass_bottom_rounded, color: AppTheme.primary, size: 22), ), - title: const Text('Pausa dopo scansione'), + title: Text(l10n.postScanPauseTitle), subtitle: Text( - 'Attesa di ${(settings.scanCooldownMs / 1000).toStringAsFixed(1).replaceAll('.', ',')}s prima della prossima lettura', + l10n.postScanPauseSubtitle( + (settings.scanCooldownMs / 1000).toStringAsFixed(1), + ), style: const TextStyle(fontSize: 12), ), trailing: DropdownButton( @@ -420,13 +432,19 @@ class SettingsScreen extends StatelessWidget { fontWeight: FontWeight.bold, ), underline: const SizedBox.shrink(), - items: const [ - DropdownMenuItem(value: 1000, child: Text('1,0 sec (Rapida)')), - DropdownMenuItem(value: 2000, child: Text('2,0 sec')), - DropdownMenuItem(value: 2500, child: Text('2,5 sec (Consigliata)')), - DropdownMenuItem(value: 3000, child: Text('3,0 sec')), - DropdownMenuItem(value: 4000, child: Text('4,0 sec')), - DropdownMenuItem(value: 5000, child: Text('5,0 sec')), + items: [ + DropdownMenuItem( + value: 1000, child: Text(l10n.cooldown1s)), + DropdownMenuItem( + value: 2000, child: Text(l10n.cooldown2s)), + DropdownMenuItem( + value: 2500, child: Text(l10n.cooldown25s)), + DropdownMenuItem( + value: 3000, child: Text(l10n.cooldown3s)), + DropdownMenuItem( + value: 4000, child: Text(l10n.cooldown4s)), + DropdownMenuItem( + value: 5000, child: Text(l10n.cooldown5s)), ], onChanged: (val) { if (val != null) { @@ -448,10 +466,10 @@ class SettingsScreen extends StatelessWidget { child: const Icon(Icons.repeat_rounded, color: AppTheme.primary, size: 22), ), - title: const Text('Scansione Continua'), - subtitle: const Text( - 'Riduce la pausa a 1,0s quando inquadri codici diversi in serie', - style: TextStyle(fontSize: 12), + title: Text(l10n.continuousScanTitle), + subtitle: Text( + l10n.continuousScanSubtitle, + style: const TextStyle(fontSize: 12), ), value: settings.continuousMode, onChanged: (val) { @@ -469,10 +487,10 @@ class SettingsScreen extends StatelessWidget { child: const Icon(Icons.vibration_rounded, color: AppTheme.primary, size: 22), ), - title: const Text('Vibrazione alla lettura'), - subtitle: const Text( - 'Feedback aptico alla decodifica del codice', - style: TextStyle(fontSize: 13), + title: Text(l10n.vibrationTitle), + subtitle: Text( + l10n.vibrationSubtitle, + style: const TextStyle(fontSize: 13), ), value: settings.vibrate, onChanged: (val) { @@ -492,10 +510,10 @@ class SettingsScreen extends StatelessWidget { child: const Icon(Icons.volume_up_rounded, color: AppTheme.primary, size: 22), ), - title: const Text('Suono di conferma'), - subtitle: const Text( - 'Segnale acustico alla lettura del barcode', - style: TextStyle(fontSize: 13), + title: Text(l10n.soundTitle), + subtitle: Text( + l10n.soundSubtitle, + style: const TextStyle(fontSize: 13), ), value: settings.sound, onChanged: (val) { @@ -508,8 +526,55 @@ class SettingsScreen extends StatelessWidget { const SizedBox(height: 24), + // Language Section + _SectionHeader(title: l10n.sectionLanguage), + Card( + child: ListTile( + leading: Container( + padding: const EdgeInsets.all(8), + decoration: BoxDecoration( + color: AppTheme.primary.withValues(alpha: 0.15), + borderRadius: BorderRadius.circular(8), + ), + child: const Icon(Icons.language_rounded, + color: AppTheme.primary, size: 22), + ), + title: Text(l10n.languageTitle), + trailing: DropdownButton( + value: settings.languageCode, + dropdownColor: AppTheme.darkCard, + style: const TextStyle( + color: AppTheme.darkTextPrimary, + fontWeight: FontWeight.bold, + ), + underline: const SizedBox.shrink(), + items: [ + DropdownMenuItem( + value: '', + child: Text(l10n.languageSystem), + ), + DropdownMenuItem( + value: 'it', + child: Text(l10n.languageItalian), + ), + DropdownMenuItem( + value: 'en', + child: Text(l10n.languageEnglish), + ), + ], + onChanged: (code) { + if (code != null) { + context.read().updateLanguageCode(code); + } + }, + ), + ), + ), + + const SizedBox(height: 24), + // Info Section - const _SectionHeader(title: 'INFORMAZIONI'), + _SectionHeader(title: l10n.sectionInfo), Card( child: Column( children: [ @@ -523,7 +588,7 @@ class SettingsScreen extends StatelessWidget { child: const Icon(Icons.business_rounded, color: AppTheme.primary, size: 22), ), - title: const Text('Organizzazione'), + title: Text(l10n.organizationTitle), subtitle: const Text(AppConstants.organization, style: TextStyle(fontSize: 13)), ), @@ -538,7 +603,7 @@ class SettingsScreen extends StatelessWidget { child: const Icon(Icons.info_outline_rounded, color: AppTheme.primary, size: 22), ), - title: const Text('Versione App'), + title: Text(l10n.appVersionTitle), subtitle: const Text( '${AppConstants.appVersion} (Flutter Clean Architecture & Cubit)', style: TextStyle(fontSize: 13), diff --git a/app/lib/l10n/app_en.arb b/app/lib/l10n/app_en.arb new file mode 100644 index 0000000..cde1b72 --- /dev/null +++ b/app/lib/l10n/app_en.arb @@ -0,0 +1,314 @@ +{ + "@@locale": "en", + "appTitle": "Catelli Barcode Reader", + "cancel": "Cancel", + "remove": "Remove", + "connect": "Connect", + "reconnect": "Reconnect", + "active": "Active", + "activeUppercase": "ACTIVE", + "connected": "Connected", + "connecting": "Connecting...", + "notConnected": "Not connected", + "pinOrNetworkError": "PIN/Network error", + "defaultStorePcName": "Store PC", + "defaultPcServerName": "PC Server", + "enterValidIp": "Enter a valid PC IP address", + "connectingToHost": "Connecting to {ip}:{port}...", + "@connectingToHost": { + "placeholders": { + "ip": { "type": "String" }, + "port": { "type": "int" } + } + }, + "connectingToName": "Connecting to {name}...", + "@connectingToName": { + "placeholders": { + "name": { "type": "String" } + } + }, + "pcConnectionsTitle": "PC Workstations Connection", + "scanPcQrCode": "Scan QR Code on PC", + "savedStoreWorkstations": "Saved Store Workstations", + "favoritesCount": "{count, plural, =1{1 favorite} other{{count} favorites}}", + "@favoritesCount": { + "placeholders": { + "count": { "type": "int" } + } + }, + "detectedWifiPcs": "PCs Detected on Wi-Fi", + "refreshDiscoveryTooltip": "Refresh scan", + "searchingPcServers": "Searching for PC servers on the network...", + "noPcServersFound": "No PC server detected automatically on the network.\nMake sure the PC companion app is running and connected to the same Wi-Fi.", + "requiresPin": "Requires PIN", + "withPin": "With PIN", + "manualSetup": "Manual Configuration", + "workstationNameLabel": "Workstation / PC Name (optional)", + "workstationNameHint": "e.g. Register 1, Warehouse, Office", + "pcIpLabel": "PC IP Address", + "pcIpHint": "e.g. 192.168.1.100", + "portLabel": "Port", + "pinOptionalLabel": "PIN (if set)", + "pinHint": "PIN code", + "saveAndConnectManually": "Save and Connect Manually", + "disconnectFromPc": "Disconnect from PC", + "disconnectedByInactivity": "Disconnected due to inactivity", + "disconnectedManually": "Manually disconnected", + "qrModalTitle": "Scan Server QR Code", + "qrModalSubtitle": "Point the camera at the QR code shown in the PC companion app.", + "removeWorkstationTitle": "Remove workstation?", + "removeWorkstationMessage": "Do you want to remove \"{name}\" ({ip}) from favorite PCs?", + "@removeWorkstationMessage": { + "placeholders": { + "name": { "type": "String" }, + "ip": { "type": "String" } + } + }, + "selectPcWorkstation": "Select PC Workstation", + "selectPcSubtitle": "Choose the computer where codes will be typed", + "inactivityAlert": "Disconnected due to inactivity. Select a workstation before scanning.", + "noFavoritePcs": "No favorite PC saved", + "noFavoritePcsHint": "Add your store computers to connect with 1 tap and avoid typing on a colleague's PC.", + "removeFavoriteTooltip": "Remove from favorites", + "addNewPcButton": "Add New PC (Wi-Fi or QR Code)", + "autoConnectOnStartup": "Auto-connect on startup", + "autoConnectSubtitleShort": "Disabled: asks to pick a PC (recommended in multi-PC stores)", + "unlimitedScansTitle": "Unlimited Scans", + "unlimitedScansDescription": "Watch a short video to unlock 15 minutes of uninterrupted unlimited PC scanning.", + "unlocked15MinSnackbar": "15 minutes of unlimited scans unlocked!", + "loadingVideoRetrySnackbar": "Loading video... Please try again in a moment.", + "loadingVideoButton": "Loading video...", + "watchVideoButton": "Watch Video (+15 min)", + "welcomePremiumSnackbar": "Welcome to Unlimited Premium!", + "upgradeToPremiumButton": "Upgrade to Unlimited Premium", + "laterButton": "Later", + "sentToPcSnackbar": "Sent to PC: {code}", + "@sentToPcSnackbar": { + "placeholders": { + "code": { "type": "String" } + } + }, + "savedToHistoryOfflineSnackbar": "Code saved to history (PC not connected)", + "torchTooltip": "Flashlight", + "switchCameraTooltip": "Switch Camera", + "historyTooltip": "History", + "settingsTooltip": "Settings", + "premiumBadge": "Premium", + "unlimitedSessionLabel": "{time} Unlimited", + "@unlimitedSessionLabel": { + "placeholders": { + "time": { "type": "String" } + } + }, + "freeScansShort": "{count} free", + "@freeScansShort": { + "placeholders": { + "count": { "type": "int" } + } + }, + "unlock15Min": "Unlock 15 min", + "aimModeStandard": "Standard", + "aimModePrecision": "Precision", + "aimModeArMulti": "AR Multi", + "waitingForCodesCancel": "Waiting for codes… Tap to cancel", + "freezeFrameCount": "{count, plural, =1{Freeze frame (1 code)} other{Freeze frame ({count} codes)}}", + "@freezeFrameCount": { + "placeholders": { + "count": { "type": "int" } + } + }, + "freezeAndPick": "Freeze & pick", + "manualButton": "Manual", + "manualFormat": "Manual", + "manualInputTitle": "Manual Entry", + "manualInputSubtitle": "Type or paste the code to send directly to the PC:", + "manualInputHint": "e.g. 8001234567890 or ART-99", + "pasteFromClipboardTooltip": "Paste from clipboard", + "sendToPcButton": "Send to PC", + "precisionHelperText": "Center crosshair on code • Tap to focus", + "standardHelperText": "Frame barcode or QR • Pinch to zoom", + "cooldownSent": "Sent • Pause {seconds}s", + "@cooldownSent": { + "placeholders": { + "seconds": { "type": "String" } + } + }, + "cooldownNotSent": "Not sent • Pause {seconds}s", + "@cooldownNotSent": { + "placeholders": { + "seconds": { "type": "String" } + } + }, + "notSent": "Not sent", + "copyTooltip": "Copy", + "codeCopiedSnackbar": "Code copied to clipboard", + "resendToPcTooltip": "Send to PC again", + "frozenFrameCount": "{count, plural, =1{Frozen frame • 1 code} other{Frozen frame • {count} codes}}", + "@frozenFrameCount": { + "placeholders": { + "count": { "type": "int" } + } + }, + "resumeButton": "Resume", + "tapCodeToSend": "Tap a code to send it to the PC", + "newScanButton": "New scan", + "sentLabel": "Sent", + "sendLabel": "Send", + "clearHistoryTitle": "Clear History?", + "clearHistoryMessage": "All codes saved in history on this device will be removed.", + "clearAllButton": "Clear All", + "scanHistoryTitle": "Scan History", + "clearHistoryTooltip": "Clear history", + "searchCodesHint": "Search codes...", + "noScansInHistory": "No scans in history", + "noResultsForQuery": "No results for \"{query}\"", + "@noResultsForQuery": { + "placeholders": { + "query": { "type": "String" } + } + }, + "copyCodeTooltip": "Copy code", + "copiedToClipboardSnackbar": "Copied to clipboard", + "resentCodeSnackbar": "Sent \"{code}\" to PC", + "@resentCodeSnackbar": { + "placeholders": { + "code": { "type": "String" } + } + }, + "settingsTitle": "Settings", + "sectionPlanSubscription": "PLAN & SUBSCRIPTION", + "premiumPlanActive": "Premium Plan Active", + "freeBaseVersion": "Free Basic Version", + "unlimitedAndAdFree": "Unlimited scans and zero ads", + "activeSessionLabel": "Active session: {time}", + "@activeSessionLabel": { + "placeholders": { + "time": { "type": "String" } + } + }, + "freeScansRemaining": "{count, plural, =1{1 free scan remaining} other{{count} free scans remaining}}", + "@freeScansRemaining": { + "placeholders": { + "count": { "type": "int" } + } + }, + "manageButton": "Manage", + "upgradePremiumShort": "Go Premium", + "restorePurchasesTitle": "Restore Purchases", + "restorePurchasesSubtitle": "Already purchased on another device or reinstalled?", + "restorePurchasesSuccess": "Purchases restored successfully!", + "restorePurchasesEmpty": "No active purchases found to restore.", + "sectionPcConnection": "PC & STORE CONNECTION", + "workstationStatusTitle": "Workstation Status", + "connectedToName": "Connected to {name}", + "@connectedToName": { + "placeholders": { + "name": { "type": "String" } + } + }, + "notConnectedWithIp": "Not connected ({ip})", + "@notConnectedWithIp": { + "placeholders": { + "ip": { "type": "String" } + } + }, + "noPcConfigured": "No PC configured", + "favoriteWorkstationsTitle": "Favorite PC Workstations", + "registeredComputersCount": "{count, plural, =1{1 computer saved} other{{count} computers saved}}", + "@registeredComputersCount": { + "placeholders": { + "count": { "type": "int" } + } + }, + "noComputersSaved": "No computers saved", + "autoConnectFullTitle": "Auto-connect on startup/resume", + "autoConnectFullSubtitle": "Disabled: always asks which PC to connect to (prevents typing on a colleague's PC)", + "inactivityDisconnectTitle": "Inactivity disconnect", + "inactivityDisconnectActive": "Disconnects after {minutes} minutes without scans", + "@inactivityDisconnectActive": { + "placeholders": { + "minutes": { "type": "int" } + } + }, + "inactivityDisconnectOff": "Disabled (stays connected)", + "inactivity5Min": "5 min (Recommended)", + "inactivity10Min": "10 min", + "inactivity15Min": "15 min", + "disabledOption": "Disabled", + "sendTypingTestTitle": "Send Typing Test", + "sendTypingTestSubtitle": "Types \"TEST-CATELLI-123\" on the active PC", + "typingTestSentSnackbar": "Typing test sent to PC!", + "sectionKeyboardEmulation": "PC KEYBOARD EMULATION", + "suffixEnterTitle": "Enter Key", + "suffixEnterSubtitle": "Presses Enter after each code (recommended for Excel, ERP, POS)", + "suffixTabTitle": "Tab Key", + "suffixTabSubtitle": "Moves cursor to the next field/cell", + "suffixNoneTitle": "No trailing key", + "suffixNoneSubtitle": "Types only the raw barcode string", + "sectionScanFeedback": "SCANNING & FEEDBACK", + "aimModeTitle": "Aiming mode", + "aimModeSubtitle": "Standard, Precision (crosshair + zoom), or AR Multi-Code", + "postScanPauseTitle": "Post-scan pause", + "postScanPauseSubtitle": "Wait {seconds}s before the next reading", + "@postScanPauseSubtitle": { + "placeholders": { + "seconds": { "type": "String" } + } + }, + "cooldown1s": "1.0 sec (Fast)", + "cooldown2s": "2.0 sec", + "cooldown25s": "2.5 sec (Recommended)", + "cooldown3s": "3.0 sec", + "cooldown4s": "4.0 sec", + "cooldown5s": "5.0 sec", + "continuousScanTitle": "Continuous Scanning", + "continuousScanSubtitle": "Reduces pause to 1.0s when scanning different codes in a row", + "vibrationTitle": "Vibrate on scan", + "vibrationSubtitle": "Haptic feedback when a code is decoded", + "soundTitle": "Confirmation sound", + "soundSubtitle": "Audio beep when a barcode is read", + "sectionLanguage": "LANGUAGE", + "languageTitle": "App Language", + "languageSystem": "System default", + "languageItalian": "Italiano", + "languageEnglish": "English", + "sectionInfo": "ABOUT", + "organizationTitle": "Organization", + "appVersionTitle": "App Version", + "paywallTitle": "Barcode Reader Premium", + "paywallSubtitle": "Unlock unlimited PC scanning with zero interruptions.", + "paywallBenefitUnlimited": "Unlimited barcode & QR scans forever", + "paywallBenefitNoAds": "Zero ads, no waiting timers", + "paywallBenefitAllModes": "Standard, Precision & AR Multi-Scan modes", + "paywallBenefitMultiPc": "Multi-PC favorites & instant Wi-Fi sync", + "paywallPlanYearly": "Yearly", + "paywallPlanMonthly": "Monthly", + "paywallPlanLifetime": "Lifetime", + "paywallPerYear": "/ year", + "paywallPerMonth": "/ month", + "paywallOneTime": "One-time purchase", + "paywallBestValue": "BEST VALUE", + "paywallSavePercent": "SAVE {percent}%", + "@paywallSavePercent": { + "placeholders": { + "percent": { "type": "int" } + } + }, + "paywallOneTimeBadge": "PAY ONCE", + "paywallContinueButton": "Continue", + "paywallContinueWithPrice": "Continue — {price}", + "@paywallContinueWithPrice": { + "placeholders": { + "price": { "type": "String" } + } + }, + "paywallLoadingPlans": "Loading available plans...", + "paywallUnavailableTitle": "Plans temporarily unavailable", + "paywallUnavailableSubtitle": "Check your internet connection or Google Play availability and try again.", + "paywallRetryButton": "Retry", + "paywallPurchaseError": "Purchase could not be completed. Please try again.", + "paywallLegalNote": "Subscriptions auto-renew unless cancelled at least 24 hours before the end of the period in Google Play settings.", + "premiumManageTitle": "Premium Active", + "premiumManageBody": "Your Unlimited Premium plan is active on this account.\n\nTo manage or cancel a subscription, open Google Play Store → Payments & subscriptions → Subscriptions.", + "closeButton": "Close" +} diff --git a/app/lib/l10n/app_it.arb b/app/lib/l10n/app_it.arb new file mode 100644 index 0000000..1997c9e --- /dev/null +++ b/app/lib/l10n/app_it.arb @@ -0,0 +1,202 @@ +{ + "@@locale": "it", + "appTitle": "Catelli Barcode Reader", + "cancel": "Annulla", + "remove": "Rimuovi", + "connect": "Connetti", + "reconnect": "Riconnetti", + "active": "Attivo", + "activeUppercase": "ATTIVO", + "connected": "Connesso", + "connecting": "Connessione...", + "notConnected": "Non connesso", + "pinOrNetworkError": "Errore PIN/Rete", + "defaultStorePcName": "PC Negozio", + "defaultPcServerName": "PC Server", + "enterValidIp": "Inserisci un indirizzo IP valido del PC", + "connectingToHost": "Connessione a {ip}:{port} in corso...", + "connectingToName": "Connessione a {name}...", + "pcConnectionsTitle": "Connessione Postazioni PC", + "scanPcQrCode": "Inquadra QR Code sul PC", + "savedStoreWorkstations": "Postazioni Salvate nel Negozio", + "favoritesCount": "{count, plural, =1{1 preferito} other{{count} preferiti}}", + "detectedWifiPcs": "PC Rilevati in Wi-Fi", + "refreshDiscoveryTooltip": "Aggiorna ricerca", + "searchingPcServers": "Ricerca server PC in corso sulla rete...", + "noPcServersFound": "Nessun server PC rilevato automaticamente sulla rete.\nAssicurati che il programma sul PC sia avviato e connesso allo stesso Wi-Fi.", + "requiresPin": "Richiede PIN", + "withPin": "Con PIN", + "manualSetup": "Configurazione Manuale", + "workstationNameLabel": "Nome Postazione / PC (opzionale)", + "workstationNameHint": "Es. Cassa 1, Magazzino, Ufficio", + "pcIpLabel": "Indirizzo IP del PC", + "pcIpHint": "Es. 192.168.1.100", + "portLabel": "Porta", + "pinOptionalLabel": "PIN (se impostato)", + "pinHint": "Codice PIN", + "saveAndConnectManually": "Salva e Connetti Manualmente", + "disconnectFromPc": "Disconnetti dal PC", + "disconnectedByInactivity": "Disconnesso per inattività", + "disconnectedManually": "Disconnesso manualmente", + "qrModalTitle": "Inquadra QR Code del Server", + "qrModalSubtitle": "Inquadra il codice QR mostrato nell'app companion sul PC.", + "removeWorkstationTitle": "Rimuovere postazione?", + "removeWorkstationMessage": "Vuoi eliminare \"{name}\" ({ip}) dai PC preferiti?", + "selectPcWorkstation": "Seleziona Postazione PC", + "selectPcSubtitle": "Scegli il computer del negozio su cui scrivere", + "inactivityAlert": "Disconnesso per inattività. Seleziona la postazione prima di scansionare.", + "noFavoritePcs": "Nessun PC preferito salvato", + "noFavoritePcsHint": "Aggiungi i computer del negozio per collegarti con 1 tocco ed evitare errori tra colleghi.", + "removeFavoriteTooltip": "Rimuovi dai preferiti", + "addNewPcButton": "Aggiungi Nuovo PC (Wi-Fi o QR Code)", + "autoConnectOnStartup": "Collega automaticamente all'avvio", + "autoConnectSubtitleShort": "Disattivato: richiede la selezione del PC (consigliato in negozio)", + "unlimitedScansTitle": "Scansioni Illimitate", + "unlimitedScansDescription": "Guarda un breve video per sbloccare 15 minuti di scansioni illimitate al PC senza interruzioni.", + "unlocked15MinSnackbar": "15 minuti di scansioni illimitate sbloccati!", + "loadingVideoRetrySnackbar": "Caricamento video in corso... Riprova tra pochi istanti.", + "loadingVideoButton": "Caricamento video...", + "watchVideoButton": "Guarda Video (+15 min)", + "welcomePremiumSnackbar": "Benvenuto in Premium Illimitato!", + "upgradeToPremiumButton": "Passa a Premium Illimitato", + "laterButton": "Più tardi", + "sentToPcSnackbar": "Inviato al PC: {code}", + "savedToHistoryOfflineSnackbar": "Codice salvato in cronologia (PC non connesso)", + "torchTooltip": "Torcia", + "switchCameraTooltip": "Inverti Fotocamera", + "historyTooltip": "Cronologia", + "settingsTooltip": "Impostazioni", + "premiumBadge": "Premium", + "unlimitedSessionLabel": "{time} Illimitati", + "freeScansShort": "{count} libere", + "unlock15Min": "Sblocca 15 min", + "aimModeStandard": "Standard", + "aimModePrecision": "Precisione", + "aimModeArMulti": "AR Multi", + "waitingForCodesCancel": "In attesa dei codici… Tocca per annullare", + "freezeFrameCount": "{count, plural, =1{Blocca frame (1 codice)} other{Blocca frame ({count} codici)}}", + "freezeAndPick": "Blocca e scegli", + "manualButton": "Manuale", + "manualFormat": "Manuale", + "manualInputTitle": "Digitazione Manuale", + "manualInputSubtitle": "Digita o incolla il codice da digitare in tempo reale sul PC:", + "manualInputHint": "Es. 8001234567890 o ART-99", + "pasteFromClipboardTooltip": "Incolla dagli appunti", + "sendToPcButton": "Invia al PC", + "precisionHelperText": "Centra il mirino sul codice • Tocca per mettere a fuoco", + "standardHelperText": "Inquadra codice a barre o QR • Pizzica per zoomare", + "cooldownSent": "Inviato • Pausa {seconds}s", + "cooldownNotSent": "Non inviato • Pausa {seconds}s", + "notSent": "Non inviato", + "copyTooltip": "Copia", + "codeCopiedSnackbar": "Codice copiato negli appunti", + "resendToPcTooltip": "Invia di nuovo al PC", + "frozenFrameCount": "{count, plural, =1{Frame bloccato • 1 codice} other{Frame bloccato • {count} codici}}", + "resumeButton": "Riprendi", + "tapCodeToSend": "Tocca un codice per inviarlo al PC", + "newScanButton": "Nuova scansione", + "sentLabel": "Inviato", + "sendLabel": "Invia", + "clearHistoryTitle": "Cancellare Cronologia?", + "clearHistoryMessage": "Tutti i codici salvati nella cronologia su questo dispositivo verranno rimossi.", + "clearAllButton": "Cancella Tutto", + "scanHistoryTitle": "Cronologia Scansioni", + "clearHistoryTooltip": "Cancella cronologia", + "searchCodesHint": "Cerca tra i codici...", + "noScansInHistory": "Nessuna scansione in memoria", + "noResultsForQuery": "Nessun risultato per \"{query}\"", + "copyCodeTooltip": "Copia codice", + "copiedToClipboardSnackbar": "Copiato negli appunti", + "resentCodeSnackbar": "Inviato \"{code}\" al PC", + "settingsTitle": "Impostazioni", + "sectionPlanSubscription": "PIANO & ABBONAMENTO", + "premiumPlanActive": "Piano Premium Attivo", + "freeBaseVersion": "Versione Base Gratuita", + "unlimitedAndAdFree": "Scansioni illimitate e zero pubblicità", + "activeSessionLabel": "Sessione attiva: {time}", + "freeScansRemaining": "{count, plural, =1{1 scansione libera rimanente} other{{count} scansioni libere rimanenti}}", + "manageButton": "Gestisci", + "upgradePremiumShort": "Passa a Premium", + "restorePurchasesTitle": "Ripristina Acquisti", + "restorePurchasesSubtitle": "Hai già acquistato su un altro dispositivo o reinstallato?", + "restorePurchasesSuccess": "Acquisti ripristinati con successo!", + "restorePurchasesEmpty": "Nessun acquisto attivo trovato da ripristinare.", + "sectionPcConnection": "CONNESSIONE PC & NEGOZIO", + "workstationStatusTitle": "Stato Postazione", + "connectedToName": "Connesso a {name}", + "notConnectedWithIp": "Non connesso ({ip})", + "noPcConfigured": "Nessun PC configurato", + "favoriteWorkstationsTitle": "Postazioni PC Preferite", + "registeredComputersCount": "{count, plural, =1{1 computer registrato nel negozio} other{{count} computer registrati nel negozio}}", + "noComputersSaved": "Nessun computer salvato", + "autoConnectFullTitle": "Autocollegamento all'avvio/risveglio", + "autoConnectFullSubtitle": "Disattivato: chiede sempre a quale PC connettersi (evita di sparare codici sul PC del collega)", + "inactivityDisconnectTitle": "Disconnessione per inattività", + "inactivityDisconnectActive": "Interrompe la connessione dopo {minutes} minuti senza scansioni", + "inactivityDisconnectOff": "Disattivata (rimane sempre connesso)", + "inactivity5Min": "5 min (Consigliato)", + "inactivity10Min": "10 min", + "inactivity15Min": "15 min", + "disabledOption": "Disattivata", + "sendTypingTestTitle": "Invia Test di Digitazione", + "sendTypingTestSubtitle": "Digita \"TEST-CATELLI-123\" sul PC attivo", + "typingTestSentSnackbar": "Test di digitazione inviato al PC!", + "sectionKeyboardEmulation": "EMULAZIONE TASTIERA PC", + "suffixEnterTitle": "Tasto Invio (Enter)", + "suffixEnterSubtitle": "Preme Invio dopo ogni codice (consigliato per Excel, ERP, gestionali)", + "suffixTabTitle": "Tasto Tabulatore (Tab)", + "suffixTabSubtitle": "Sposta il cursore al campo/cella successiva", + "suffixNoneTitle": "Nessun tasto finale", + "suffixNoneSubtitle": "Scrive solo la stringa pura del codice a barre", + "sectionScanFeedback": "SCANSIONE E FEEDBACK", + "aimModeTitle": "Modalità di mira", + "aimModeSubtitle": "Standard, Precisione (mirino + zoom) o AR Multi-Codice", + "postScanPauseTitle": "Pausa dopo scansione", + "postScanPauseSubtitle": "Attesa di {seconds}s prima della prossima lettura", + "cooldown1s": "1,0 sec (Rapida)", + "cooldown2s": "2,0 sec", + "cooldown25s": "2,5 sec (Consigliata)", + "cooldown3s": "3,0 sec", + "cooldown4s": "4,0 sec", + "cooldown5s": "5,0 sec", + "continuousScanTitle": "Scansione Continua", + "continuousScanSubtitle": "Riduce la pausa a 1,0s quando inquadri codici diversi in serie", + "vibrationTitle": "Vibrazione alla lettura", + "vibrationSubtitle": "Feedback aptico alla decodifica del codice", + "soundTitle": "Suono di conferma", + "soundSubtitle": "Segnale acustico alla lettura del barcode", + "sectionLanguage": "LINGUA", + "languageTitle": "Lingua App", + "languageSystem": "Predefinita di sistema", + "languageItalian": "Italiano", + "languageEnglish": "English", + "sectionInfo": "INFORMAZIONI", + "organizationTitle": "Organizzazione", + "appVersionTitle": "Versione App", + "paywallTitle": "Barcode Reader Premium", + "paywallSubtitle": "Sblocca scansioni illimitate verso il PC senza alcuna interruzione.", + "paywallBenefitUnlimited": "Scansioni barcode e QR illimitate per sempre", + "paywallBenefitNoAds": "Zero pubblicità e nessun timer di attesa", + "paywallBenefitAllModes": "Modalità Standard, Precisione e AR Multi-Codice", + "paywallBenefitMultiPc": "Postazioni multi-PC preferite e sincronizzazione Wi-Fi", + "paywallPlanYearly": "Annuale", + "paywallPlanMonthly": "Mensile", + "paywallPlanLifetime": "A Vita (Lifetime)", + "paywallPerYear": "/ anno", + "paywallPerMonth": "/ mese", + "paywallOneTime": "Acquisto una tantum", + "paywallBestValue": "PIÙ CONVENIENTE", + "paywallSavePercent": "RISPARMIA {percent}%", + "paywallOneTimeBadge": "PAGHI UNA VOLTA", + "paywallContinueButton": "Continua", + "paywallContinueWithPrice": "Continua — {price}", + "paywallLoadingPlans": "Caricamento piani disponibili...", + "paywallUnavailableTitle": "Piani momentaneamente non disponibili", + "paywallUnavailableSubtitle": "Verifica la connessione internet o la disponibilità di Google Play e riprova.", + "paywallRetryButton": "Riprova", + "paywallPurchaseError": "Impossibile completare l'acquisto. Riprova tra poco.", + "paywallLegalNote": "Gli abbonamenti si rinnovano automaticamente salvo disdetta almeno 24 ore prima della scadenza nelle impostazioni di Google Play.", + "premiumManageTitle": "Premium Attivo", + "premiumManageBody": "Il tuo piano Premium Illimitato è attivo su questo account.\n\nPer gestire o disdire un abbonamento, apri Google Play Store → Pagamenti e abbonamenti → Abbonamenti.", + "closeButton": "Chiudi" +} diff --git a/app/lib/l10n/generated/app_localizations.dart b/app/lib/l10n/generated/app_localizations.dart new file mode 100644 index 0000000..930f4a2 --- /dev/null +++ b/app/lib/l10n/generated/app_localizations.dart @@ -0,0 +1,1328 @@ +import 'dart:async'; + +import 'package:flutter/foundation.dart'; +import 'package:flutter/widgets.dart'; +import 'package:flutter_localizations/flutter_localizations.dart'; +import 'package:intl/intl.dart' as intl; + +import 'app_localizations_en.dart'; +import 'app_localizations_it.dart'; + +// ignore_for_file: type=lint + +/// Callers can lookup localized strings with an instance of AppLocalizations +/// returned by `AppLocalizations.of(context)`. +/// +/// Applications need to include `AppLocalizations.delegate()` in their app's +/// `localizationDelegates` list, and the locales they support in the app's +/// `supportedLocales` list. For example: +/// +/// ```dart +/// import 'generated/app_localizations.dart'; +/// +/// return MaterialApp( +/// localizationsDelegates: AppLocalizations.localizationsDelegates, +/// supportedLocales: AppLocalizations.supportedLocales, +/// home: MyApplicationHome(), +/// ); +/// ``` +/// +/// ## Update pubspec.yaml +/// +/// Please make sure to update your pubspec.yaml to include the following +/// packages: +/// +/// ```yaml +/// dependencies: +/// # Internationalization support. +/// flutter_localizations: +/// sdk: flutter +/// intl: any # Use the pinned version from flutter_localizations +/// +/// # Rest of dependencies +/// ``` +/// +/// ## iOS Applications +/// +/// iOS applications define key application metadata, including supported +/// locales, in an Info.plist file that is built into the application bundle. +/// To configure the locales supported by your app, you’ll need to edit this +/// file. +/// +/// First, open your project’s ios/Runner.xcworkspace Xcode workspace file. +/// Then, in the Project Navigator, open the Info.plist file under the Runner +/// project’s Runner folder. +/// +/// Next, select the Information Property List item, select Add Item from the +/// Editor menu, then select Localizations from the pop-up menu. +/// +/// Select and expand the newly-created Localizations item then, for each +/// locale your application supports, add a new item and select the locale +/// you wish to add from the pop-up menu in the Value field. This list should +/// be consistent with the languages listed in the AppLocalizations.supportedLocales +/// property. +abstract class AppLocalizations { + AppLocalizations(String locale) + : localeName = intl.Intl.canonicalizedLocale(locale.toString()); + + final String localeName; + + static AppLocalizations? of(BuildContext context) { + return Localizations.of(context, AppLocalizations); + } + + static const LocalizationsDelegate delegate = + _AppLocalizationsDelegate(); + + /// A list of this localizations delegate along with the default localizations + /// delegates. + /// + /// Returns a list of localizations delegates containing this delegate along with + /// GlobalMaterialLocalizations.delegate, GlobalCupertinoLocalizations.delegate, + /// and GlobalWidgetsLocalizations.delegate. + /// + /// Additional delegates can be added by appending to this list in + /// MaterialApp. This list does not have to be used at all if a custom list + /// of delegates is preferred or required. + static const List> localizationsDelegates = + >[ + delegate, + GlobalMaterialLocalizations.delegate, + GlobalCupertinoLocalizations.delegate, + GlobalWidgetsLocalizations.delegate, + ]; + + /// A list of this localizations delegate's supported locales. + static const List supportedLocales = [ + Locale('en'), + Locale('it'), + ]; + + /// No description provided for @appTitle. + /// + /// In en, this message translates to: + /// **'Catelli Barcode Reader'** + String get appTitle; + + /// No description provided for @cancel. + /// + /// In en, this message translates to: + /// **'Cancel'** + String get cancel; + + /// No description provided for @remove. + /// + /// In en, this message translates to: + /// **'Remove'** + String get remove; + + /// No description provided for @connect. + /// + /// In en, this message translates to: + /// **'Connect'** + String get connect; + + /// No description provided for @reconnect. + /// + /// In en, this message translates to: + /// **'Reconnect'** + String get reconnect; + + /// No description provided for @active. + /// + /// In en, this message translates to: + /// **'Active'** + String get active; + + /// No description provided for @activeUppercase. + /// + /// In en, this message translates to: + /// **'ACTIVE'** + String get activeUppercase; + + /// No description provided for @connected. + /// + /// In en, this message translates to: + /// **'Connected'** + String get connected; + + /// No description provided for @connecting. + /// + /// In en, this message translates to: + /// **'Connecting...'** + String get connecting; + + /// No description provided for @notConnected. + /// + /// In en, this message translates to: + /// **'Not connected'** + String get notConnected; + + /// No description provided for @pinOrNetworkError. + /// + /// In en, this message translates to: + /// **'PIN/Network error'** + String get pinOrNetworkError; + + /// No description provided for @defaultStorePcName. + /// + /// In en, this message translates to: + /// **'Store PC'** + String get defaultStorePcName; + + /// No description provided for @defaultPcServerName. + /// + /// In en, this message translates to: + /// **'PC Server'** + String get defaultPcServerName; + + /// No description provided for @enterValidIp. + /// + /// In en, this message translates to: + /// **'Enter a valid PC IP address'** + String get enterValidIp; + + /// No description provided for @connectingToHost. + /// + /// In en, this message translates to: + /// **'Connecting to {ip}:{port}...'** + String connectingToHost(String ip, int port); + + /// No description provided for @connectingToName. + /// + /// In en, this message translates to: + /// **'Connecting to {name}...'** + String connectingToName(String name); + + /// No description provided for @pcConnectionsTitle. + /// + /// In en, this message translates to: + /// **'PC Workstations Connection'** + String get pcConnectionsTitle; + + /// No description provided for @scanPcQrCode. + /// + /// In en, this message translates to: + /// **'Scan QR Code on PC'** + String get scanPcQrCode; + + /// No description provided for @savedStoreWorkstations. + /// + /// In en, this message translates to: + /// **'Saved Store Workstations'** + String get savedStoreWorkstations; + + /// No description provided for @favoritesCount. + /// + /// In en, this message translates to: + /// **'{count, plural, =1{1 favorite} other{{count} favorites}}'** + String favoritesCount(int count); + + /// No description provided for @detectedWifiPcs. + /// + /// In en, this message translates to: + /// **'PCs Detected on Wi-Fi'** + String get detectedWifiPcs; + + /// No description provided for @refreshDiscoveryTooltip. + /// + /// In en, this message translates to: + /// **'Refresh scan'** + String get refreshDiscoveryTooltip; + + /// No description provided for @searchingPcServers. + /// + /// In en, this message translates to: + /// **'Searching for PC servers on the network...'** + String get searchingPcServers; + + /// No description provided for @noPcServersFound. + /// + /// In en, this message translates to: + /// **'No PC server detected automatically on the network.\nMake sure the PC companion app is running and connected to the same Wi-Fi.'** + String get noPcServersFound; + + /// No description provided for @requiresPin. + /// + /// In en, this message translates to: + /// **'Requires PIN'** + String get requiresPin; + + /// No description provided for @withPin. + /// + /// In en, this message translates to: + /// **'With PIN'** + String get withPin; + + /// No description provided for @manualSetup. + /// + /// In en, this message translates to: + /// **'Manual Configuration'** + String get manualSetup; + + /// No description provided for @workstationNameLabel. + /// + /// In en, this message translates to: + /// **'Workstation / PC Name (optional)'** + String get workstationNameLabel; + + /// No description provided for @workstationNameHint. + /// + /// In en, this message translates to: + /// **'e.g. Register 1, Warehouse, Office'** + String get workstationNameHint; + + /// No description provided for @pcIpLabel. + /// + /// In en, this message translates to: + /// **'PC IP Address'** + String get pcIpLabel; + + /// No description provided for @pcIpHint. + /// + /// In en, this message translates to: + /// **'e.g. 192.168.1.100'** + String get pcIpHint; + + /// No description provided for @portLabel. + /// + /// In en, this message translates to: + /// **'Port'** + String get portLabel; + + /// No description provided for @pinOptionalLabel. + /// + /// In en, this message translates to: + /// **'PIN (if set)'** + String get pinOptionalLabel; + + /// No description provided for @pinHint. + /// + /// In en, this message translates to: + /// **'PIN code'** + String get pinHint; + + /// No description provided for @saveAndConnectManually. + /// + /// In en, this message translates to: + /// **'Save and Connect Manually'** + String get saveAndConnectManually; + + /// No description provided for @disconnectFromPc. + /// + /// In en, this message translates to: + /// **'Disconnect from PC'** + String get disconnectFromPc; + + /// No description provided for @disconnectedByInactivity. + /// + /// In en, this message translates to: + /// **'Disconnected due to inactivity'** + String get disconnectedByInactivity; + + /// No description provided for @disconnectedManually. + /// + /// In en, this message translates to: + /// **'Manually disconnected'** + String get disconnectedManually; + + /// No description provided for @qrModalTitle. + /// + /// In en, this message translates to: + /// **'Scan Server QR Code'** + String get qrModalTitle; + + /// No description provided for @qrModalSubtitle. + /// + /// In en, this message translates to: + /// **'Point the camera at the QR code shown in the PC companion app.'** + String get qrModalSubtitle; + + /// No description provided for @removeWorkstationTitle. + /// + /// In en, this message translates to: + /// **'Remove workstation?'** + String get removeWorkstationTitle; + + /// No description provided for @removeWorkstationMessage. + /// + /// In en, this message translates to: + /// **'Do you want to remove \"{name}\" ({ip}) from favorite PCs?'** + String removeWorkstationMessage(String name, String ip); + + /// No description provided for @selectPcWorkstation. + /// + /// In en, this message translates to: + /// **'Select PC Workstation'** + String get selectPcWorkstation; + + /// No description provided for @selectPcSubtitle. + /// + /// In en, this message translates to: + /// **'Choose the computer where codes will be typed'** + String get selectPcSubtitle; + + /// No description provided for @inactivityAlert. + /// + /// In en, this message translates to: + /// **'Disconnected due to inactivity. Select a workstation before scanning.'** + String get inactivityAlert; + + /// No description provided for @noFavoritePcs. + /// + /// In en, this message translates to: + /// **'No favorite PC saved'** + String get noFavoritePcs; + + /// No description provided for @noFavoritePcsHint. + /// + /// In en, this message translates to: + /// **'Add your store computers to connect with 1 tap and avoid typing on a colleague\'s PC.'** + String get noFavoritePcsHint; + + /// No description provided for @removeFavoriteTooltip. + /// + /// In en, this message translates to: + /// **'Remove from favorites'** + String get removeFavoriteTooltip; + + /// No description provided for @addNewPcButton. + /// + /// In en, this message translates to: + /// **'Add New PC (Wi-Fi or QR Code)'** + String get addNewPcButton; + + /// No description provided for @autoConnectOnStartup. + /// + /// In en, this message translates to: + /// **'Auto-connect on startup'** + String get autoConnectOnStartup; + + /// No description provided for @autoConnectSubtitleShort. + /// + /// In en, this message translates to: + /// **'Disabled: asks to pick a PC (recommended in multi-PC stores)'** + String get autoConnectSubtitleShort; + + /// No description provided for @unlimitedScansTitle. + /// + /// In en, this message translates to: + /// **'Unlimited Scans'** + String get unlimitedScansTitle; + + /// No description provided for @unlimitedScansDescription. + /// + /// In en, this message translates to: + /// **'Watch a short video to unlock 15 minutes of uninterrupted unlimited PC scanning.'** + String get unlimitedScansDescription; + + /// No description provided for @unlocked15MinSnackbar. + /// + /// In en, this message translates to: + /// **'15 minutes of unlimited scans unlocked!'** + String get unlocked15MinSnackbar; + + /// No description provided for @loadingVideoRetrySnackbar. + /// + /// In en, this message translates to: + /// **'Loading video... Please try again in a moment.'** + String get loadingVideoRetrySnackbar; + + /// No description provided for @loadingVideoButton. + /// + /// In en, this message translates to: + /// **'Loading video...'** + String get loadingVideoButton; + + /// No description provided for @watchVideoButton. + /// + /// In en, this message translates to: + /// **'Watch Video (+15 min)'** + String get watchVideoButton; + + /// No description provided for @welcomePremiumSnackbar. + /// + /// In en, this message translates to: + /// **'Welcome to Unlimited Premium!'** + String get welcomePremiumSnackbar; + + /// No description provided for @upgradeToPremiumButton. + /// + /// In en, this message translates to: + /// **'Upgrade to Unlimited Premium'** + String get upgradeToPremiumButton; + + /// No description provided for @laterButton. + /// + /// In en, this message translates to: + /// **'Later'** + String get laterButton; + + /// No description provided for @sentToPcSnackbar. + /// + /// In en, this message translates to: + /// **'Sent to PC: {code}'** + String sentToPcSnackbar(String code); + + /// No description provided for @savedToHistoryOfflineSnackbar. + /// + /// In en, this message translates to: + /// **'Code saved to history (PC not connected)'** + String get savedToHistoryOfflineSnackbar; + + /// No description provided for @torchTooltip. + /// + /// In en, this message translates to: + /// **'Flashlight'** + String get torchTooltip; + + /// No description provided for @switchCameraTooltip. + /// + /// In en, this message translates to: + /// **'Switch Camera'** + String get switchCameraTooltip; + + /// No description provided for @historyTooltip. + /// + /// In en, this message translates to: + /// **'History'** + String get historyTooltip; + + /// No description provided for @settingsTooltip. + /// + /// In en, this message translates to: + /// **'Settings'** + String get settingsTooltip; + + /// No description provided for @premiumBadge. + /// + /// In en, this message translates to: + /// **'Premium'** + String get premiumBadge; + + /// No description provided for @unlimitedSessionLabel. + /// + /// In en, this message translates to: + /// **'{time} Unlimited'** + String unlimitedSessionLabel(String time); + + /// No description provided for @freeScansShort. + /// + /// In en, this message translates to: + /// **'{count} free'** + String freeScansShort(int count); + + /// No description provided for @unlock15Min. + /// + /// In en, this message translates to: + /// **'Unlock 15 min'** + String get unlock15Min; + + /// No description provided for @aimModeStandard. + /// + /// In en, this message translates to: + /// **'Standard'** + String get aimModeStandard; + + /// No description provided for @aimModePrecision. + /// + /// In en, this message translates to: + /// **'Precision'** + String get aimModePrecision; + + /// No description provided for @aimModeArMulti. + /// + /// In en, this message translates to: + /// **'AR Multi'** + String get aimModeArMulti; + + /// No description provided for @waitingForCodesCancel. + /// + /// In en, this message translates to: + /// **'Waiting for codes… Tap to cancel'** + String get waitingForCodesCancel; + + /// No description provided for @freezeFrameCount. + /// + /// In en, this message translates to: + /// **'{count, plural, =1{Freeze frame (1 code)} other{Freeze frame ({count} codes)}}'** + String freezeFrameCount(int count); + + /// No description provided for @freezeAndPick. + /// + /// In en, this message translates to: + /// **'Freeze & pick'** + String get freezeAndPick; + + /// No description provided for @manualButton. + /// + /// In en, this message translates to: + /// **'Manual'** + String get manualButton; + + /// No description provided for @manualFormat. + /// + /// In en, this message translates to: + /// **'Manual'** + String get manualFormat; + + /// No description provided for @manualInputTitle. + /// + /// In en, this message translates to: + /// **'Manual Entry'** + String get manualInputTitle; + + /// No description provided for @manualInputSubtitle. + /// + /// In en, this message translates to: + /// **'Type or paste the code to send directly to the PC:'** + String get manualInputSubtitle; + + /// No description provided for @manualInputHint. + /// + /// In en, this message translates to: + /// **'e.g. 8001234567890 or ART-99'** + String get manualInputHint; + + /// No description provided for @pasteFromClipboardTooltip. + /// + /// In en, this message translates to: + /// **'Paste from clipboard'** + String get pasteFromClipboardTooltip; + + /// No description provided for @sendToPcButton. + /// + /// In en, this message translates to: + /// **'Send to PC'** + String get sendToPcButton; + + /// No description provided for @precisionHelperText. + /// + /// In en, this message translates to: + /// **'Center crosshair on code • Tap to focus'** + String get precisionHelperText; + + /// No description provided for @standardHelperText. + /// + /// In en, this message translates to: + /// **'Frame barcode or QR • Pinch to zoom'** + String get standardHelperText; + + /// No description provided for @cooldownSent. + /// + /// In en, this message translates to: + /// **'Sent • Pause {seconds}s'** + String cooldownSent(String seconds); + + /// No description provided for @cooldownNotSent. + /// + /// In en, this message translates to: + /// **'Not sent • Pause {seconds}s'** + String cooldownNotSent(String seconds); + + /// No description provided for @notSent. + /// + /// In en, this message translates to: + /// **'Not sent'** + String get notSent; + + /// No description provided for @copyTooltip. + /// + /// In en, this message translates to: + /// **'Copy'** + String get copyTooltip; + + /// No description provided for @codeCopiedSnackbar. + /// + /// In en, this message translates to: + /// **'Code copied to clipboard'** + String get codeCopiedSnackbar; + + /// No description provided for @resendToPcTooltip. + /// + /// In en, this message translates to: + /// **'Send to PC again'** + String get resendToPcTooltip; + + /// No description provided for @frozenFrameCount. + /// + /// In en, this message translates to: + /// **'{count, plural, =1{Frozen frame • 1 code} other{Frozen frame • {count} codes}}'** + String frozenFrameCount(int count); + + /// No description provided for @resumeButton. + /// + /// In en, this message translates to: + /// **'Resume'** + String get resumeButton; + + /// No description provided for @tapCodeToSend. + /// + /// In en, this message translates to: + /// **'Tap a code to send it to the PC'** + String get tapCodeToSend; + + /// No description provided for @newScanButton. + /// + /// In en, this message translates to: + /// **'New scan'** + String get newScanButton; + + /// No description provided for @sentLabel. + /// + /// In en, this message translates to: + /// **'Sent'** + String get sentLabel; + + /// No description provided for @sendLabel. + /// + /// In en, this message translates to: + /// **'Send'** + String get sendLabel; + + /// No description provided for @clearHistoryTitle. + /// + /// In en, this message translates to: + /// **'Clear History?'** + String get clearHistoryTitle; + + /// No description provided for @clearHistoryMessage. + /// + /// In en, this message translates to: + /// **'All codes saved in history on this device will be removed.'** + String get clearHistoryMessage; + + /// No description provided for @clearAllButton. + /// + /// In en, this message translates to: + /// **'Clear All'** + String get clearAllButton; + + /// No description provided for @scanHistoryTitle. + /// + /// In en, this message translates to: + /// **'Scan History'** + String get scanHistoryTitle; + + /// No description provided for @clearHistoryTooltip. + /// + /// In en, this message translates to: + /// **'Clear history'** + String get clearHistoryTooltip; + + /// No description provided for @searchCodesHint. + /// + /// In en, this message translates to: + /// **'Search codes...'** + String get searchCodesHint; + + /// No description provided for @noScansInHistory. + /// + /// In en, this message translates to: + /// **'No scans in history'** + String get noScansInHistory; + + /// No description provided for @noResultsForQuery. + /// + /// In en, this message translates to: + /// **'No results for \"{query}\"'** + String noResultsForQuery(String query); + + /// No description provided for @copyCodeTooltip. + /// + /// In en, this message translates to: + /// **'Copy code'** + String get copyCodeTooltip; + + /// No description provided for @copiedToClipboardSnackbar. + /// + /// In en, this message translates to: + /// **'Copied to clipboard'** + String get copiedToClipboardSnackbar; + + /// No description provided for @resentCodeSnackbar. + /// + /// In en, this message translates to: + /// **'Sent \"{code}\" to PC'** + String resentCodeSnackbar(String code); + + /// No description provided for @settingsTitle. + /// + /// In en, this message translates to: + /// **'Settings'** + String get settingsTitle; + + /// No description provided for @sectionPlanSubscription. + /// + /// In en, this message translates to: + /// **'PLAN & SUBSCRIPTION'** + String get sectionPlanSubscription; + + /// No description provided for @premiumPlanActive. + /// + /// In en, this message translates to: + /// **'Premium Plan Active'** + String get premiumPlanActive; + + /// No description provided for @freeBaseVersion. + /// + /// In en, this message translates to: + /// **'Free Basic Version'** + String get freeBaseVersion; + + /// No description provided for @unlimitedAndAdFree. + /// + /// In en, this message translates to: + /// **'Unlimited scans and zero ads'** + String get unlimitedAndAdFree; + + /// No description provided for @activeSessionLabel. + /// + /// In en, this message translates to: + /// **'Active session: {time}'** + String activeSessionLabel(String time); + + /// No description provided for @freeScansRemaining. + /// + /// In en, this message translates to: + /// **'{count, plural, =1{1 free scan remaining} other{{count} free scans remaining}}'** + String freeScansRemaining(int count); + + /// No description provided for @manageButton. + /// + /// In en, this message translates to: + /// **'Manage'** + String get manageButton; + + /// No description provided for @upgradePremiumShort. + /// + /// In en, this message translates to: + /// **'Go Premium'** + String get upgradePremiumShort; + + /// No description provided for @restorePurchasesTitle. + /// + /// In en, this message translates to: + /// **'Restore Purchases'** + String get restorePurchasesTitle; + + /// No description provided for @restorePurchasesSubtitle. + /// + /// In en, this message translates to: + /// **'Already purchased on another device or reinstalled?'** + String get restorePurchasesSubtitle; + + /// No description provided for @restorePurchasesSuccess. + /// + /// In en, this message translates to: + /// **'Purchases restored successfully!'** + String get restorePurchasesSuccess; + + /// No description provided for @restorePurchasesEmpty. + /// + /// In en, this message translates to: + /// **'No active purchases found to restore.'** + String get restorePurchasesEmpty; + + /// No description provided for @sectionPcConnection. + /// + /// In en, this message translates to: + /// **'PC & STORE CONNECTION'** + String get sectionPcConnection; + + /// No description provided for @workstationStatusTitle. + /// + /// In en, this message translates to: + /// **'Workstation Status'** + String get workstationStatusTitle; + + /// No description provided for @connectedToName. + /// + /// In en, this message translates to: + /// **'Connected to {name}'** + String connectedToName(String name); + + /// No description provided for @notConnectedWithIp. + /// + /// In en, this message translates to: + /// **'Not connected ({ip})'** + String notConnectedWithIp(String ip); + + /// No description provided for @noPcConfigured. + /// + /// In en, this message translates to: + /// **'No PC configured'** + String get noPcConfigured; + + /// No description provided for @favoriteWorkstationsTitle. + /// + /// In en, this message translates to: + /// **'Favorite PC Workstations'** + String get favoriteWorkstationsTitle; + + /// No description provided for @registeredComputersCount. + /// + /// In en, this message translates to: + /// **'{count, plural, =1{1 computer saved} other{{count} computers saved}}'** + String registeredComputersCount(int count); + + /// No description provided for @noComputersSaved. + /// + /// In en, this message translates to: + /// **'No computers saved'** + String get noComputersSaved; + + /// No description provided for @autoConnectFullTitle. + /// + /// In en, this message translates to: + /// **'Auto-connect on startup/resume'** + String get autoConnectFullTitle; + + /// No description provided for @autoConnectFullSubtitle. + /// + /// In en, this message translates to: + /// **'Disabled: always asks which PC to connect to (prevents typing on a colleague\'s PC)'** + String get autoConnectFullSubtitle; + + /// No description provided for @inactivityDisconnectTitle. + /// + /// In en, this message translates to: + /// **'Inactivity disconnect'** + String get inactivityDisconnectTitle; + + /// No description provided for @inactivityDisconnectActive. + /// + /// In en, this message translates to: + /// **'Disconnects after {minutes} minutes without scans'** + String inactivityDisconnectActive(int minutes); + + /// No description provided for @inactivityDisconnectOff. + /// + /// In en, this message translates to: + /// **'Disabled (stays connected)'** + String get inactivityDisconnectOff; + + /// No description provided for @inactivity5Min. + /// + /// In en, this message translates to: + /// **'5 min (Recommended)'** + String get inactivity5Min; + + /// No description provided for @inactivity10Min. + /// + /// In en, this message translates to: + /// **'10 min'** + String get inactivity10Min; + + /// No description provided for @inactivity15Min. + /// + /// In en, this message translates to: + /// **'15 min'** + String get inactivity15Min; + + /// No description provided for @disabledOption. + /// + /// In en, this message translates to: + /// **'Disabled'** + String get disabledOption; + + /// No description provided for @sendTypingTestTitle. + /// + /// In en, this message translates to: + /// **'Send Typing Test'** + String get sendTypingTestTitle; + + /// No description provided for @sendTypingTestSubtitle. + /// + /// In en, this message translates to: + /// **'Types \"TEST-CATELLI-123\" on the active PC'** + String get sendTypingTestSubtitle; + + /// No description provided for @typingTestSentSnackbar. + /// + /// In en, this message translates to: + /// **'Typing test sent to PC!'** + String get typingTestSentSnackbar; + + /// No description provided for @sectionKeyboardEmulation. + /// + /// In en, this message translates to: + /// **'PC KEYBOARD EMULATION'** + String get sectionKeyboardEmulation; + + /// No description provided for @suffixEnterTitle. + /// + /// In en, this message translates to: + /// **'Enter Key'** + String get suffixEnterTitle; + + /// No description provided for @suffixEnterSubtitle. + /// + /// In en, this message translates to: + /// **'Presses Enter after each code (recommended for Excel, ERP, POS)'** + String get suffixEnterSubtitle; + + /// No description provided for @suffixTabTitle. + /// + /// In en, this message translates to: + /// **'Tab Key'** + String get suffixTabTitle; + + /// No description provided for @suffixTabSubtitle. + /// + /// In en, this message translates to: + /// **'Moves cursor to the next field/cell'** + String get suffixTabSubtitle; + + /// No description provided for @suffixNoneTitle. + /// + /// In en, this message translates to: + /// **'No trailing key'** + String get suffixNoneTitle; + + /// No description provided for @suffixNoneSubtitle. + /// + /// In en, this message translates to: + /// **'Types only the raw barcode string'** + String get suffixNoneSubtitle; + + /// No description provided for @sectionScanFeedback. + /// + /// In en, this message translates to: + /// **'SCANNING & FEEDBACK'** + String get sectionScanFeedback; + + /// No description provided for @aimModeTitle. + /// + /// In en, this message translates to: + /// **'Aiming mode'** + String get aimModeTitle; + + /// No description provided for @aimModeSubtitle. + /// + /// In en, this message translates to: + /// **'Standard, Precision (crosshair + zoom), or AR Multi-Code'** + String get aimModeSubtitle; + + /// No description provided for @postScanPauseTitle. + /// + /// In en, this message translates to: + /// **'Post-scan pause'** + String get postScanPauseTitle; + + /// No description provided for @postScanPauseSubtitle. + /// + /// In en, this message translates to: + /// **'Wait {seconds}s before the next reading'** + String postScanPauseSubtitle(String seconds); + + /// No description provided for @cooldown1s. + /// + /// In en, this message translates to: + /// **'1.0 sec (Fast)'** + String get cooldown1s; + + /// No description provided for @cooldown2s. + /// + /// In en, this message translates to: + /// **'2.0 sec'** + String get cooldown2s; + + /// No description provided for @cooldown25s. + /// + /// In en, this message translates to: + /// **'2.5 sec (Recommended)'** + String get cooldown25s; + + /// No description provided for @cooldown3s. + /// + /// In en, this message translates to: + /// **'3.0 sec'** + String get cooldown3s; + + /// No description provided for @cooldown4s. + /// + /// In en, this message translates to: + /// **'4.0 sec'** + String get cooldown4s; + + /// No description provided for @cooldown5s. + /// + /// In en, this message translates to: + /// **'5.0 sec'** + String get cooldown5s; + + /// No description provided for @continuousScanTitle. + /// + /// In en, this message translates to: + /// **'Continuous Scanning'** + String get continuousScanTitle; + + /// No description provided for @continuousScanSubtitle. + /// + /// In en, this message translates to: + /// **'Reduces pause to 1.0s when scanning different codes in a row'** + String get continuousScanSubtitle; + + /// No description provided for @vibrationTitle. + /// + /// In en, this message translates to: + /// **'Vibrate on scan'** + String get vibrationTitle; + + /// No description provided for @vibrationSubtitle. + /// + /// In en, this message translates to: + /// **'Haptic feedback when a code is decoded'** + String get vibrationSubtitle; + + /// No description provided for @soundTitle. + /// + /// In en, this message translates to: + /// **'Confirmation sound'** + String get soundTitle; + + /// No description provided for @soundSubtitle. + /// + /// In en, this message translates to: + /// **'Audio beep when a barcode is read'** + String get soundSubtitle; + + /// No description provided for @sectionLanguage. + /// + /// In en, this message translates to: + /// **'LANGUAGE'** + String get sectionLanguage; + + /// No description provided for @languageTitle. + /// + /// In en, this message translates to: + /// **'App Language'** + String get languageTitle; + + /// No description provided for @languageSystem. + /// + /// In en, this message translates to: + /// **'System default'** + String get languageSystem; + + /// No description provided for @languageItalian. + /// + /// In en, this message translates to: + /// **'Italiano'** + String get languageItalian; + + /// No description provided for @languageEnglish. + /// + /// In en, this message translates to: + /// **'English'** + String get languageEnglish; + + /// No description provided for @sectionInfo. + /// + /// In en, this message translates to: + /// **'ABOUT'** + String get sectionInfo; + + /// No description provided for @organizationTitle. + /// + /// In en, this message translates to: + /// **'Organization'** + String get organizationTitle; + + /// No description provided for @appVersionTitle. + /// + /// In en, this message translates to: + /// **'App Version'** + String get appVersionTitle; + + /// No description provided for @paywallTitle. + /// + /// In en, this message translates to: + /// **'Barcode Reader Premium'** + String get paywallTitle; + + /// No description provided for @paywallSubtitle. + /// + /// In en, this message translates to: + /// **'Unlock unlimited PC scanning with zero interruptions.'** + String get paywallSubtitle; + + /// No description provided for @paywallBenefitUnlimited. + /// + /// In en, this message translates to: + /// **'Unlimited barcode & QR scans forever'** + String get paywallBenefitUnlimited; + + /// No description provided for @paywallBenefitNoAds. + /// + /// In en, this message translates to: + /// **'Zero ads, no waiting timers'** + String get paywallBenefitNoAds; + + /// No description provided for @paywallBenefitAllModes. + /// + /// In en, this message translates to: + /// **'Standard, Precision & AR Multi-Scan modes'** + String get paywallBenefitAllModes; + + /// No description provided for @paywallBenefitMultiPc. + /// + /// In en, this message translates to: + /// **'Multi-PC favorites & instant Wi-Fi sync'** + String get paywallBenefitMultiPc; + + /// No description provided for @paywallPlanYearly. + /// + /// In en, this message translates to: + /// **'Yearly'** + String get paywallPlanYearly; + + /// No description provided for @paywallPlanMonthly. + /// + /// In en, this message translates to: + /// **'Monthly'** + String get paywallPlanMonthly; + + /// No description provided for @paywallPlanLifetime. + /// + /// In en, this message translates to: + /// **'Lifetime'** + String get paywallPlanLifetime; + + /// No description provided for @paywallPerYear. + /// + /// In en, this message translates to: + /// **'/ year'** + String get paywallPerYear; + + /// No description provided for @paywallPerMonth. + /// + /// In en, this message translates to: + /// **'/ month'** + String get paywallPerMonth; + + /// No description provided for @paywallOneTime. + /// + /// In en, this message translates to: + /// **'One-time purchase'** + String get paywallOneTime; + + /// No description provided for @paywallBestValue. + /// + /// In en, this message translates to: + /// **'BEST VALUE'** + String get paywallBestValue; + + /// No description provided for @paywallSavePercent. + /// + /// In en, this message translates to: + /// **'SAVE {percent}%'** + String paywallSavePercent(int percent); + + /// No description provided for @paywallOneTimeBadge. + /// + /// In en, this message translates to: + /// **'PAY ONCE'** + String get paywallOneTimeBadge; + + /// No description provided for @paywallContinueButton. + /// + /// In en, this message translates to: + /// **'Continue'** + String get paywallContinueButton; + + /// No description provided for @paywallContinueWithPrice. + /// + /// In en, this message translates to: + /// **'Continue — {price}'** + String paywallContinueWithPrice(String price); + + /// No description provided for @paywallLoadingPlans. + /// + /// In en, this message translates to: + /// **'Loading available plans...'** + String get paywallLoadingPlans; + + /// No description provided for @paywallUnavailableTitle. + /// + /// In en, this message translates to: + /// **'Plans temporarily unavailable'** + String get paywallUnavailableTitle; + + /// No description provided for @paywallUnavailableSubtitle. + /// + /// In en, this message translates to: + /// **'Check your internet connection or Google Play availability and try again.'** + String get paywallUnavailableSubtitle; + + /// No description provided for @paywallRetryButton. + /// + /// In en, this message translates to: + /// **'Retry'** + String get paywallRetryButton; + + /// No description provided for @paywallPurchaseError. + /// + /// In en, this message translates to: + /// **'Purchase could not be completed. Please try again.'** + String get paywallPurchaseError; + + /// No description provided for @paywallLegalNote. + /// + /// In en, this message translates to: + /// **'Subscriptions auto-renew unless cancelled at least 24 hours before the end of the period in Google Play settings.'** + String get paywallLegalNote; + + /// No description provided for @premiumManageTitle. + /// + /// In en, this message translates to: + /// **'Premium Active'** + String get premiumManageTitle; + + /// No description provided for @premiumManageBody. + /// + /// In en, this message translates to: + /// **'Your Unlimited Premium plan is active on this account.\n\nTo manage or cancel a subscription, open Google Play Store → Payments & subscriptions → Subscriptions.'** + String get premiumManageBody; + + /// No description provided for @closeButton. + /// + /// In en, this message translates to: + /// **'Close'** + String get closeButton; +} + +class _AppLocalizationsDelegate + extends LocalizationsDelegate { + const _AppLocalizationsDelegate(); + + @override + Future load(Locale locale) { + return SynchronousFuture(lookupAppLocalizations(locale)); + } + + @override + bool isSupported(Locale locale) => + ['en', 'it'].contains(locale.languageCode); + + @override + bool shouldReload(_AppLocalizationsDelegate old) => false; +} + +AppLocalizations lookupAppLocalizations(Locale locale) { + // Lookup logic when only language code is specified. + switch (locale.languageCode) { + case 'en': + return AppLocalizationsEn(); + case 'it': + return AppLocalizationsIt(); + } + + throw FlutterError( + 'AppLocalizations.delegate failed to load unsupported locale "$locale". This is likely ' + 'an issue with the localizations generation tool. Please file an issue ' + 'on GitHub with a reproducible sample app and the gen-l10n configuration ' + 'that was used.', + ); +} diff --git a/app/lib/l10n/generated/app_localizations_en.dart b/app/lib/l10n/generated/app_localizations_en.dart new file mode 100644 index 0000000..856e90e --- /dev/null +++ b/app/lib/l10n/generated/app_localizations_en.dart @@ -0,0 +1,705 @@ +// ignore: unused_import +import 'package:intl/intl.dart' as intl; + +import 'app_localizations.dart'; + +// ignore_for_file: type=lint + +/// The translations for English (`en`). +class AppLocalizationsEn extends AppLocalizations { + AppLocalizationsEn([String locale = 'en']) : super(locale); + + @override + String get appTitle => 'Catelli Barcode Reader'; + + @override + String get cancel => 'Cancel'; + + @override + String get remove => 'Remove'; + + @override + String get connect => 'Connect'; + + @override + String get reconnect => 'Reconnect'; + + @override + String get active => 'Active'; + + @override + String get activeUppercase => 'ACTIVE'; + + @override + String get connected => 'Connected'; + + @override + String get connecting => 'Connecting...'; + + @override + String get notConnected => 'Not connected'; + + @override + String get pinOrNetworkError => 'PIN/Network error'; + + @override + String get defaultStorePcName => 'Store PC'; + + @override + String get defaultPcServerName => 'PC Server'; + + @override + String get enterValidIp => 'Enter a valid PC IP address'; + + @override + String connectingToHost(String ip, int port) { + return 'Connecting to $ip:$port...'; + } + + @override + String connectingToName(String name) { + return 'Connecting to $name...'; + } + + @override + String get pcConnectionsTitle => 'PC Workstations Connection'; + + @override + String get scanPcQrCode => 'Scan QR Code on PC'; + + @override + String get savedStoreWorkstations => 'Saved Store Workstations'; + + @override + String favoritesCount(int count) { + String _temp0 = intl.Intl.pluralLogic( + count, + locale: localeName, + other: '$count favorites', + one: '1 favorite', + ); + return '$_temp0'; + } + + @override + String get detectedWifiPcs => 'PCs Detected on Wi-Fi'; + + @override + String get refreshDiscoveryTooltip => 'Refresh scan'; + + @override + String get searchingPcServers => 'Searching for PC servers on the network...'; + + @override + String get noPcServersFound => + 'No PC server detected automatically on the network.\nMake sure the PC companion app is running and connected to the same Wi-Fi.'; + + @override + String get requiresPin => 'Requires PIN'; + + @override + String get withPin => 'With PIN'; + + @override + String get manualSetup => 'Manual Configuration'; + + @override + String get workstationNameLabel => 'Workstation / PC Name (optional)'; + + @override + String get workstationNameHint => 'e.g. Register 1, Warehouse, Office'; + + @override + String get pcIpLabel => 'PC IP Address'; + + @override + String get pcIpHint => 'e.g. 192.168.1.100'; + + @override + String get portLabel => 'Port'; + + @override + String get pinOptionalLabel => 'PIN (if set)'; + + @override + String get pinHint => 'PIN code'; + + @override + String get saveAndConnectManually => 'Save and Connect Manually'; + + @override + String get disconnectFromPc => 'Disconnect from PC'; + + @override + String get disconnectedByInactivity => 'Disconnected due to inactivity'; + + @override + String get disconnectedManually => 'Manually disconnected'; + + @override + String get qrModalTitle => 'Scan Server QR Code'; + + @override + String get qrModalSubtitle => + 'Point the camera at the QR code shown in the PC companion app.'; + + @override + String get removeWorkstationTitle => 'Remove workstation?'; + + @override + String removeWorkstationMessage(String name, String ip) { + return 'Do you want to remove \"$name\" ($ip) from favorite PCs?'; + } + + @override + String get selectPcWorkstation => 'Select PC Workstation'; + + @override + String get selectPcSubtitle => + 'Choose the computer where codes will be typed'; + + @override + String get inactivityAlert => + 'Disconnected due to inactivity. Select a workstation before scanning.'; + + @override + String get noFavoritePcs => 'No favorite PC saved'; + + @override + String get noFavoritePcsHint => + 'Add your store computers to connect with 1 tap and avoid typing on a colleague\'s PC.'; + + @override + String get removeFavoriteTooltip => 'Remove from favorites'; + + @override + String get addNewPcButton => 'Add New PC (Wi-Fi or QR Code)'; + + @override + String get autoConnectOnStartup => 'Auto-connect on startup'; + + @override + String get autoConnectSubtitleShort => + 'Disabled: asks to pick a PC (recommended in multi-PC stores)'; + + @override + String get unlimitedScansTitle => 'Unlimited Scans'; + + @override + String get unlimitedScansDescription => + 'Watch a short video to unlock 15 minutes of uninterrupted unlimited PC scanning.'; + + @override + String get unlocked15MinSnackbar => '15 minutes of unlimited scans unlocked!'; + + @override + String get loadingVideoRetrySnackbar => + 'Loading video... Please try again in a moment.'; + + @override + String get loadingVideoButton => 'Loading video...'; + + @override + String get watchVideoButton => 'Watch Video (+15 min)'; + + @override + String get welcomePremiumSnackbar => 'Welcome to Unlimited Premium!'; + + @override + String get upgradeToPremiumButton => 'Upgrade to Unlimited Premium'; + + @override + String get laterButton => 'Later'; + + @override + String sentToPcSnackbar(String code) { + return 'Sent to PC: $code'; + } + + @override + String get savedToHistoryOfflineSnackbar => + 'Code saved to history (PC not connected)'; + + @override + String get torchTooltip => 'Flashlight'; + + @override + String get switchCameraTooltip => 'Switch Camera'; + + @override + String get historyTooltip => 'History'; + + @override + String get settingsTooltip => 'Settings'; + + @override + String get premiumBadge => 'Premium'; + + @override + String unlimitedSessionLabel(String time) { + return '$time Unlimited'; + } + + @override + String freeScansShort(int count) { + return '$count free'; + } + + @override + String get unlock15Min => 'Unlock 15 min'; + + @override + String get aimModeStandard => 'Standard'; + + @override + String get aimModePrecision => 'Precision'; + + @override + String get aimModeArMulti => 'AR Multi'; + + @override + String get waitingForCodesCancel => 'Waiting for codes… Tap to cancel'; + + @override + String freezeFrameCount(int count) { + String _temp0 = intl.Intl.pluralLogic( + count, + locale: localeName, + other: 'Freeze frame ($count codes)', + one: 'Freeze frame (1 code)', + ); + return '$_temp0'; + } + + @override + String get freezeAndPick => 'Freeze & pick'; + + @override + String get manualButton => 'Manual'; + + @override + String get manualFormat => 'Manual'; + + @override + String get manualInputTitle => 'Manual Entry'; + + @override + String get manualInputSubtitle => + 'Type or paste the code to send directly to the PC:'; + + @override + String get manualInputHint => 'e.g. 8001234567890 or ART-99'; + + @override + String get pasteFromClipboardTooltip => 'Paste from clipboard'; + + @override + String get sendToPcButton => 'Send to PC'; + + @override + String get precisionHelperText => 'Center crosshair on code • Tap to focus'; + + @override + String get standardHelperText => 'Frame barcode or QR • Pinch to zoom'; + + @override + String cooldownSent(String seconds) { + return 'Sent • Pause ${seconds}s'; + } + + @override + String cooldownNotSent(String seconds) { + return 'Not sent • Pause ${seconds}s'; + } + + @override + String get notSent => 'Not sent'; + + @override + String get copyTooltip => 'Copy'; + + @override + String get codeCopiedSnackbar => 'Code copied to clipboard'; + + @override + String get resendToPcTooltip => 'Send to PC again'; + + @override + String frozenFrameCount(int count) { + String _temp0 = intl.Intl.pluralLogic( + count, + locale: localeName, + other: 'Frozen frame • $count codes', + one: 'Frozen frame • 1 code', + ); + return '$_temp0'; + } + + @override + String get resumeButton => 'Resume'; + + @override + String get tapCodeToSend => 'Tap a code to send it to the PC'; + + @override + String get newScanButton => 'New scan'; + + @override + String get sentLabel => 'Sent'; + + @override + String get sendLabel => 'Send'; + + @override + String get clearHistoryTitle => 'Clear History?'; + + @override + String get clearHistoryMessage => + 'All codes saved in history on this device will be removed.'; + + @override + String get clearAllButton => 'Clear All'; + + @override + String get scanHistoryTitle => 'Scan History'; + + @override + String get clearHistoryTooltip => 'Clear history'; + + @override + String get searchCodesHint => 'Search codes...'; + + @override + String get noScansInHistory => 'No scans in history'; + + @override + String noResultsForQuery(String query) { + return 'No results for \"$query\"'; + } + + @override + String get copyCodeTooltip => 'Copy code'; + + @override + String get copiedToClipboardSnackbar => 'Copied to clipboard'; + + @override + String resentCodeSnackbar(String code) { + return 'Sent \"$code\" to PC'; + } + + @override + String get settingsTitle => 'Settings'; + + @override + String get sectionPlanSubscription => 'PLAN & SUBSCRIPTION'; + + @override + String get premiumPlanActive => 'Premium Plan Active'; + + @override + String get freeBaseVersion => 'Free Basic Version'; + + @override + String get unlimitedAndAdFree => 'Unlimited scans and zero ads'; + + @override + String activeSessionLabel(String time) { + return 'Active session: $time'; + } + + @override + String freeScansRemaining(int count) { + String _temp0 = intl.Intl.pluralLogic( + count, + locale: localeName, + other: '$count free scans remaining', + one: '1 free scan remaining', + ); + return '$_temp0'; + } + + @override + String get manageButton => 'Manage'; + + @override + String get upgradePremiumShort => 'Go Premium'; + + @override + String get restorePurchasesTitle => 'Restore Purchases'; + + @override + String get restorePurchasesSubtitle => + 'Already purchased on another device or reinstalled?'; + + @override + String get restorePurchasesSuccess => 'Purchases restored successfully!'; + + @override + String get restorePurchasesEmpty => 'No active purchases found to restore.'; + + @override + String get sectionPcConnection => 'PC & STORE CONNECTION'; + + @override + String get workstationStatusTitle => 'Workstation Status'; + + @override + String connectedToName(String name) { + return 'Connected to $name'; + } + + @override + String notConnectedWithIp(String ip) { + return 'Not connected ($ip)'; + } + + @override + String get noPcConfigured => 'No PC configured'; + + @override + String get favoriteWorkstationsTitle => 'Favorite PC Workstations'; + + @override + String registeredComputersCount(int count) { + String _temp0 = intl.Intl.pluralLogic( + count, + locale: localeName, + other: '$count computers saved', + one: '1 computer saved', + ); + return '$_temp0'; + } + + @override + String get noComputersSaved => 'No computers saved'; + + @override + String get autoConnectFullTitle => 'Auto-connect on startup/resume'; + + @override + String get autoConnectFullSubtitle => + 'Disabled: always asks which PC to connect to (prevents typing on a colleague\'s PC)'; + + @override + String get inactivityDisconnectTitle => 'Inactivity disconnect'; + + @override + String inactivityDisconnectActive(int minutes) { + return 'Disconnects after $minutes minutes without scans'; + } + + @override + String get inactivityDisconnectOff => 'Disabled (stays connected)'; + + @override + String get inactivity5Min => '5 min (Recommended)'; + + @override + String get inactivity10Min => '10 min'; + + @override + String get inactivity15Min => '15 min'; + + @override + String get disabledOption => 'Disabled'; + + @override + String get sendTypingTestTitle => 'Send Typing Test'; + + @override + String get sendTypingTestSubtitle => + 'Types \"TEST-CATELLI-123\" on the active PC'; + + @override + String get typingTestSentSnackbar => 'Typing test sent to PC!'; + + @override + String get sectionKeyboardEmulation => 'PC KEYBOARD EMULATION'; + + @override + String get suffixEnterTitle => 'Enter Key'; + + @override + String get suffixEnterSubtitle => + 'Presses Enter after each code (recommended for Excel, ERP, POS)'; + + @override + String get suffixTabTitle => 'Tab Key'; + + @override + String get suffixTabSubtitle => 'Moves cursor to the next field/cell'; + + @override + String get suffixNoneTitle => 'No trailing key'; + + @override + String get suffixNoneSubtitle => 'Types only the raw barcode string'; + + @override + String get sectionScanFeedback => 'SCANNING & FEEDBACK'; + + @override + String get aimModeTitle => 'Aiming mode'; + + @override + String get aimModeSubtitle => + 'Standard, Precision (crosshair + zoom), or AR Multi-Code'; + + @override + String get postScanPauseTitle => 'Post-scan pause'; + + @override + String postScanPauseSubtitle(String seconds) { + return 'Wait ${seconds}s before the next reading'; + } + + @override + String get cooldown1s => '1.0 sec (Fast)'; + + @override + String get cooldown2s => '2.0 sec'; + + @override + String get cooldown25s => '2.5 sec (Recommended)'; + + @override + String get cooldown3s => '3.0 sec'; + + @override + String get cooldown4s => '4.0 sec'; + + @override + String get cooldown5s => '5.0 sec'; + + @override + String get continuousScanTitle => 'Continuous Scanning'; + + @override + String get continuousScanSubtitle => + 'Reduces pause to 1.0s when scanning different codes in a row'; + + @override + String get vibrationTitle => 'Vibrate on scan'; + + @override + String get vibrationSubtitle => 'Haptic feedback when a code is decoded'; + + @override + String get soundTitle => 'Confirmation sound'; + + @override + String get soundSubtitle => 'Audio beep when a barcode is read'; + + @override + String get sectionLanguage => 'LANGUAGE'; + + @override + String get languageTitle => 'App Language'; + + @override + String get languageSystem => 'System default'; + + @override + String get languageItalian => 'Italiano'; + + @override + String get languageEnglish => 'English'; + + @override + String get sectionInfo => 'ABOUT'; + + @override + String get organizationTitle => 'Organization'; + + @override + String get appVersionTitle => 'App Version'; + + @override + String get paywallTitle => 'Barcode Reader Premium'; + + @override + String get paywallSubtitle => + 'Unlock unlimited PC scanning with zero interruptions.'; + + @override + String get paywallBenefitUnlimited => 'Unlimited barcode & QR scans forever'; + + @override + String get paywallBenefitNoAds => 'Zero ads, no waiting timers'; + + @override + String get paywallBenefitAllModes => + 'Standard, Precision & AR Multi-Scan modes'; + + @override + String get paywallBenefitMultiPc => 'Multi-PC favorites & instant Wi-Fi sync'; + + @override + String get paywallPlanYearly => 'Yearly'; + + @override + String get paywallPlanMonthly => 'Monthly'; + + @override + String get paywallPlanLifetime => 'Lifetime'; + + @override + String get paywallPerYear => '/ year'; + + @override + String get paywallPerMonth => '/ month'; + + @override + String get paywallOneTime => 'One-time purchase'; + + @override + String get paywallBestValue => 'BEST VALUE'; + + @override + String paywallSavePercent(int percent) { + return 'SAVE $percent%'; + } + + @override + String get paywallOneTimeBadge => 'PAY ONCE'; + + @override + String get paywallContinueButton => 'Continue'; + + @override + String paywallContinueWithPrice(String price) { + return 'Continue — $price'; + } + + @override + String get paywallLoadingPlans => 'Loading available plans...'; + + @override + String get paywallUnavailableTitle => 'Plans temporarily unavailable'; + + @override + String get paywallUnavailableSubtitle => + 'Check your internet connection or Google Play availability and try again.'; + + @override + String get paywallRetryButton => 'Retry'; + + @override + String get paywallPurchaseError => + 'Purchase could not be completed. Please try again.'; + + @override + String get paywallLegalNote => + 'Subscriptions auto-renew unless cancelled at least 24 hours before the end of the period in Google Play settings.'; + + @override + String get premiumManageTitle => 'Premium Active'; + + @override + String get premiumManageBody => + 'Your Unlimited Premium plan is active on this account.\n\nTo manage or cancel a subscription, open Google Play Store → Payments & subscriptions → Subscriptions.'; + + @override + String get closeButton => 'Close'; +} diff --git a/app/lib/l10n/generated/app_localizations_it.dart b/app/lib/l10n/generated/app_localizations_it.dart new file mode 100644 index 0000000..60395b1 --- /dev/null +++ b/app/lib/l10n/generated/app_localizations_it.dart @@ -0,0 +1,713 @@ +// ignore: unused_import +import 'package:intl/intl.dart' as intl; + +import 'app_localizations.dart'; + +// ignore_for_file: type=lint + +/// The translations for Italian (`it`). +class AppLocalizationsIt extends AppLocalizations { + AppLocalizationsIt([String locale = 'it']) : super(locale); + + @override + String get appTitle => 'Catelli Barcode Reader'; + + @override + String get cancel => 'Annulla'; + + @override + String get remove => 'Rimuovi'; + + @override + String get connect => 'Connetti'; + + @override + String get reconnect => 'Riconnetti'; + + @override + String get active => 'Attivo'; + + @override + String get activeUppercase => 'ATTIVO'; + + @override + String get connected => 'Connesso'; + + @override + String get connecting => 'Connessione...'; + + @override + String get notConnected => 'Non connesso'; + + @override + String get pinOrNetworkError => 'Errore PIN/Rete'; + + @override + String get defaultStorePcName => 'PC Negozio'; + + @override + String get defaultPcServerName => 'PC Server'; + + @override + String get enterValidIp => 'Inserisci un indirizzo IP valido del PC'; + + @override + String connectingToHost(String ip, int port) { + return 'Connessione a $ip:$port in corso...'; + } + + @override + String connectingToName(String name) { + return 'Connessione a $name...'; + } + + @override + String get pcConnectionsTitle => 'Connessione Postazioni PC'; + + @override + String get scanPcQrCode => 'Inquadra QR Code sul PC'; + + @override + String get savedStoreWorkstations => 'Postazioni Salvate nel Negozio'; + + @override + String favoritesCount(int count) { + String _temp0 = intl.Intl.pluralLogic( + count, + locale: localeName, + other: '$count preferiti', + one: '1 preferito', + ); + return '$_temp0'; + } + + @override + String get detectedWifiPcs => 'PC Rilevati in Wi-Fi'; + + @override + String get refreshDiscoveryTooltip => 'Aggiorna ricerca'; + + @override + String get searchingPcServers => 'Ricerca server PC in corso sulla rete...'; + + @override + String get noPcServersFound => + 'Nessun server PC rilevato automaticamente sulla rete.\nAssicurati che il programma sul PC sia avviato e connesso allo stesso Wi-Fi.'; + + @override + String get requiresPin => 'Richiede PIN'; + + @override + String get withPin => 'Con PIN'; + + @override + String get manualSetup => 'Configurazione Manuale'; + + @override + String get workstationNameLabel => 'Nome Postazione / PC (opzionale)'; + + @override + String get workstationNameHint => 'Es. Cassa 1, Magazzino, Ufficio'; + + @override + String get pcIpLabel => 'Indirizzo IP del PC'; + + @override + String get pcIpHint => 'Es. 192.168.1.100'; + + @override + String get portLabel => 'Porta'; + + @override + String get pinOptionalLabel => 'PIN (se impostato)'; + + @override + String get pinHint => 'Codice PIN'; + + @override + String get saveAndConnectManually => 'Salva e Connetti Manualmente'; + + @override + String get disconnectFromPc => 'Disconnetti dal PC'; + + @override + String get disconnectedByInactivity => 'Disconnesso per inattività'; + + @override + String get disconnectedManually => 'Disconnesso manualmente'; + + @override + String get qrModalTitle => 'Inquadra QR Code del Server'; + + @override + String get qrModalSubtitle => + 'Inquadra il codice QR mostrato nell\'app companion sul PC.'; + + @override + String get removeWorkstationTitle => 'Rimuovere postazione?'; + + @override + String removeWorkstationMessage(String name, String ip) { + return 'Vuoi eliminare \"$name\" ($ip) dai PC preferiti?'; + } + + @override + String get selectPcWorkstation => 'Seleziona Postazione PC'; + + @override + String get selectPcSubtitle => + 'Scegli il computer del negozio su cui scrivere'; + + @override + String get inactivityAlert => + 'Disconnesso per inattività. Seleziona la postazione prima di scansionare.'; + + @override + String get noFavoritePcs => 'Nessun PC preferito salvato'; + + @override + String get noFavoritePcsHint => + 'Aggiungi i computer del negozio per collegarti con 1 tocco ed evitare errori tra colleghi.'; + + @override + String get removeFavoriteTooltip => 'Rimuovi dai preferiti'; + + @override + String get addNewPcButton => 'Aggiungi Nuovo PC (Wi-Fi o QR Code)'; + + @override + String get autoConnectOnStartup => 'Collega automaticamente all\'avvio'; + + @override + String get autoConnectSubtitleShort => + 'Disattivato: richiede la selezione del PC (consigliato in negozio)'; + + @override + String get unlimitedScansTitle => 'Scansioni Illimitate'; + + @override + String get unlimitedScansDescription => + 'Guarda un breve video per sbloccare 15 minuti di scansioni illimitate al PC senza interruzioni.'; + + @override + String get unlocked15MinSnackbar => + '15 minuti di scansioni illimitate sbloccati!'; + + @override + String get loadingVideoRetrySnackbar => + 'Caricamento video in corso... Riprova tra pochi istanti.'; + + @override + String get loadingVideoButton => 'Caricamento video...'; + + @override + String get watchVideoButton => 'Guarda Video (+15 min)'; + + @override + String get welcomePremiumSnackbar => 'Benvenuto in Premium Illimitato!'; + + @override + String get upgradeToPremiumButton => 'Passa a Premium Illimitato'; + + @override + String get laterButton => 'Più tardi'; + + @override + String sentToPcSnackbar(String code) { + return 'Inviato al PC: $code'; + } + + @override + String get savedToHistoryOfflineSnackbar => + 'Codice salvato in cronologia (PC non connesso)'; + + @override + String get torchTooltip => 'Torcia'; + + @override + String get switchCameraTooltip => 'Inverti Fotocamera'; + + @override + String get historyTooltip => 'Cronologia'; + + @override + String get settingsTooltip => 'Impostazioni'; + + @override + String get premiumBadge => 'Premium'; + + @override + String unlimitedSessionLabel(String time) { + return '$time Illimitati'; + } + + @override + String freeScansShort(int count) { + return '$count libere'; + } + + @override + String get unlock15Min => 'Sblocca 15 min'; + + @override + String get aimModeStandard => 'Standard'; + + @override + String get aimModePrecision => 'Precisione'; + + @override + String get aimModeArMulti => 'AR Multi'; + + @override + String get waitingForCodesCancel => + 'In attesa dei codici… Tocca per annullare'; + + @override + String freezeFrameCount(int count) { + String _temp0 = intl.Intl.pluralLogic( + count, + locale: localeName, + other: 'Blocca frame ($count codici)', + one: 'Blocca frame (1 codice)', + ); + return '$_temp0'; + } + + @override + String get freezeAndPick => 'Blocca e scegli'; + + @override + String get manualButton => 'Manuale'; + + @override + String get manualFormat => 'Manuale'; + + @override + String get manualInputTitle => 'Digitazione Manuale'; + + @override + String get manualInputSubtitle => + 'Digita o incolla il codice da digitare in tempo reale sul PC:'; + + @override + String get manualInputHint => 'Es. 8001234567890 o ART-99'; + + @override + String get pasteFromClipboardTooltip => 'Incolla dagli appunti'; + + @override + String get sendToPcButton => 'Invia al PC'; + + @override + String get precisionHelperText => + 'Centra il mirino sul codice • Tocca per mettere a fuoco'; + + @override + String get standardHelperText => + 'Inquadra codice a barre o QR • Pizzica per zoomare'; + + @override + String cooldownSent(String seconds) { + return 'Inviato • Pausa ${seconds}s'; + } + + @override + String cooldownNotSent(String seconds) { + return 'Non inviato • Pausa ${seconds}s'; + } + + @override + String get notSent => 'Non inviato'; + + @override + String get copyTooltip => 'Copia'; + + @override + String get codeCopiedSnackbar => 'Codice copiato negli appunti'; + + @override + String get resendToPcTooltip => 'Invia di nuovo al PC'; + + @override + String frozenFrameCount(int count) { + String _temp0 = intl.Intl.pluralLogic( + count, + locale: localeName, + other: 'Frame bloccato • $count codici', + one: 'Frame bloccato • 1 codice', + ); + return '$_temp0'; + } + + @override + String get resumeButton => 'Riprendi'; + + @override + String get tapCodeToSend => 'Tocca un codice per inviarlo al PC'; + + @override + String get newScanButton => 'Nuova scansione'; + + @override + String get sentLabel => 'Inviato'; + + @override + String get sendLabel => 'Invia'; + + @override + String get clearHistoryTitle => 'Cancellare Cronologia?'; + + @override + String get clearHistoryMessage => + 'Tutti i codici salvati nella cronologia su questo dispositivo verranno rimossi.'; + + @override + String get clearAllButton => 'Cancella Tutto'; + + @override + String get scanHistoryTitle => 'Cronologia Scansioni'; + + @override + String get clearHistoryTooltip => 'Cancella cronologia'; + + @override + String get searchCodesHint => 'Cerca tra i codici...'; + + @override + String get noScansInHistory => 'Nessuna scansione in memoria'; + + @override + String noResultsForQuery(String query) { + return 'Nessun risultato per \"$query\"'; + } + + @override + String get copyCodeTooltip => 'Copia codice'; + + @override + String get copiedToClipboardSnackbar => 'Copiato negli appunti'; + + @override + String resentCodeSnackbar(String code) { + return 'Inviato \"$code\" al PC'; + } + + @override + String get settingsTitle => 'Impostazioni'; + + @override + String get sectionPlanSubscription => 'PIANO & ABBONAMENTO'; + + @override + String get premiumPlanActive => 'Piano Premium Attivo'; + + @override + String get freeBaseVersion => 'Versione Base Gratuita'; + + @override + String get unlimitedAndAdFree => 'Scansioni illimitate e zero pubblicità'; + + @override + String activeSessionLabel(String time) { + return 'Sessione attiva: $time'; + } + + @override + String freeScansRemaining(int count) { + String _temp0 = intl.Intl.pluralLogic( + count, + locale: localeName, + other: '$count scansioni libere rimanenti', + one: '1 scansione libera rimanente', + ); + return '$_temp0'; + } + + @override + String get manageButton => 'Gestisci'; + + @override + String get upgradePremiumShort => 'Passa a Premium'; + + @override + String get restorePurchasesTitle => 'Ripristina Acquisti'; + + @override + String get restorePurchasesSubtitle => + 'Hai già acquistato su un altro dispositivo o reinstallato?'; + + @override + String get restorePurchasesSuccess => 'Acquisti ripristinati con successo!'; + + @override + String get restorePurchasesEmpty => + 'Nessun acquisto attivo trovato da ripristinare.'; + + @override + String get sectionPcConnection => 'CONNESSIONE PC & NEGOZIO'; + + @override + String get workstationStatusTitle => 'Stato Postazione'; + + @override + String connectedToName(String name) { + return 'Connesso a $name'; + } + + @override + String notConnectedWithIp(String ip) { + return 'Non connesso ($ip)'; + } + + @override + String get noPcConfigured => 'Nessun PC configurato'; + + @override + String get favoriteWorkstationsTitle => 'Postazioni PC Preferite'; + + @override + String registeredComputersCount(int count) { + String _temp0 = intl.Intl.pluralLogic( + count, + locale: localeName, + other: '$count computer registrati nel negozio', + one: '1 computer registrato nel negozio', + ); + return '$_temp0'; + } + + @override + String get noComputersSaved => 'Nessun computer salvato'; + + @override + String get autoConnectFullTitle => 'Autocollegamento all\'avvio/risveglio'; + + @override + String get autoConnectFullSubtitle => + 'Disattivato: chiede sempre a quale PC connettersi (evita di sparare codici sul PC del collega)'; + + @override + String get inactivityDisconnectTitle => 'Disconnessione per inattività'; + + @override + String inactivityDisconnectActive(int minutes) { + return 'Interrompe la connessione dopo $minutes minuti senza scansioni'; + } + + @override + String get inactivityDisconnectOff => 'Disattivata (rimane sempre connesso)'; + + @override + String get inactivity5Min => '5 min (Consigliato)'; + + @override + String get inactivity10Min => '10 min'; + + @override + String get inactivity15Min => '15 min'; + + @override + String get disabledOption => 'Disattivata'; + + @override + String get sendTypingTestTitle => 'Invia Test di Digitazione'; + + @override + String get sendTypingTestSubtitle => + 'Digita \"TEST-CATELLI-123\" sul PC attivo'; + + @override + String get typingTestSentSnackbar => 'Test di digitazione inviato al PC!'; + + @override + String get sectionKeyboardEmulation => 'EMULAZIONE TASTIERA PC'; + + @override + String get suffixEnterTitle => 'Tasto Invio (Enter)'; + + @override + String get suffixEnterSubtitle => + 'Preme Invio dopo ogni codice (consigliato per Excel, ERP, gestionali)'; + + @override + String get suffixTabTitle => 'Tasto Tabulatore (Tab)'; + + @override + String get suffixTabSubtitle => 'Sposta il cursore al campo/cella successiva'; + + @override + String get suffixNoneTitle => 'Nessun tasto finale'; + + @override + String get suffixNoneSubtitle => + 'Scrive solo la stringa pura del codice a barre'; + + @override + String get sectionScanFeedback => 'SCANSIONE E FEEDBACK'; + + @override + String get aimModeTitle => 'Modalità di mira'; + + @override + String get aimModeSubtitle => + 'Standard, Precisione (mirino + zoom) o AR Multi-Codice'; + + @override + String get postScanPauseTitle => 'Pausa dopo scansione'; + + @override + String postScanPauseSubtitle(String seconds) { + return 'Attesa di ${seconds}s prima della prossima lettura'; + } + + @override + String get cooldown1s => '1,0 sec (Rapida)'; + + @override + String get cooldown2s => '2,0 sec'; + + @override + String get cooldown25s => '2,5 sec (Consigliata)'; + + @override + String get cooldown3s => '3,0 sec'; + + @override + String get cooldown4s => '4,0 sec'; + + @override + String get cooldown5s => '5,0 sec'; + + @override + String get continuousScanTitle => 'Scansione Continua'; + + @override + String get continuousScanSubtitle => + 'Riduce la pausa a 1,0s quando inquadri codici diversi in serie'; + + @override + String get vibrationTitle => 'Vibrazione alla lettura'; + + @override + String get vibrationSubtitle => 'Feedback aptico alla decodifica del codice'; + + @override + String get soundTitle => 'Suono di conferma'; + + @override + String get soundSubtitle => 'Segnale acustico alla lettura del barcode'; + + @override + String get sectionLanguage => 'LINGUA'; + + @override + String get languageTitle => 'Lingua App'; + + @override + String get languageSystem => 'Predefinita di sistema'; + + @override + String get languageItalian => 'Italiano'; + + @override + String get languageEnglish => 'English'; + + @override + String get sectionInfo => 'INFORMAZIONI'; + + @override + String get organizationTitle => 'Organizzazione'; + + @override + String get appVersionTitle => 'Versione App'; + + @override + String get paywallTitle => 'Barcode Reader Premium'; + + @override + String get paywallSubtitle => + 'Sblocca scansioni illimitate verso il PC senza alcuna interruzione.'; + + @override + String get paywallBenefitUnlimited => + 'Scansioni barcode e QR illimitate per sempre'; + + @override + String get paywallBenefitNoAds => 'Zero pubblicità e nessun timer di attesa'; + + @override + String get paywallBenefitAllModes => + 'Modalità Standard, Precisione e AR Multi-Codice'; + + @override + String get paywallBenefitMultiPc => + 'Postazioni multi-PC preferite e sincronizzazione Wi-Fi'; + + @override + String get paywallPlanYearly => 'Annuale'; + + @override + String get paywallPlanMonthly => 'Mensile'; + + @override + String get paywallPlanLifetime => 'A Vita (Lifetime)'; + + @override + String get paywallPerYear => '/ anno'; + + @override + String get paywallPerMonth => '/ mese'; + + @override + String get paywallOneTime => 'Acquisto una tantum'; + + @override + String get paywallBestValue => 'PIÙ CONVENIENTE'; + + @override + String paywallSavePercent(int percent) { + return 'RISPARMIA $percent%'; + } + + @override + String get paywallOneTimeBadge => 'PAGHI UNA VOLTA'; + + @override + String get paywallContinueButton => 'Continua'; + + @override + String paywallContinueWithPrice(String price) { + return 'Continua — $price'; + } + + @override + String get paywallLoadingPlans => 'Caricamento piani disponibili...'; + + @override + String get paywallUnavailableTitle => 'Piani momentaneamente non disponibili'; + + @override + String get paywallUnavailableSubtitle => + 'Verifica la connessione internet o la disponibilità di Google Play e riprova.'; + + @override + String get paywallRetryButton => 'Riprova'; + + @override + String get paywallPurchaseError => + 'Impossibile completare l\'acquisto. Riprova tra poco.'; + + @override + String get paywallLegalNote => + 'Gli abbonamenti si rinnovano automaticamente salvo disdetta almeno 24 ore prima della scadenza nelle impostazioni di Google Play.'; + + @override + String get premiumManageTitle => 'Premium Attivo'; + + @override + String get premiumManageBody => + 'Il tuo piano Premium Illimitato è attivo su questo account.\n\nPer gestire o disdire un abbonamento, apri Google Play Store → Pagamenti e abbonamenti → Abbonamenti.'; + + @override + String get closeButton => 'Chiudi'; +} diff --git a/app/lib/main.dart b/app/lib/main.dart index 68a6ff6..265e93d 100644 --- a/app/lib/main.dart +++ b/app/lib/main.dart @@ -1,8 +1,10 @@ import 'package:flutter/material.dart'; import 'package:flutter/services.dart'; import 'package:flutter_bloc/flutter_bloc.dart'; +import 'package:flutter_localizations/flutter_localizations.dart'; import 'package:shared_preferences/shared_preferences.dart'; +import 'core/l10n/l10n_extensions.dart'; import 'core/services/ad_service.dart'; import 'core/services/feedback_service.dart'; import 'core/services/subscription_service.dart'; @@ -25,6 +27,7 @@ import 'features/settings/data/datasources/settings_local_datasource.dart'; import 'features/settings/data/repositories/settings_repository_impl.dart'; import 'features/settings/domain/repositories/settings_repository.dart'; import 'features/settings/presentation/cubit/settings_cubit.dart'; +import 'features/settings/presentation/cubit/settings_state.dart'; void main() async { WidgetsFlutterBinding.ensureInitialized(); @@ -133,13 +136,28 @@ class BarcodeReaderApp extends StatelessWidget { ), ), ], - child: MaterialApp( - title: 'Catelli Barcode Reader', - debugShowCheckedModeBanner: false, - themeMode: ThemeMode.dark, // Dark theme provides optimal contrast for scanner viewfinder - theme: AppTheme.lightTheme, - darkTheme: AppTheme.darkTheme, - home: const ScannerScreen(), + child: BlocBuilder( + buildWhen: (prev, curr) => + prev.settings.languageCode != curr.settings.languageCode, + builder: (context, settingsState) { + return MaterialApp( + onGenerateTitle: (context) => context.l10n.appTitle, + debugShowCheckedModeBanner: false, + locale: settingsState.settings.locale, + localizationsDelegates: const [ + AppLocalizations.delegate, + GlobalMaterialLocalizations.delegate, + GlobalWidgetsLocalizations.delegate, + GlobalCupertinoLocalizations.delegate, + ], + supportedLocales: AppLocalizations.supportedLocales, + themeMode: ThemeMode + .dark, // Dark theme provides optimal contrast for scanner viewfinder + theme: AppTheme.lightTheme, + darkTheme: AppTheme.darkTheme, + home: const ScannerScreen(), + ); + }, ), ); } diff --git a/app/pubspec.lock b/app/pubspec.lock index 47a74b1..83c1221 100644 --- a/app/pubspec.lock +++ b/app/pubspec.lock @@ -222,6 +222,11 @@ packages: url: "https://pub.dev" source: hosted version: "6.0.0" + flutter_localizations: + dependency: "direct main" + description: flutter + source: sdk + version: "0.0.0" flutter_test: dependency: "direct dev" description: flutter @@ -264,6 +269,14 @@ packages: url: "https://pub.dev" source: hosted version: "4.1.2" + intl: + dependency: "direct main" + description: + name: intl + sha256: "1ca20c894b1717686a2319b8548763d812bc0aabdac580420a44c5178c57a867" + url: "https://pub.dev" + source: hosted + version: "0.20.3" jni: dependency: transitive description: @@ -480,14 +493,6 @@ packages: url: "https://pub.dev" source: hosted version: "11.0.3" - purchases_ui_flutter: - dependency: "direct main" - description: - name: purchases_ui_flutter - sha256: "9931ffb9729b61b667f41da213de299cff9993ecaf95f18e455aef78b02b17a8" - url: "https://pub.dev" - source: hosted - version: "11.0.3" record_use: dependency: transitive description: diff --git a/app/pubspec.yaml b/app/pubspec.yaml index 785d243..e853f05 100644 --- a/app/pubspec.yaml +++ b/app/pubspec.yaml @@ -16,7 +16,7 @@ publish_to: 'none' # Remove this line if you wish to publish to pub.dev # https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html # In Windows, build-name is used as the major, minor, and patch parts # of the product and file versions while build-number is used as the build suffix. -version: 1.0.10+11 +version: 1.1.0+12 environment: sdk: ^3.13.4 @@ -30,6 +30,9 @@ environment: dependencies: flutter: sdk: flutter + flutter_localizations: + sdk: flutter + intl: any # The following adds the Cupertino Icons font to your application. # Use with the CupertinoIcons class for iOS style icons. @@ -44,7 +47,6 @@ dependencies: vibration: ^3.2.1 google_mobile_ads: ^9.2.0 purchases_flutter: ^11.0.3 - purchases_ui_flutter: ^11.0.3 dev_dependencies: flutter_test: @@ -62,6 +64,7 @@ dev_dependencies: # The following section is specific to Flutter packages. flutter: + generate: true # The following line ensures that the Material Icons font is # included with your application, so that you can use the icons in diff --git a/app/test/widget_test.dart b/app/test/widget_test.dart index 260f709..e65be63 100644 --- a/app/test/widget_test.dart +++ b/app/test/widget_test.dart @@ -1,6 +1,8 @@ +import 'package:flutter/widgets.dart'; import 'package:flutter_test/flutter_test.dart'; import 'package:shared_preferences/shared_preferences.dart'; import 'package:barcode_reader_app/main.dart'; +import 'package:barcode_reader_app/l10n/generated/app_localizations.dart'; import 'package:barcode_reader_app/core/services/ad_service.dart'; import 'package:barcode_reader_app/core/services/feedback_service.dart'; import 'package:barcode_reader_app/core/services/subscription_service.dart'; @@ -43,4 +45,14 @@ void main() { expect(find.byType(BarcodeReaderApp), findsOneWidget); }); + + test('Localization provides both Italian and English strings', () { + final it = lookupAppLocalizations(const Locale('it')); + final en = lookupAppLocalizations(const Locale('en')); + + expect(it.settingsTitle, 'Impostazioni'); + expect(en.settingsTitle, 'Settings'); + expect(it.scanPcQrCode, 'Inquadra QR Code sul PC'); + expect(en.scanPcQrCode, 'Scan QR Code on PC'); + }); } diff --git a/server/config.py b/server/config.py index 9fa9444..7204c55 100644 --- a/server/config.py +++ b/server/config.py @@ -52,6 +52,7 @@ DEFAULT_CONFIG = { "log_history": True, "check_updates": True, # Check for app updates on startup "update_url": "", # Optional custom release metadata URL + "language": "auto", # "auto", "it", "en" } diff --git a/server/gui.py b/server/gui.py index 4e9d407..4c64eaa 100644 --- a/server/gui.py +++ b/server/gui.py @@ -15,6 +15,7 @@ from PySide6.QtWidgets import ( QApplication, QButtonGroup, QCheckBox, + QComboBox, QDialog, QFormLayout, QFrame, @@ -39,6 +40,7 @@ from PySide6.QtWidgets import ( from autostart import is_autostart_enabled, set_autostart from config import load_config +from i18n import get_language, set_language, tr from server_core import BarcodeServerCore, generate_qr_image from tray import ServerTrayIcon, load_app_icon from updater import ( @@ -90,7 +92,7 @@ QFrame#Card { border: 1px solid #334155; border-radius: 12px; } -QLineEdit, QTextEdit { +QLineEdit, QTextEdit, QComboBox { background-color: #0F172A; color: #F8FAFC; border: 1px solid #475569; @@ -98,6 +100,11 @@ QLineEdit, QTextEdit { padding: 7px 10px; selection-background-color: #0284C7; } +QComboBox QAbstractItemView { + background-color: #1E293B; + color: #F8FAFC; + selection-background-color: #0284C7; +} QLineEdit:focus, QTextEdit:focus { border-color: #38BDF8; } @@ -234,7 +241,7 @@ class UpdateDialog(QDialog): self.on_ready_to_exit = on_ready_to_exit self._download_worker: Optional[_UpdateDownloadWorker] = None - self.setWindowTitle(f"Aggiornamento Disponibile — v{release.version}") + self.setWindowTitle(tr("update_win_title", version=release.version)) self.setMinimumWidth(480) self.setStyleSheet(DARK_STYLESHEET) @@ -242,16 +249,18 @@ class UpdateDialog(QDialog): layout.setContentsMargins(20, 20, 20, 20) layout.setSpacing(12) - title_lbl = QLabel(f"Nuova versione disponibile: v{release.version}") + title_lbl = QLabel(tr("update_new_version", version=release.version)) title_lbl.setStyleSheet("font-size: 16px; font-weight: 700; color: #38BDF8;") layout.addWidget(title_lbl) - subtitle_lbl = QLabel(f"Versione installata: v{APP_VERSION} • {release.title}") + subtitle_lbl = QLabel( + tr("update_installed_sub", version=APP_VERSION, title=release.title) + ) subtitle_lbl.setStyleSheet("color: #94A3B8;") subtitle_lbl.setWordWrap(True) layout.addWidget(subtitle_lbl) - notes_text = (release.notes or "").strip() or "Nessuna nota di rilascio specificata." + notes_text = (release.notes or "").strip() or tr("update_no_notes") self.notes_box = QTextEdit() self.notes_box.setReadOnly(True) self.notes_box.setMinimumHeight(140) @@ -263,14 +272,12 @@ class UpdateDialog(QDialog): self.status_lbl.setWordWrap(True) self.status_lbl.setStyleSheet("color: #94A3B8; font-size: 12px;") if self.asset is None: - self.status_lbl.setText( - "Nessun pacchetto specifico trovato per questa piattaforma negli asset della release." - ) + self.status_lbl.setText(tr("update_no_asset")) elif not self.can_auto: self.status_lbl.setText(self.auto_reason) else: size_mb = f" ({self.asset.size / (1024 * 1024):.1f} MB)" if self.asset.size > 0 else "" - self.status_lbl.setText(f"Pacchetto pronto per l'installazione: {self.asset.name}{size_mb}") + self.status_lbl.setText(tr("update_ready_pkg", name=self.asset.name, size=size_mb)) layout.addWidget(self.status_lbl) self.progress_bar = QProgressBar() @@ -278,17 +285,17 @@ class UpdateDialog(QDialog): layout.addWidget(self.progress_bar) btn_row = QHBoxLayout() - self.btn_later = QPushButton("Più Tardi") + self.btn_later = QPushButton(tr("btn_later")) self.btn_later.clicked.connect(self.reject) btn_row.addWidget(self.btn_later) - self.btn_browser = QPushButton("Apri Pagina Release") + self.btn_browser = QPushButton(tr("btn_open_release_page")) self.btn_browser.clicked.connect(self._open_release_page) btn_row.addWidget(self.btn_browser) btn_row.addStretch(1) - self.btn_install = QPushButton("Aggiorna e Riavvia") + self.btn_install = QPushButton(tr("btn_update_restart")) self.btn_install.setObjectName("PrimaryBtn") can_run_auto = self.can_auto and self.asset is not None self.btn_install.setVisible(can_run_auto) @@ -311,7 +318,7 @@ class UpdateDialog(QDialog): self.btn_browser.setEnabled(False) self.progress_bar.setVisible(True) self.progress_bar.setRange(0, 0) - self.status_lbl.setText(f"Scaricamento di {self.asset.name}...") + self.status_lbl.setText(tr("update_downloading", name=self.asset.name)) self._download_worker = _UpdateDownloadWorker(self.asset, self) self._download_worker.progress.connect(self._on_download_progress) @@ -325,18 +332,25 @@ class UpdateDialog(QDialog): self.progress_bar.setRange(0, 100) self.progress_bar.setValue(percent) self.status_lbl.setText( - f"Scaricamento: {downloaded / (1024 * 1024):.1f} / {total / (1024 * 1024):.1f} MB ({percent}%)" + tr( + "update_downloading_pct", + done=downloaded / (1024 * 1024), + total=total / (1024 * 1024), + percent=percent, + ) ) else: - self.status_lbl.setText(f"Scaricati {downloaded / (1024 * 1024):.1f} MB...") + self.status_lbl.setText( + tr("update_downloading_mb", done=downloaded / (1024 * 1024)) + ) def _on_download_completed(self, path_obj: object) -> None: downloaded_path = Path(path_obj) - self.status_lbl.setText("Installazione aggiornamento e riavvio in corso...") + self.status_lbl.setText(tr("update_installing")) try: apply_downloaded_update(downloaded_path) except Exception as exc: - self._on_download_failed(f"Errore avvio aggiornamento: {exc}") + self._on_download_failed(tr("update_apply_error", error=exc)) return self.accept() self.on_ready_to_exit() @@ -346,8 +360,8 @@ class UpdateDialog(QDialog): self.btn_install.setEnabled(True) self.btn_later.setEnabled(True) self.btn_browser.setEnabled(True) - self.status_lbl.setText(f"Errore: {error_msg}") - QMessageBox.critical(self, "Errore Aggiornamento", error_msg) + self.status_lbl.setText(tr("update_error_prefix", error=error_msg)) + QMessageBox.critical(self, tr("update_error_title"), error_msg) class ServerAppGUI(QMainWindow): @@ -357,6 +371,7 @@ class ServerAppGUI(QMainWindow): super().__init__() self.server = server self.config = load_config() + set_language(self.config.get("language", "auto")) self._quitting = False self._update_worker: Optional[_UpdateCheckWorker] = None self._pending_update: Optional[UpdateCheckResult] = None @@ -410,16 +425,14 @@ class ServerAppGUI(QMainWindow): title_box.setSpacing(2) title_lbl = QLabel("Barcode Reader PC Server") title_lbl.setStyleSheet("font-size: 20px; font-weight: 700; color: #38BDF8;") - subtitle_lbl = QLabel( - f"Ricezione codici a barre da Smartphone • Catelli Srl • v{APP_VERSION}" - ) + subtitle_lbl = QLabel(tr("app_subtitle", version=APP_VERSION)) subtitle_lbl.setStyleSheet("color: #94A3B8; font-size: 12px;") title_box.addWidget(title_lbl) title_box.addWidget(subtitle_lbl) header_layout.addLayout(title_box) header_layout.addStretch(1) - self.btn_update_banner = QPushButton("Aggiornamento disponibile") + self.btn_update_banner = QPushButton(tr("update_available_btn")) self.btn_update_banner.setObjectName("UpdateBannerBtn") self.btn_update_banner.setVisible(False) self.btn_update_banner.clicked.connect(self._open_pending_update_dialog) @@ -441,8 +454,8 @@ class ServerAppGUI(QMainWindow): self.tabs = QTabWidget() self.tab_dashboard = QWidget() self.tab_settings = QWidget() - self.tabs.addTab(self.tab_dashboard, "Dashboard & Dispositivi") - self.tabs.addTab(self.tab_settings, "Impostazioni") + self.tabs.addTab(self.tab_dashboard, tr("tab_dashboard")) + self.tabs.addTab(self.tab_settings, tr("tab_settings")) root_layout.addWidget(self.tabs, stretch=1) self._build_dashboard_tab() @@ -467,7 +480,7 @@ class ServerAppGUI(QMainWindow): qr_layout = QVBoxLayout(qr_card) qr_layout.setContentsMargins(18, 16, 18, 16) qr_layout.setSpacing(10) - qr_title = QLabel("CONNESSIONE RAPIDA (QR)") + qr_title = QLabel(tr("card_qr_title")) qr_title.setStyleSheet("font-size: 11px; font-weight: 700; color: #94A3B8;") qr_layout.addWidget(qr_title) @@ -481,7 +494,7 @@ class ServerAppGUI(QMainWindow): qr_wrapper_layout.addWidget(self.qr_label, alignment=Qt.AlignmentFlag.AlignCenter) qr_layout.addWidget(qr_wrapper, alignment=Qt.AlignmentFlag.AlignCenter) - qr_hint = QLabel("Inquadra con l'app Android/iOS") + qr_hint = QLabel(tr("qr_hint")) qr_hint.setStyleSheet("color: #64748B; font-size: 12px;") qr_hint.setAlignment(Qt.AlignmentFlag.AlignCenter) qr_layout.addWidget(qr_hint) @@ -492,7 +505,7 @@ class ServerAppGUI(QMainWindow): info_layout = QVBoxLayout(info_card) info_layout.setContentsMargins(20, 16, 20, 16) info_layout.setSpacing(12) - info_title = QLabel("DETTAGLI SERVER") + info_title = QLabel(tr("card_server_title")) info_title.setStyleSheet("font-size: 11px; font-weight: 700; color: #94A3B8;") info_layout.addWidget(info_title) @@ -500,19 +513,19 @@ class ServerAppGUI(QMainWindow): grid.setHorizontalSpacing(18) grid.setVerticalSpacing(10) - self.lbl_ip = self._add_info_row(grid, 0, "Indirizzo IP Locale:", self.server.local_ip, "#38BDF8") - self.lbl_port = self._add_info_row(grid, 1, "Porta:", str(self.server.port)) - self.lbl_name = self._add_info_row(grid, 2, "Nome PC:", self.server.server_name) - pin_text = self.config.get("pin", "") or "Nessuno (Libero)" - self.lbl_pin = self._add_info_row(grid, 3, "PIN di Accesso:", pin_text) + self.lbl_ip = self._add_info_row(grid, 0, tr("lbl_local_ip"), self.server.local_ip, "#38BDF8") + self.lbl_port = self._add_info_row(grid, 1, tr("lbl_port"), str(self.server.port)) + self.lbl_name = self._add_info_row(grid, 2, tr("lbl_pc_name"), self.server.server_name) + pin_text = self.config.get("pin", "") or tr("pin_none") + self.lbl_pin = self._add_info_row(grid, 3, tr("lbl_pin"), pin_text) info_layout.addLayout(grid) info_layout.addStretch(1) btn_row = QHBoxLayout() - btn_copy = QPushButton("Copia IP") + btn_copy = QPushButton(tr("btn_copy_ip")) btn_copy.setCursor(Qt.CursorShape.PointingHandCursor) btn_copy.clicked.connect(self._copy_ip_to_clipboard) - btn_web = QPushButton("Apri Dashboard Web") + btn_web = QPushButton(tr("btn_open_web")) btn_web.setObjectName("PrimaryBtn") btn_web.setCursor(Qt.CursorShape.PointingHandCursor) btn_web.clicked.connect(self.open_web_dashboard) @@ -529,9 +542,9 @@ class ServerAppGUI(QMainWindow): dev_layout = QVBoxLayout(dev_card) dev_layout.setContentsMargins(18, 12, 18, 12) dev_layout.setSpacing(4) - dev_title = QLabel("DISPOSITIVI CONNESSI") + dev_title = QLabel(tr("card_devices_title")) dev_title.setStyleSheet("font-size: 11px; font-weight: 700; color: #94A3B8;") - self.lbl_devices = QLabel("Nessun dispositivo mobile collegato.") + self.lbl_devices = QLabel(tr("no_devices_connected")) self.lbl_devices.setStyleSheet("color: #64748B;") self.lbl_devices.setWordWrap(True) dev_layout.addWidget(dev_title) @@ -545,9 +558,9 @@ class ServerAppGUI(QMainWindow): hist_layout.setSpacing(10) hist_header = QHBoxLayout() - hist_title = QLabel("CRONOLOGIA SCANSIONI LIVE") + hist_title = QLabel(tr("card_history_title")) hist_title.setStyleSheet("font-size: 11px; font-weight: 700; color: #94A3B8;") - btn_clear = QPushButton("Pulisci Log") + btn_clear = QPushButton(tr("btn_clear_log")) btn_clear.setCursor(Qt.CursorShape.PointingHandCursor) btn_clear.clicked.connect(self._clear_scan_log) hist_header.addWidget(hist_title) @@ -556,7 +569,9 @@ class ServerAppGUI(QMainWindow): hist_layout.addLayout(hist_header) self.table = QTableWidget(0, 4) - self.table.setHorizontalHeaderLabels(["Ora", "Dispositivo", "Codice Letto", "Esito"]) + self.table.setHorizontalHeaderLabels( + [tr("col_time"), tr("col_device"), tr("col_code"), tr("col_status")] + ) self.table.setEditTriggers(QTableWidget.EditTrigger.NoEditTriggers) self.table.setSelectionBehavior(QTableWidget.SelectionBehavior.SelectRows) self.table.setAlternatingRowColors(True) @@ -596,7 +611,7 @@ class ServerAppGUI(QMainWindow): container.setContentsMargins(24, 22, 24, 22) container.setSpacing(14) - sec1 = QLabel("RETE E IDENTIFICAZIONE") + sec1 = QLabel(tr("sec_network")) sec1.setStyleSheet("font-size: 12px; font-weight: 700; color: #38BDF8;") container.addWidget(sec1) @@ -606,32 +621,32 @@ class ServerAppGUI(QMainWindow): self.inp_name = QLineEdit(self.config.get("server_name", socket.gethostname())) self.inp_pin = QLineEdit(self.config.get("pin", "")) - self.inp_pin.setPlaceholderText("Lascia vuoto per accesso libero") + self.inp_pin.setPlaceholderText(tr("placeholder_pin")) self.inp_port = QLineEdit(str(self.config.get("port", 8765))) self.inp_port.setMaximumWidth(120) port_row = QHBoxLayout() port_row.addWidget(self.inp_port) - port_hint = QLabel("(Il cambio porta richiede riavvio)") + port_hint = QLabel(tr("port_restart_hint")) port_hint.setStyleSheet("color: #64748B; font-size: 12px;") port_row.addWidget(port_hint) port_row.addStretch(1) - form.addRow("Nome visualizzato nell'app mobile:", self.inp_name) - form.addRow("PIN di accesso (es. 4 cifre):", self.inp_pin) - form.addRow("Porta Server WebSocket:", port_row) + form.addRow(tr("lbl_mobile_name"), self.inp_name) + form.addRow(tr("lbl_pin_input"), self.inp_pin) + form.addRow(tr("lbl_ws_port"), port_row) container.addLayout(form) - sec2 = QLabel("COMPORTAMENTO TASTIERA") + sec2 = QLabel(tr("sec_keyboard")) sec2.setStyleSheet("font-size: 12px; font-weight: 700; color: #38BDF8; margin-top: 8px;") container.addWidget(sec2) self.grp_suffix = QButtonGroup(self) suffix_row = QHBoxLayout() - suffix_row.addWidget(QLabel("Tasto finale dopo ogni scansione:")) - self.rb_suffix_enter = QRadioButton("Invio (Enter)") - self.rb_suffix_tab = QRadioButton("Tabulatore (Tab)") - self.rb_suffix_none = QRadioButton("Nessun tasto") + suffix_row.addWidget(QLabel(tr("lbl_suffix"))) + self.rb_suffix_enter = QRadioButton(tr("rb_suffix_enter")) + self.rb_suffix_tab = QRadioButton(tr("rb_suffix_tab")) + self.rb_suffix_none = QRadioButton(tr("rb_suffix_none")) self._suffix_map = { "enter": self.rb_suffix_enter, "tab": self.rb_suffix_tab, @@ -646,9 +661,9 @@ class ServerAppGUI(QMainWindow): self.grp_mode = QButtonGroup(self) mode_row = QHBoxLayout() - mode_row.addWidget(QLabel("Modalità di scrittura:")) - self.rb_mode_type = QRadioButton("Digitazione tastiera reale (Consigliato)") - self.rb_mode_paste = QRadioButton("Incolla da appunti (Ctrl+V / Cmd+V)") + mode_row.addWidget(QLabel(tr("lbl_typing_mode"))) + self.rb_mode_type = QRadioButton(tr("rb_mode_type")) + self.rb_mode_paste = QRadioButton(tr("rb_mode_paste")) self._mode_map = {"type": self.rb_mode_type, "paste": self.rb_mode_paste} for rb in self._mode_map.values(): self.grp_mode.addButton(rb) @@ -657,46 +672,50 @@ class ServerAppGUI(QMainWindow): self._mode_map.get(self.config.get("mode", "type"), self.rb_mode_type).setChecked(True) container.addLayout(mode_row) - sec3 = QLabel("AVVIO AUTOMATICO, TRAY E AGGIORNAMENTI") + sec3 = QLabel(tr("sec_system")) sec3.setStyleSheet("font-size: 12px; font-weight: 700; color: #38BDF8; margin-top: 8px;") container.addWidget(sec3) - self.chk_autostart = QCheckBox( - "Avvia automaticamente all'avvio del sistema operativo (Login / Boot)" - ) + self.chk_autostart = QCheckBox(tr("chk_autostart")) self.chk_autostart.setChecked(is_autostart_enabled()) container.addWidget(self.chk_autostart) - self.chk_tray = QCheckBox( - "Alla chiusura (X) riduci nella System Tray invece di terminare" - ) + self.chk_tray = QCheckBox(tr("chk_tray")) self.chk_tray.setChecked(bool(self.config.get("minimize_to_tray", True))) container.addWidget(self.chk_tray) - self.chk_updates = QCheckBox( - "Controlla automaticamente nuovi aggiornamenti all'avvio" - ) + self.chk_updates = QCheckBox(tr("chk_updates")) self.chk_updates.setChecked(bool(self.config.get("check_updates", True))) container.addWidget(self.chk_updates) adv_form = QFormLayout() adv_form.setHorizontalSpacing(18) + self.cmb_language = QComboBox() + self.cmb_language.addItem(tr("lang_auto"), "auto") + self.cmb_language.addItem(tr("lang_it"), "it") + self.cmb_language.addItem(tr("lang_en"), "en") + current_lang_pref = self.config.get("language", "auto") + lang_idx = self.cmb_language.findData(current_lang_pref) + if lang_idx >= 0: + self.cmb_language.setCurrentIndex(lang_idx) + adv_form.addRow(tr("lbl_language"), self.cmb_language) + self.inp_update_url = QLineEdit(self.config.get("update_url", "")) - self.inp_update_url.setPlaceholderText("Vuoto = Gitea Releases (gitea.catelli.it)") - adv_form.addRow("URL aggiornamento custom (opzionale):", self.inp_update_url) + self.inp_update_url.setPlaceholderText(tr("placeholder_update_url")) + adv_form.addRow(tr("lbl_update_url"), self.inp_update_url) container.addLayout(adv_form) update_row = QHBoxLayout() - self.btn_check_updates = QPushButton("Controlla Aggiornamenti Ora") + self.btn_check_updates = QPushButton(tr("btn_check_updates")) self.btn_check_updates.setCursor(Qt.CursorShape.PointingHandCursor) self.btn_check_updates.clicked.connect(lambda: self.check_updates_async(manual=True)) - self.lbl_update_status = QLabel(f"Versione installata: v{APP_VERSION}") + self.lbl_update_status = QLabel(tr("installed_version", version=APP_VERSION)) self.lbl_update_status.setStyleSheet("color: #94A3B8; font-size: 12px;") update_row.addWidget(self.btn_check_updates) update_row.addWidget(self.lbl_update_status, stretch=1) container.addLayout(update_row) - btn_save = QPushButton("Salva ed Applica Impostazioni") + btn_save = QPushButton(tr("btn_save_settings")) btn_save.setObjectName("PrimaryBtn") btn_save.setCursor(Qt.CursorShape.PointingHandCursor) btn_save.clicked.connect(self._save_settings_action) @@ -723,7 +742,7 @@ class ServerAppGUI(QMainWindow): if clipboard is not None: clipboard.setText(self.server.local_ip) QMessageBox.information( - self, "Copia", f"Indirizzo IP ({self.server.local_ip}) copiato negli appunti!" + self, tr("msg_copy_title"), tr("msg_copy_body", ip=self.server.local_ip) ) def _clear_scan_log(self) -> None: @@ -733,10 +752,10 @@ class ServerAppGUI(QMainWindow): try: port = int(self.inp_port.text().strip()) if not (1 <= port <= 65535): - raise ValueError("Porta fuori intervallo") + raise ValueError("Port out of range") except ValueError: QMessageBox.critical( - self, "Errore", "La porta deve essere un numero valido (es. 8765)." + self, tr("msg_error_title"), tr("msg_port_invalid") ) return @@ -746,6 +765,8 @@ class ServerAppGUI(QMainWindow): selected_mode = next( (key for key, btn in self._mode_map.items() if btn.isChecked()), "type" ) + selected_lang = self.cmb_language.currentData() or "auto" + prev_resolved_lang = get_language() new_config = { "server_name": self.inp_name.text().strip() or socket.gethostname(), @@ -756,6 +777,7 @@ class ServerAppGUI(QMainWindow): "minimize_to_tray": self.chk_tray.isChecked(), "check_updates": self.chk_updates.isChecked(), "update_url": self.inp_update_url.text().strip(), + "language": selected_lang, } autostart_desired = self.chk_autostart.isChecked() @@ -764,16 +786,21 @@ class ServerAppGUI(QMainWindow): self.server.update_settings(new_config) self.config = load_config() + new_resolved_lang = set_language(selected_lang) + self.tray.retranslate() self.lbl_name.setText(self.server.server_name) - pin_text = new_config["pin"] if new_config["pin"] else "Nessuno (Libero)" + pin_text = new_config["pin"] if new_config["pin"] else tr("pin_none") self.lbl_pin.setText(pin_text) self.lbl_port.setText(str(port)) self._refresh_qr_display() - QMessageBox.information( - self, "Impostazioni", "Impostazioni salvate ed applicate con successo!" + msg_key = ( + "msg_settings_saved_restart_lang" + if new_resolved_lang != prev_resolved_lang + else "msg_settings_saved" ) + QMessageBox.information(self, tr("msg_settings_title"), tr(msg_key)) def toggle_listening(self) -> None: new_state = not self.server.is_listening @@ -781,19 +808,19 @@ class ServerAppGUI(QMainWindow): def _update_status_badge(self, is_listening: bool) -> None: if is_listening: - self.status_badge.setText("● IN ASCOLTO") + self.status_badge.setText(tr("status_listening_badge")) self.status_badge.setStyleSheet( "background-color: #064E3B; color: #10B981; border-radius: 6px;" "padding: 6px 12px; font-weight: 700;" ) - self.btn_toggle.setText("Metti in Pausa") + self.btn_toggle.setText(tr("btn_pause")) else: - self.status_badge.setText("○ IN PAUSA") + self.status_badge.setText(tr("status_paused_badge")) self.status_badge.setStyleSheet( "background-color: #451A03; color: #F59E0B; border-radius: 6px;" "padding: 6px 12px; font-weight: 700;" ) - self.btn_toggle.setText("Riprendi Ricezione") + self.btn_toggle.setText(tr("btn_resume")) def _on_status_changed(self, is_listening: bool) -> None: self._update_status_badge(is_listening) @@ -801,7 +828,7 @@ class ServerAppGUI(QMainWindow): def _on_scan_received(self, code: str, source: str, success: bool) -> None: timestamp = datetime.now().strftime("%H:%M:%S") - status_str = "Digitato ✓" if success else "Fallito ✗" + status_str = tr("scan_typed") if success else tr("scan_failed") status_color = QColor("#10B981") if success else QColor("#EF4444") self.table.insertRow(0) @@ -817,10 +844,12 @@ class ServerAppGUI(QMainWindow): def _on_devices_changed(self, devices: list[str]) -> None: if not devices: - self.lbl_devices.setText("Nessun dispositivo mobile collegato.") + self.lbl_devices.setText(tr("no_devices_connected")) self.lbl_devices.setStyleSheet("color: #64748B;") else: - self.lbl_devices.setText(f"{len(devices)} collegati: " + ", ".join(devices)) + self.lbl_devices.setText( + tr("devices_connected_fmt", count=len(devices), devices=", ".join(devices)) + ) self.lbl_devices.setStyleSheet("color: #10B981; font-weight: 600;") def check_updates_async(self, manual: bool = False) -> None: @@ -830,7 +859,7 @@ class ServerAppGUI(QMainWindow): if manual: self.btn_check_updates.setEnabled(False) - self.lbl_update_status.setText("Ricerca aggiornamenti in corso...") + self.lbl_update_status.setText(tr("checking_updates")) update_url = self.inp_update_url.text().strip() if manual else self.config.get("update_url", "") self._update_worker = _UpdateCheckWorker(APP_VERSION, update_url, manual, self) @@ -839,27 +868,31 @@ class ServerAppGUI(QMainWindow): def _on_update_check_finished(self, result: UpdateCheckResult, manual: bool) -> None: self.btn_check_updates.setEnabled(True) - self.lbl_update_status.setText(result.message or f"Versione installata: v{APP_VERSION}") + self.lbl_update_status.setText( + result.message or tr("installed_version", version=APP_VERSION) + ) if result.status == "update_available" and result.release is not None: self._pending_update = result - self.btn_update_banner.setText(f"Aggiorna a v{result.release.version}") + self.btn_update_banner.setText( + tr("update_to_version_btn", version=result.release.version) + ) self.btn_update_banner.setVisible(True) if manual or self.isVisible(): self._show_update_dialog(result) elif self._tray_available: self.tray.show_message( - f"Aggiornamento disponibile (v{result.release.version})", - "Apri la finestra di Barcode Reader Server per installarlo automaticamente.", + tr("tray_update_title", version=result.release.version), + tr("tray_update_body"), ) return if manual: if result.status == "up_to_date": - QMessageBox.information(self, "Aggiornamenti", result.message) + QMessageBox.information(self, tr("updates_dialog_title"), result.message) else: - QMessageBox.warning(self, "Controllo Aggiornamenti", result.message) + QMessageBox.warning(self, tr("updates_check_title"), result.message) def _open_pending_update_dialog(self) -> None: if self._pending_update and self._pending_update.release: diff --git a/server/i18n.py b/server/i18n.py new file mode 100644 index 0000000..03f017d --- /dev/null +++ b/server/i18n.py @@ -0,0 +1,253 @@ +"""Internationalization (i18n) helper for Barcode Reader PC Server (IT / EN).""" + +from __future__ import annotations + +import locale +import os + +_CURRENT_LANG = "en" + +TRANSLATIONS: dict[str, dict[str, str]] = { + "en": { + "app_subtitle": "Receive barcodes from Smartphone • Catelli Srl • v{version}", + "update_available_btn": "Update available", + "update_to_version_btn": "Update to v{version}", + "tab_dashboard": "Dashboard & Devices", + "tab_settings": "Settings", + "card_qr_title": "QUICK CONNECT (QR)", + "qr_hint": "Scan with the Android/iOS app", + "card_server_title": "SERVER DETAILS", + "lbl_local_ip": "Local IP Address:", + "lbl_port": "Port:", + "lbl_pc_name": "PC Name:", + "lbl_pin": "Access PIN:", + "pin_none": "None (Open)", + "btn_copy_ip": "Copy IP", + "btn_open_web": "Open Web Dashboard", + "card_devices_title": "CONNECTED DEVICES", + "no_devices_connected": "No mobile device connected.", + "devices_connected_fmt": "{count} connected: {devices}", + "card_history_title": "LIVE SCAN HISTORY", + "btn_clear_log": "Clear Log", + "col_time": "Time", + "col_device": "Device", + "col_code": "Scanned Code", + "col_status": "Status", + "scan_typed": "Typed ✓", + "scan_failed": "Failed ✗", + "status_listening_badge": "● LISTENING", + "status_paused_badge": "○ PAUSED", + "status_listening_short": "LISTENING", + "status_paused_short": "PAUSED", + "btn_pause": "Pause", + "btn_resume": "Resume Listening", + "sec_network": "NETWORK & IDENTIFICATION", + "lbl_mobile_name": "Name shown in mobile app:", + "lbl_pin_input": "Access PIN (e.g. 4 digits):", + "placeholder_pin": "Leave empty for open access", + "lbl_ws_port": "WebSocket Server Port:", + "port_restart_hint": "(Changing port requires restart)", + "sec_keyboard": "KEYBOARD BEHAVIOR", + "lbl_suffix": "Trailing key after each scan:", + "rb_suffix_enter": "Enter", + "rb_suffix_tab": "Tab", + "rb_suffix_none": "No key", + "lbl_typing_mode": "Input mode:", + "rb_mode_type": "Real keyboard typing (Recommended)", + "rb_mode_paste": "Paste from clipboard (Ctrl+V / Cmd+V)", + "sec_system": "AUTOSTART, TRAY, LANGUAGE & UPDATES", + "chk_autostart": "Start automatically at OS login (Autostart)", + "chk_tray": "Minimize to System Tray on close (X) instead of quitting", + "chk_updates": "Check for updates automatically on startup", + "lbl_language": "Interface language:", + "lang_auto": "System default (Auto)", + "lang_it": "Italiano", + "lang_en": "English", + "lbl_update_url": "Custom update URL (optional):", + "placeholder_update_url": "Empty = Gitea Releases (gitea.catelli.it)", + "btn_check_updates": "Check for Updates Now", + "installed_version": "Installed version: v{version}", + "btn_save_settings": "Save & Apply Settings", + "msg_copy_title": "Copied", + "msg_copy_body": "IP address ({ip}) copied to clipboard!", + "msg_error_title": "Error", + "msg_port_invalid": "Port must be a valid number (e.g. 8765).", + "msg_settings_title": "Settings", + "msg_settings_saved": "Settings saved and applied successfully!", + "msg_settings_saved_restart_lang": "Settings saved! Restart the app to apply the new language everywhere.", + "checking_updates": "Checking for updates...", + "tray_show_window": "Show Window", + "tray_pause": "Pause", + "tray_resume": "Resume Listening", + "tray_open_web": "Open Web Dashboard", + "tray_check_updates": "Check for Updates...", + "tray_quit": "Quit", + "tray_update_title": "Update available (v{version})", + "tray_update_body": "Open Barcode Reader Server to install it automatically.", + "updates_dialog_title": "Updates", + "updates_check_title": "Update Check", + "update_win_title": "Update Available — v{version}", + "update_new_version": "New version available: v{version}", + "update_installed_sub": "Installed version: v{version} • {title}", + "update_no_notes": "No release notes provided.", + "update_no_asset": "No platform-specific package found in this release.", + "update_ready_pkg": "Package ready to install: {name}{size}", + "btn_later": "Later", + "btn_open_release_page": "Open Release Page", + "btn_update_restart": "Update & Restart", + "update_downloading": "Downloading {name}...", + "update_downloading_pct": "Downloading: {done:.1f} / {total:.1f} MB ({percent}%)", + "update_downloading_mb": "Downloaded {done:.1f} MB...", + "update_installing": "Installing update and restarting...", + "update_apply_error": "Failed to launch update: {error}", + "update_error_prefix": "Error: {error}", + "update_error_title": "Update Error", + }, + "it": { + "app_subtitle": "Ricezione codici a barre da Smartphone • Catelli Srl • v{version}", + "update_available_btn": "Aggiornamento disponibile", + "update_to_version_btn": "Aggiorna a v{version}", + "tab_dashboard": "Dashboard & Dispositivi", + "tab_settings": "Impostazioni", + "card_qr_title": "CONNESSIONE RAPIDA (QR)", + "qr_hint": "Inquadra con l'app Android/iOS", + "card_server_title": "DETTAGLI SERVER", + "lbl_local_ip": "Indirizzo IP Locale:", + "lbl_port": "Porta:", + "lbl_pc_name": "Nome PC:", + "lbl_pin": "PIN di Accesso:", + "pin_none": "Nessuno (Libero)", + "btn_copy_ip": "Copia IP", + "btn_open_web": "Apri Dashboard Web", + "card_devices_title": "DISPOSITIVI CONNESSI", + "no_devices_connected": "Nessun dispositivo mobile collegato.", + "devices_connected_fmt": "{count} collegati: {devices}", + "card_history_title": "CRONOLOGIA SCANSIONI LIVE", + "btn_clear_log": "Pulisci Log", + "col_time": "Ora", + "col_device": "Dispositivo", + "col_code": "Codice Letto", + "col_status": "Esito", + "scan_typed": "Digitato ✓", + "scan_failed": "Fallito ✗", + "status_listening_badge": "● IN ASCOLTO", + "status_paused_badge": "○ IN PAUSA", + "status_listening_short": "IN ASCOLTO", + "status_paused_short": "IN PAUSA", + "btn_pause": "Metti in Pausa", + "btn_resume": "Riprendi Ricezione", + "sec_network": "RETE E IDENTIFICAZIONE", + "lbl_mobile_name": "Nome visualizzato nell'app mobile:", + "lbl_pin_input": "PIN di accesso (es. 4 cifre):", + "placeholder_pin": "Lascia vuoto per accesso libero", + "lbl_ws_port": "Porta Server WebSocket:", + "port_restart_hint": "(Il cambio porta richiede riavvio)", + "sec_keyboard": "COMPORTAMENTO TASTIERA", + "lbl_suffix": "Tasto finale dopo ogni scansione:", + "rb_suffix_enter": "Invio (Enter)", + "rb_suffix_tab": "Tabulatore (Tab)", + "rb_suffix_none": "Nessun tasto", + "lbl_typing_mode": "Modalità di scrittura:", + "rb_mode_type": "Digitazione tastiera reale (Consigliato)", + "rb_mode_paste": "Incolla da appunti (Ctrl+V / Cmd+V)", + "sec_system": "AVVIO AUTOMATICO, TRAY, LINGUA E AGGIORNAMENTI", + "chk_autostart": "Avvia automaticamente all'avvio del sistema operativo (Login / Boot)", + "chk_tray": "Alla chiusura (X) riduci nella System Tray invece di terminare", + "chk_updates": "Controlla automaticamente nuovi aggiornamenti all'avvio", + "lbl_language": "Lingua interfaccia:", + "lang_auto": "Predefinita di sistema (Auto)", + "lang_it": "Italiano", + "lang_en": "English", + "lbl_update_url": "URL aggiornamento custom (opzionale):", + "placeholder_update_url": "Vuoto = Gitea Releases (gitea.catelli.it)", + "btn_check_updates": "Controlla Aggiornamenti Ora", + "installed_version": "Versione installata: v{version}", + "btn_save_settings": "Salva ed Applica Impostazioni", + "msg_copy_title": "Copia", + "msg_copy_body": "Indirizzo IP ({ip}) copiato negli appunti!", + "msg_error_title": "Errore", + "msg_port_invalid": "La porta deve essere un numero valido (es. 8765).", + "msg_settings_title": "Impostazioni", + "msg_settings_saved": "Impostazioni salvate ed applicate con successo!", + "msg_settings_saved_restart_lang": "Impostazioni salvate! Riavvia l'app per applicare completamente la nuova lingua.", + "checking_updates": "Ricerca aggiornamenti in corso...", + "tray_show_window": "Mostra Finestra", + "tray_pause": "Metti in Pausa", + "tray_resume": "Riprendi Ascolto", + "tray_open_web": "Apri Dashboard Web", + "tray_check_updates": "Controlla Aggiornamenti...", + "tray_quit": "Esci", + "tray_update_title": "Aggiornamento disponibile (v{version})", + "tray_update_body": "Apri la finestra di Barcode Reader Server per installarlo automaticamente.", + "updates_dialog_title": "Aggiornamenti", + "updates_check_title": "Controllo Aggiornamenti", + "update_win_title": "Aggiornamento Disponibile — v{version}", + "update_new_version": "Nuova versione disponibile: v{version}", + "update_installed_sub": "Versione installata: v{version} • {title}", + "update_no_notes": "Nessuna nota di rilascio specificata.", + "update_no_asset": "Nessun pacchetto specifico trovato per questa piattaforma negli asset della release.", + "update_ready_pkg": "Pacchetto pronto per l'installazione: {name}{size}", + "btn_later": "Più Tardi", + "btn_open_release_page": "Apri Pagina Release", + "btn_update_restart": "Aggiorna e Riavvia", + "update_downloading": "Scaricamento di {name}...", + "update_downloading_pct": "Scaricamento: {done:.1f} / {total:.1f} MB ({percent}%)", + "update_downloading_mb": "Scaricati {done:.1f} MB...", + "update_installing": "Installazione aggiornamento e riavvio in corso...", + "update_apply_error": "Errore avvio aggiornamento: {error}", + "update_error_prefix": "Errore: {error}", + "update_error_title": "Errore Aggiornamento", + }, +} + + +def detect_system_language() -> str: + """Detect OS locale and return 'it' for Italian, 'en' otherwise.""" + try: + from PySide6.QtCore import QLocale + + qt_lang = QLocale.system().name().lower() + if qt_lang.startswith("it"): + return "it" + if qt_lang: + return "en" + except Exception: + pass + + for candidate in ( + os.environ.get("LC_ALL"), + os.environ.get("LC_MESSAGES"), + os.environ.get("LANG"), + ): + if candidate: + return "it" if candidate.lower().startswith("it") else "en" + + try: + loc, _ = locale.getlocale() + if loc and loc.lower().startswith("it"): + return "it" + except Exception: + pass + + return "en" + + +def set_language(lang_code: str | None) -> str: + """Set active language ('auto', 'it', 'en') and return the resolved language code.""" + global _CURRENT_LANG + normalized = (lang_code or "auto").strip().lower() + if normalized in ("it", "en"): + _CURRENT_LANG = normalized + else: + _CURRENT_LANG = detect_system_language() + return _CURRENT_LANG + + +def get_language() -> str: + return _CURRENT_LANG + + +def tr(key: str, **kwargs) -> str: + table = TRANSLATIONS.get(_CURRENT_LANG, TRANSLATIONS["en"]) + template = table.get(key, TRANSLATIONS["en"].get(key, key)) + return template.format(**kwargs) if kwargs else template diff --git a/server/tests/test_server_app.py b/server/tests/test_server_app.py index 103c81e..d155118 100644 --- a/server/tests/test_server_app.py +++ b/server/tests/test_server_app.py @@ -203,7 +203,14 @@ class QtGuiAndTrayTests(unittest.TestCase): self.assertEqual(gui.table.rowCount(), 1) self.assertIn("Pixel 8", gui.lbl_devices.text()) self.assertFalse(dummy.is_listening) - self.assertIn("IN PAUSA", gui.status_badge.text()) + import i18n + self.assertIn(i18n.tr("status_paused_short"), gui.status_badge.text()) + + # Verifica traduzioni IT/EN + i18n.set_language("it") + self.assertEqual(i18n.tr("tab_settings"), "Impostazioni") + i18n.set_language("en") + self.assertEqual(i18n.tr("tab_settings"), "Settings") # Smoke test UpdateDialog rel = updater.ReleaseInfo( diff --git a/server/tray.py b/server/tray.py index 7acea08..ba9f240 100644 --- a/server/tray.py +++ b/server/tray.py @@ -8,6 +8,7 @@ from PySide6.QtCore import QObject, Qt from PySide6.QtGui import QAction, QColor, QFont, QIcon, QPainter, QPainterPath, QPen, QPixmap from PySide6.QtWidgets import QMenu, QSystemTrayIcon +from i18n import tr from version import APP_NAME, APP_VERSION, get_resource_path @@ -124,7 +125,7 @@ class ServerTrayIcon(QObject): self._action_status.setEnabled(False) self._menu.addAction(self._action_status) - self._action_show = QAction("Mostra Finestra", self._menu) + self._action_show = QAction(tr("tray_show_window"), self._menu) show_font = QFont(self._action_show.font()) show_font.setBold(True) self._action_show.setFont(show_font) @@ -137,17 +138,17 @@ class ServerTrayIcon(QObject): self._action_toggle.triggered.connect(self.on_toggle_listening) self._menu.addAction(self._action_toggle) - self._action_web = QAction("Apri Dashboard Web", self._menu) + self._action_web = QAction(tr("tray_open_web"), self._menu) self._action_web.triggered.connect(self.on_open_web) self._menu.addAction(self._action_web) - self._action_updates = QAction("Controlla Aggiornamenti...", self._menu) + self._action_updates = QAction(tr("tray_check_updates"), self._menu) self._action_updates.triggered.connect(self.on_check_updates) self._menu.addAction(self._action_updates) self._menu.addSeparator() - self._action_quit = QAction("Esci", self._menu) + self._action_quit = QAction(tr("tray_quit"), self._menu) self._action_quit.triggered.connect(self.on_quit) self._menu.addAction(self._action_quit) @@ -169,14 +170,26 @@ class ServerTrayIcon(QObject): icon.addPixmap(create_status_pixmap(is_listening, 64)) self._tray.setIcon(icon) - status_text = "IN ASCOLTO" if is_listening else "IN PAUSA" + status_text = tr("status_listening_short") if is_listening else tr("status_paused_short") self._tray.setToolTip(f"{APP_NAME} v{APP_VERSION} — {status_text}") if self._action_status is not None: marker = "●" if is_listening else "○" self._action_status.setText(f"{marker} {status_text} (v{APP_VERSION})") if self._action_toggle is not None: - self._action_toggle.setText("Metti in Pausa" if is_listening else "Riprendi Ascolto") + self._action_toggle.setText(tr("tray_pause") if is_listening else tr("tray_resume")) + + def retranslate(self) -> None: + """Aggiorna le etichette del menu tray dopo un cambio lingua.""" + if self._action_show is not None: + self._action_show.setText(tr("tray_show_window")) + if self._action_web is not None: + self._action_web.setText(tr("tray_open_web")) + if self._action_updates is not None: + self._action_updates.setText(tr("tray_check_updates")) + if self._action_quit is not None: + self._action_quit.setText(tr("tray_quit")) + self.update_status(self.is_listening) def show_message(self, title: str, message: str, duration_ms: int = 5000) -> None: """Mostra una notifica desktop nativa tramite la System Tray."""