import React, { createContext, useContext, useState } from 'react';

interface I18nContextType {
  language: string;
  changeLanguage: (lang: string) => void;
  t: (key: string) => string;
}

const I18nContext = createContext<I18nContextType | undefined>(undefined);

const translations: Record<string, Record<string, string>> = {
  en: {
    'app.title': 'SAP Business One ↔ Plesk Sync',
    'login.title': 'Login',
    'login.subtitle': 'Please sign in to continue',
    'login.username': 'Username',
    'login.password': 'Password',
    'login.submit': 'Login',
    'dashboard.title': 'Dashboard',
    'dashboard.sync_status': 'Sync Status',
    'dashboard.health_status': 'Health Status',
    'dashboard.recent_jobs': 'Recent Jobs',
    'settings.title': 'Settings',
    'settings.profile': 'Profile',
    'settings.security': 'Security',
    'settings.sync': 'Sync Settings',
    'settings.notifications': 'Notifications',
    'settings.username': 'Username',
    'settings.email': 'Email',
    'settings.language': 'Language',
    'settings.lang_german': 'German',
    'settings.lang_english': 'English',
    'settings.lang_french': 'French',
    'settings.lang_spanish': 'Spanish',
    'settings.change_password': 'Change Password',
    'settings.current_password': 'Current Password',
    'settings.new_password': 'New Password',
    'settings.confirm_password': 'Confirm New Password',
    'settings.password_helper': 'Min 8 chars, uppercase, lowercase, digit, special char',
    'settings.save': 'Save',
    'settings.two_factor': 'Two-Factor Authentication',
    'settings.mfa_coming_soon': 'MFA will be available in a later backend update',
    'settings.sync_direction': 'Default Sync Direction',
    'settings.conflict_resolution': 'Conflict Resolution',
    'settings.sync_interval': 'Sync Interval (minutes)',
    'settings.email_notifications': 'Enable Email Notifications',
    'settings.webhook_notifications': 'Enable Webhook Notifications',
    'settings.bidirectional': 'Bidirectional',
    'nav.sync': 'Sync',
    'nav.simulation': 'Simulation',
    'nav.reports': 'Reports',
    'nav.settings': 'Settings',
    'nav.logout': 'Logout',
    'wizard.welcome': 'Welcome',
    'wizard.plesk': 'Plesk',
    'wizard.sap': 'SAP B1',
    'wizard.sync': 'Sync Settings',
    'wizard.complete': 'Complete',
    'wizard.welcome_title': 'Setup Wizard',
    'wizard.welcome_desc': 'Configure your SAP Business One and Plesk connections to start synchronizing data.',
    'wizard.plesk_setup': 'Plesk Setup',
    'wizard.plesk_setup_desc': 'Configure your Plesk server API credentials.',
    'wizard.sap_setup': 'SAP Business One Setup',
    'wizard.sap_setup_desc': 'Configure your SAP B1 server connection.',
    'wizard.plesk_config': 'Plesk Configuration',
    'wizard.plesk_config_desc': 'Enter your Plesk server details and API credentials.',
    'wizard.sap_config': 'SAP Business One Configuration',
    'wizard.sap_config_desc': 'Enter your SAP B1 server connection details.',
    'wizard.sync_config': 'Synchronization Settings',
    'wizard.sync_config_desc': 'Configure how data will be synchronized between SAP and Plesk.',
    'wizard.plesk_host': 'Plesk Host',
    'wizard.sap_host': 'SAP Host',
    'wizard.port': 'Port',
    'wizard.username': 'Username',
    'wizard.password': 'Password',
    'wizard.api_key': 'API Key (Optional)',
    'wizard.api_key_helper': 'Alternative to username/password authentication',
    'wizard.company_db': 'Company Database',
    'wizard.company_db_helper': 'The SAP B1 company database name (e.g., SBODEMO_DE)',
    'wizard.test_connection': 'Test Connection',
    'wizard.connection_ok': 'Connection successful!',
    'wizard.connection_failed': 'Connection failed',
    'wizard.plesk_success': 'Plesk connection successful!',
    'wizard.plesk_error': 'Plesk connection failed',
    'wizard.sap_success': 'SAP connection successful!',
    'wizard.sap_error': 'SAP connection failed',
    'wizard.sync_direction': 'Sync Direction',
    'wizard.sync_interval': 'Sync Interval',
    'wizard.minutes': 'minutes',
    'wizard.conflict_resolution': 'Conflict Resolution',
    'wizard.sap_priority': 'SAP Priority',
    'wizard.plesk_priority': 'Plesk Priority',
    'wizard.timestamp_based': 'Timestamp Based',
    'wizard.manual': 'Manual',
    'wizard.bidirectional': 'Bidirectional',
    'wizard.back': 'Back',
    'wizard.next': 'Next',
    'wizard.complete_setup': 'Complete Setup',
    'wizard.save_success': 'Configuration saved successfully!',
    'wizard.save_error': 'Failed to save configuration',
    'wizard.setup_complete': 'Setup Complete!',
    'wizard.setup_complete_desc': 'Your SAP B1 and Plesk connections have been configured. You can now start synchronizing data.',
    'wizard.go_dashboard': 'Go to Dashboard',
    'simulation.title': 'Sync Simulation',
    'simulation.description': 'Preview what data would be synchronized between SAP and Plesk before running the actual sync.',
    'simulation.not_configured': 'Please configure your SAP and Plesk connections first.',
    'simulation.go_setup': 'Go to Setup',
    'simulation.data_type': 'Data Type',
    'simulation.direction': 'Direction',
    'simulation.bidirectional': 'Bidirectional',
    'simulation.run': 'Run Simulation',
    'simulation.running': 'Simulating...',
    'simulation.refresh': 'Refresh',
    'simulation.analyzing': 'Analyzing data sources...',
    'simulation.complete': 'Simulation complete!',
    'simulation.error': 'Simulation failed',
    'simulation.total': 'Total Records',
    'simulation.status_new': 'New',
    'simulation.status_update': 'Updated',
    'simulation.status_conflict': 'Conflicts',
    'simulation.status_unchanged': 'Unchanged',
    'simulation.status_delete': 'Deleted',
    'simulation.customers': 'Customers',
    'simulation.domains': 'Domains',
    'simulation.subscriptions': 'Subscriptions',
    'simulation.invoices': 'Invoices',
    'simulation.contacts': 'Contacts',
    'simulation.all': 'All',
    'simulation.col_status': 'Status',
    'simulation.col_source_id': 'Source ID',
    'simulation.col_target_id': 'Target ID',
    'simulation.col_name': 'Name',
    'simulation.col_actions': 'Actions',
    'simulation.col_field': 'Field',
    'simulation.col_source_value': 'Source Value',
    'simulation.col_target_value': 'Target Value',
    'simulation.view_details': 'View Details',
    'simulation.no_records': 'No records found',
    'simulation.details_title': 'Details',
    'simulation.source_data': 'Source Data (SAP)',
    'simulation.target_data': 'Target Data (Plesk)',
    'simulation.no_target_data': 'Record does not exist in target',
    'simulation.differences': 'Differences',
    'simulation.close': 'Close',
    'wizard.2fa_section': 'Two-Factor Authentication',
    'wizard.2fa_enabled': 'Enable 2FA for Plesk connection',
    'wizard.2fa_method': '2FA Method',
    'wizard.2fa_totp': 'Authenticator App (TOTP)',
    'wizard.2fa_sms': 'SMS Code',
    'wizard.2fa_email': 'Email Code',
    'wizard.2fa_totp_info': 'Use an authenticator app like Google Authenticator or Authy to generate codes.',
    'wizard.2fa_tunnel_info': 'When testing or connecting, the system will prompt for a 2FA code in real-time.',
    'wizard.2fa_title': 'Two-Factor Authentication',
    'wizard.2fa_enter_code': 'Enter the verification code from your authenticator app or device.',
    'wizard.2fa_code': 'Verification Code',
    'wizard.2fa_code_help': 'Enter the 6-digit code from your authenticator app or the code sent to you.',
    'wizard.2fa_verify': 'Verify Code',
    'wizard.2fa_invalid': 'Invalid code. Please try again.',
    'wizard.2fa_code_required': 'Please enter the verification code.',
    'wizard.2fa_channel': 'Delivery Channel',
    'wizard.cancel': 'Cancel',
    'common.cancel': 'Cancel',
    'common.save': 'Save',
    'common.delete': 'Delete',
    'common.edit': 'Edit',
    'common.refresh': 'Refresh',
    'common.close': 'Close',
    'common.add': 'Add',
    'common.update': 'Update',
    'nav.conflicts': 'Conflicts',
    'nav.billing': 'Billing',
    'nav.alerts': 'Alerts',
    'nav.servers': 'Servers',
    'nav.audit': 'Audit',
    'dashboard.sync_running': 'Sync is running...',
    'dashboard.no_sync': 'No sync running',
    'dashboard.running': 'Running',
    'dashboard.completed_today': 'Completed Today',
    'dashboard.failed_today': 'Failed Today',
    'dashboard.database': 'Database',
    'dashboard.healthy': 'Healthy',
    'dashboard.unhealthy': 'Unhealthy',
    'dashboard.no_recent_jobs': 'No recent jobs',
    'dashboard.job': 'Job',
    'dashboard.internal_db': 'Internal Database',
    'dashboard.connected': 'Connected',
    'dashboard.disconnected': 'Disconnected',
    'dashboard.no_plesk': 'No Plesk server configured',
    'dashboard.no_sap': 'No SAP server configured',
    'settingsSecurity.title': 'Security',
    'settingsSecurity.mfa': 'Multi-Factor Authentication',
    'settingsSecurity.mfaEnabled': 'MFA is currently enabled for your account.',
    'settingsSecurity.enableMfa': 'Enable MFA',
    'settingsSecurity.disableMfa': 'Disable',
    'settingsSecurity.changePassword': 'Change Password',
    'settingsSecurity.currentPassword': 'Current Password',
    'settingsSecurity.newPassword': 'New Password',
    'settingsSecurity.confirmPassword': 'Confirm New Password',
    'settingsSecurity.passwordHint': 'Password must be at least 8 characters long and contain uppercase, lowercase, numbers, and special characters.',
    'settingsSecurity.passwordChanged': 'Password changed successfully!',
    'settingsSecurity.passwordMismatch': 'Passwords do not match',
    'settingsSecurity.passwordTooShort': 'Password must be at least 8 characters',
    'settingsSecurity.mfaSetupTitle': 'Setup Multi-Factor Authentication',
    'settingsSecurity.mfaVerifyTitle': 'Verify Multi-Factor Authentication',
    'settingsSecurity.mfaSuccessTitle': 'MFA Enabled Successfully',
    'settingsSecurity.mfaSteps': 'To enable MFA, follow these steps:',
    'settingsSecurity.mfaStep1': 'Step 1: Scan QR Code',
    'settingsSecurity.mfaStep2': 'Step 2: Save Backup Codes',
    'settingsSecurity.mfaStep3': 'Step 3: Enter 6-digit Code',
    'settingsSecurity.mfaScanHint': 'Scan this QR code with your authenticator app (Google Authenticator, Authy, etc.)',
    'settingsSecurity.mfaBackupWarning': 'Save these backup codes in a safe place. You can use them to access your account if you lose your authenticator device.',
    'settingsSecurity.copy': 'Copy',
    'settingsSecurity.verificationCode': 'Verification Code',
    'settingsSecurity.continueVerify': 'Continue to Verification',
    'settingsSecurity.verifyEnable': 'Verify and Enable MFA',
    'settingsSecurity.mfaSuccess': 'MFA has been enabled successfully!',
    'settingsSecurity.mfaSuccessHint': 'Your account is now more secure. You will be redirected shortly.',
    'settingsSecurity.mfaInvalidCode': 'Invalid code. Please try again.',
    'settingsSecurity.mfaConfirmDisable': 'Are you sure you want to disable MFA?',
    'settingsProfile.title': 'Profile',
    'settingsProfile.comingSoon': 'Profile settings coming soon...',
    'settingsProfile.username': 'Username',
    'settingsProfile.email': 'Email',
    'settingsProfile.fullName': 'Full Name',
    'settingsProfile.company': 'Company',
    'settingsProfile.language': 'Language',
    'settingsProfile.save': 'Save Changes',
    'settingsProfile.success': 'Profile updated successfully!',
    'settingsSync.title': 'Sync Settings',
    'settingsSync.hint': 'Sync settings are now available in the Setup wizard.',
    'settingsSync.status': 'Status',
    'settingsSync.lastSync': 'Last Sync',
    'settingsSync.nextSync': 'Next Scheduled Sync',
    'settingsSync.jobs': 'Sync Jobs',
    'settingsSync.start': 'Start Sync',
    'settingsSync.stop': 'Stop Sync',
    'settingsSync.noJobs': 'No sync jobs found',
    'settingsSync.colType': 'Type',
    'settingsSync.colDirection': 'Direction',
    'settingsSync.colStatus': 'Status',
    'settingsSync.colStarted': 'Started',
    'settingsSync.colCompleted': 'Completed',
    'settingsSync.colProcessed': 'Processed',
    'settingsSync.colFailed': 'Failed',
    'settingsSync.running': 'Running',
    'settingsSync.completed': 'Completed',
    'settingsSync.failed': 'Failed',
    'settingsSync.pending': 'Pending',
    'settingsNotifications.title': 'Notifications',
    'settingsNotifications.comingSoon': 'Notification settings coming soon...',
    'settingsNotifications.webhooks': 'Webhooks',
    'settingsNotifications.webhookUrl': 'Webhook URL',
    'settingsNotifications.webhookType': 'Event Type',
    'settingsNotifications.addWebhook': 'Add Webhook',
    'settingsNotifications.webhooksList': 'Webhooks',
    'settingsNotifications.noWebhooks': 'No webhooks configured',
    'settingsNotifications.colUrl': 'URL',
    'settingsNotifications.colType': 'Event Type',
    'settingsNotifications.colActions': 'Actions',
    'settingsNotifications.delete': 'Delete',
    'settingsNotifications.deleteConfirm': 'Are you sure you want to delete this webhook?',
    'settingsNotifications.emailNotifications': 'Email Notifications',
    'settingsNotifications.emailNotificationsDesc': 'Receive email notifications for sync events',
    'settingsNotifications.webhookNotifications': 'Webhook Notifications',
    'settingsNotifications.webhookNotificationsDesc': 'Send notifications via webhooks',
    'settingsNotifications.save': 'Save Settings',
    'settingsNotifications.success': 'Notification settings saved!',
    'sync.title': 'Synchronization',
    'sync.running': 'Sync is running...',
    'sync.idle': 'Idle',
    'sync.startSync': 'Start Sync',
    'sync.stopSync': 'Stop Sync',
    'sync.syncJobs': 'Sync Jobs',
    'sync.startTitle': 'Start Synchronization',
    'sync.syncType': 'Sync Type',
    'sync.fullSync': 'Full Sync',
    'sync.incrementalSync': 'Incremental Sync',
    'sync.partialSync': 'Partial Sync',
    'sync.direction': 'Direction',
    'sync.start': 'Start',
    'sync.colId': 'ID',
    'sync.colType': 'Type',
    'sync.colDirection': 'Direction',
    'sync.colStatus': 'Status',
    'sync.colProcessed': 'Processed',
    'sync.colFailed': 'Failed',
    'sync.colStarted': 'Started',
    'sync.colCompleted': 'Completed',
    'sync.startedSuccess': 'Sync job started successfully',
    'sync.startFailed': 'Failed to start sync job',
    'sync.stoppedSuccess': 'Sync job stopped',
    'sync.stopFailed': 'Failed to stop sync job',
    'reports.title': 'Reports',
    'reports.reportType': 'Report Type',
    'reports.syncHistory': 'Sync History',
    'reports.usageMetrics': 'Usage Metrics',
    'reports.revenue': 'Revenue',
    'reports.dateRange': 'Date Range',
    'reports.last24h': 'Last 24 Hours',
    'reports.last7d': 'Last 7 Days',
    'reports.last30d': 'Last 30 Days',
    'reports.last90d': 'Last 90 Days',
    'reports.runningJobs': 'Running Jobs',
    'reports.completedToday': 'Completed Today',
    'reports.failedToday': 'Failed Today',
    'reports.reportRange': 'Report Range',
    'reports.syncActivity': 'Sync Activity (Last 7 Days)',
    'reports.completed': 'Completed',
    'reports.failed': 'Failed',
    'reports.downloadSuccess': 'Report downloaded successfully',
    'reports.exportFailed': 'Failed to export report',
    'reports.colId': 'ID',
    'reports.colSubscription': 'Subscription',
    'reports.colType': 'Type',
    'reports.colValue': 'Value',
    'reports.colUnit': 'Unit',
    'reports.colRecorded': 'Recorded',
    'conflicts.title': 'Conflicts',
    'conflicts.refresh': 'Refresh',
    'conflicts.entityType': 'Entity Type',
    'conflicts.entityId': 'Entity ID',
    'conflicts.sourceData': 'Source Data',
    'conflicts.targetData': 'Target Data',
    'conflicts.status': 'Status',
    'conflicts.actions': 'Actions',
    'conflicts.noConflicts': 'No conflicts found',
    'conflicts.resolve': 'Resolve',
    'conflicts.resolveConflict': 'Resolve Conflict',
    'conflicts.source': 'Source (SAP)',
    'conflicts.target': 'Target (Plesk)',
    'conflicts.resolutionAction': 'Resolution Action',
    'conflicts.keepSource': 'Keep Source',
    'conflicts.keepTarget': 'Keep Target',
    'conflicts.merge': 'Merge',
    'conflicts.skip': 'Skip',
    'conflicts.applyResolution': 'Apply Resolution',
    'billing.title': 'Billing',
    'billing.generate': 'Generate',
    'billing.refresh': 'Refresh',
    'billing.pricingSummary': 'Pricing Summary',
    'billing.active': 'Active',
    'billing.inactive': 'Inactive',
    'billing.noPricing': 'No pricing configured',
    'billing.records': 'Billing Records',
    'billing.customer': 'Customer',
    'billing.period': 'Period',
    'billing.amount': 'Amount',
    'billing.status': 'Status',
    'billing.created': 'Created',
    'billing.actions': 'Actions',
    'billing.noRecords': 'No billing records found',
    'billing.draft': 'Draft',
    'billing.pending': 'Pending',
    'billing.sent': 'Sent',
    'billing.synced': 'Synced',
    'billing.failed': 'Failed',
    'billing.preview': 'Preview',
    'billing.syncToSap': 'Sync to SAP',
    'billing.invoicePreview': 'Invoice Preview',
    'billing.invoiceTo': 'Invoice To',
    'billing.noLineItems': 'No line items',
    'billing.subtotal': 'Subtotal',
    'billing.tax': 'Tax (20%)',
    'billing.total': 'Total',
    'alerts.title': 'Alerts',
    'alerts.addThreshold': 'Add Threshold',
    'alerts.refresh': 'Refresh',
    'alerts.thresholds': 'Alert Thresholds',
    'alerts.noThresholds': 'No alert thresholds configured',
    'alerts.active': 'Active',
    'alerts.inactive': 'Inactive',
    'alerts.recentAlerts': 'Recent Alerts',
    'alerts.noRecentAlerts': 'No recent alerts',
    'alerts.value': 'Value',
    'alerts.triggeredAt': 'triggered at',
    'alerts.action': 'Action',
    'alerts.addThresholdTitle': 'Add Alert Threshold',
    'alerts.editThresholdTitle': 'Edit Alert Threshold',
    'alerts.name': 'Name',
    'alerts.metricType': 'Metric Type',
    'alerts.thresholdValue': 'Threshold Value',
    'alerts.unit': 'Unit',
    'alerts.comparison': 'Comparison',
    'alerts.subscription': 'Subscription (Optional)',
    'alerts.allSubscriptions': 'All Subscriptions',
    'alerts.notifyOnly': 'Notify only',
    'alerts.notifySuspend': 'Notify and Suspend',
    'alerts.notifyLimit': 'Notify and Limit',
    'alerts.colName': 'Name',
    'alerts.colMetric': 'Metric',
    'alerts.colThreshold': 'Threshold',
    'alerts.colAction': 'Action',
    'alerts.colStatus': 'Status',
    'alerts.colLastTriggered': 'Last Triggered',
    'alerts.colActions': 'Actions',
    'servers.title': 'Servers',
    'servers.refresh': 'Refresh',
    'servers.pleskServers': 'Plesk Servers',
    'servers.sapServers': 'SAP Servers',
    'servers.addPlesk': 'Add Plesk Server',
    'servers.addSap': 'Add SAP Server',
    'servers.noServers': 'No servers configured',
    'servers.colName': 'Name',
    'servers.colHost': 'Host',
    'servers.colPort': 'Port',
    'servers.colCompanyDb': 'Company DB',
    'servers.colStatus': 'Status',
    'servers.colLastConnected': 'Last Connected',
    'servers.colActions': 'Actions',
    'servers.test': 'Test',
    'servers.edit': 'Edit',
    'servers.delete': 'Delete',
    'servers.confirmDelete': 'Are you sure you want to delete this server?',
    'servers.editPlesk': 'Edit Plesk Server',
    'servers.editSap': 'Edit SAP Server',
    'servers.addPleskTitle': 'Add Plesk Server',
    'servers.addSapTitle': 'Add SAP Server',
    'servers.apiKey': 'API Key',
    'servers.username': 'Username',
    'servers.usernameOptional': 'Username (Optional)',
    'servers.password': 'Password',
    'servers.companyDb': 'Company Database',
    'audit.title': 'Audit',
    'audit.loginEvents': 'Login Events',
    'audit.syncEvents': 'Sync Events',
    'audit.filters': 'Filters',
    'audit.exportCsv': 'Export CSV',
    'audit.eventType': 'Event Type',
    'audit.allEvents': 'All Events',
    'audit.fromDate': 'From Date',
    'audit.toDate': 'To Date',
    'audit.auditLogs': 'Audit Logs',
    'audit.records': 'records',
    'audit.noLogs': 'No audit logs found',
    'audit.colId': 'ID',
    'audit.colUser': 'User',
    'audit.colEvent': 'Event',
    'audit.colIpAddress': 'IP Address',
    'audit.colUserAgent': 'User Agent',
    'audit.colJobId': 'Job ID',
    'audit.colEntityType': 'Entity Type',
    'audit.colEntityId': 'Entity ID',
    'audit.colAction': 'Action',
    'audit.colStatus': 'Status',
    'audit.colTimestamp': 'Timestamp',
    'audit.colActions': 'Actions',
    'audit.details': 'Details',
    'audit.detailsTitle': 'Audit Log Details',
    'audit.metadata': 'Metadata',
    'audit.userLogin': 'User Login',
    'audit.userLogout': 'User Logout',
    'audit.mfaEnabled': 'MFA Enabled',
    'audit.mfaDisabled': 'MFA Disabled',
    'audit.passwordChanged': 'Password Changed',
    'audit.fullSync': 'Full Sync',
    'audit.incrementalSync': 'Incremental Sync',
    'audit.partialSync': 'Partial Sync',
    'audit.manualSync': 'Manual Sync',
    'login.success': 'Login successful!',
    'login.failed': 'Login failed',
    'login.failedHint': 'Login failed. Please check your credentials.',
  },
  de: {
    'app.title': 'SAP Business One ↔ Plesk Synchronisation',
    'login.title': 'Anmelden',
    'login.subtitle': 'Bitte melden Sie sich an',
    'login.username': 'Benutzername',
    'login.password': 'Passwort',
    'login.submit': 'Anmelden',
    'dashboard.title': 'Dashboard',
    'dashboard.sync_status': 'Synchronisationsstatus',
    'dashboard.health_status': 'Systemstatus',
    'dashboard.recent_jobs': 'Letzte Jobs',
    'settings.title': 'Einstellungen',
    'settings.profile': 'Profil',
    'settings.security': 'Sicherheit',
    'settings.sync': 'Synchroneinstellungen',
    'settings.notifications': 'Benachrichtigungen',
    'settings.username': 'Benutzername',
    'settings.email': 'E-Mail',
    'settings.language': 'Sprache',
    'settings.lang_german': 'Deutsch',
    'settings.lang_english': 'Englisch',
    'settings.lang_french': 'Französisch',
    'settings.lang_spanish': 'Spanisch',
    'settings.change_password': 'Passwort ändern',
    'settings.current_password': 'Aktuelles Passwort',
    'settings.new_password': 'Neues Passwort',
    'settings.confirm_password': 'Neues Passwort bestätigen',
    'settings.password_helper': 'Min. 8 Zeichen, Groß-, Kleinbuchstaben, Zahl, Sonderzeichen',
    'settings.save': 'Speichern',
    'settings.two_factor': 'Zwei-Faktor-Authentifizierung',
    'settings.mfa_coming_soon': 'MFA wird in einem späteren Backend-Update verfügbar sein',
    'settings.sync_direction': 'Standard-Synchronisierungsrichtung',
    'settings.conflict_resolution': 'Konfliktlösung',
    'settings.sync_interval': 'Synchronisierungsintervall (Minuten)',
    'settings.email_notifications': 'E-Mail-Benachrichtigungen aktivieren',
    'settings.webhook_notifications': 'Webhook-Benachrichtigungen aktivieren',
    'nav.sync': 'Synchronisation',
    'nav.simulation': 'Simulation',
    'nav.reports': 'Berichte',
    'nav.settings': 'Einstellungen',
    'nav.logout': 'Abmelden',
    'wizard.welcome': 'Willkommen',
    'wizard.plesk': 'Plesk',
    'wizard.sap': 'SAP B1',
    'wizard.sync': 'Sync-Einstellungen',
    'wizard.complete': 'Fertig',
    'wizard.welcome_title': 'Einrichtungsassistent',
    'wizard.welcome_desc': 'Konfigurieren Sie Ihre SAP Business One und Plesk-Verbindungen, um mit der Synchronisation zu beginnen.',
    'wizard.plesk_setup': 'Plesk-Einrichtung',
    'wizard.plesk_setup_desc': 'Konfigurieren Sie Ihre Plesk-Server-API-Zugangsdaten.',
    'wizard.sap_setup': 'SAP Business One Einrichtung',
    'wizard.sap_setup_desc': 'Konfigurieren Sie Ihre SAP B1-Serververbindung.',
    'wizard.plesk_config': 'Plesk-Konfiguration',
    'wizard.plesk_config_desc': 'Geben Sie Ihre Plesk-Serverdaten und API-Zugangsdaten ein.',
    'wizard.sap_config': 'SAP Business One Konfiguration',
    'wizard.sap_config_desc': 'Geben Sie Ihre SAP B1-Serververbindungsdaten ein.',
    'wizard.sync_config': 'Synchronisationseinstellungen',
    'wizard.sync_config_desc': 'Konfigurieren Sie, wie Daten zwischen SAP und Plesk synchronisiert werden.',
    'wizard.plesk_host': 'Plesk-Host',
    'wizard.sap_host': 'SAP-Host',
    'wizard.port': 'Port',
    'wizard.username': 'Benutzername',
    'wizard.password': 'Passwort',
    'wizard.api_key': 'API-Schlüssel (Optional)',
    'wizard.api_key_helper': 'Alternative zur Benutzer/Passwort-Authentifizierung',
    'wizard.company_db': 'Firmendatenbank',
    'wizard.company_db_helper': 'Der SAP B1-Firmendatenbankname (z.B., SBODEMO_DE)',
    'wizard.test_connection': 'Verbindung testen',
    'wizard.connection_ok': 'Verbindung erfolgreich!',
    'wizard.connection_failed': 'Verbindung fehlgeschlagen',
    'wizard.plesk_success': 'Plesk-Verbindung erfolgreich!',
    'wizard.plesk_error': 'Plesk-Verbindung fehlgeschlagen',
    'wizard.sap_success': 'SAP-Verbindung erfolgreich!',
    'wizard.sap_error': 'SAP-Verbindung fehlgeschlagen',
    'wizard.sync_direction': 'Sync-Richtung',
    'wizard.sync_interval': 'Sync-Intervall',
    'wizard.minutes': 'Minuten',
    'wizard.conflict_resolution': 'Konfliktlösung',
    'wizard.sap_priority': 'SAP-Priorität',
    'wizard.plesk_priority': 'Plesk-Priorität',
    'wizard.timestamp_based': 'Zeitstempelbasiert',
    'wizard.manual': 'Manuell',
    'wizard.bidirectional': 'Bidirektional',
    'wizard.back': 'Zurück',
    'wizard.next': 'Weiter',
    'wizard.complete_setup': 'Einrichtung abschließen',
    'wizard.save_success': 'Konfiguration erfolgreich gespeichert!',
    'wizard.save_error': 'Konfiguration konnte nicht gespeichert werden',
    'wizard.setup_complete': 'Einrichtung abgeschlossen!',
    'wizard.setup_complete_desc': 'Ihre SAP B1- und Plesk-Verbindungen wurden konfiguriert. Sie können jetzt mit der Datensynchronisation beginnen.',
    'wizard.go_dashboard': 'Zum Dashboard',
    'simulation.title': 'Sync-Simulation',
    'simulation.description': 'Zeigen Sie eine Vorschau der zu synchronisierenden Daten zwischen SAP und Plesk.',
    'simulation.not_configured': 'Bitte konfigurieren Sie zuerst Ihre SAP- und Plesk-Verbindungen.',
    'simulation.go_setup': 'Zur Einrichtung',
    'simulation.data_type': 'Datentyp',
    'simulation.direction': 'Richtung',
    'simulation.bidirectional': 'Bidirektional',
    'simulation.run': 'Simulation starten',
    'simulation.running': 'Simuliere...',
    'simulation.refresh': 'Aktualisieren',
    'simulation.analyzing': 'Analysiere Datenquellen...',
    'simulation.complete': 'Simulation abgeschlossen!',
    'simulation.error': 'Simulation fehlgeschlagen',
    'simulation.total': 'Gesamt',
    'simulation.status_new': 'Neu',
    'simulation.status_update': 'Aktualisiert',
    'simulation.status_conflict': 'Konflikte',
    'simulation.status_unchanged': 'Unverändert',
    'simulation.status_delete': 'Gelöscht',
    'simulation.customers': 'Kunden',
    'simulation.domains': 'Domains',
    'simulation.subscriptions': 'Abonnements',
    'simulation.invoices': 'Rechnungen',
    'simulation.contacts': 'Kontakte',
    'simulation.all': 'Alle',
    'simulation.col_status': 'Status',
    'simulation.col_source_id': 'Quell-ID',
    'simulation.col_target_id': 'Ziel-ID',
    'simulation.col_name': 'Name',
    'simulation.col_actions': 'Aktionen',
    'simulation.col_field': 'Feld',
    'simulation.col_source_value': 'Quellwert',
    'simulation.col_target_value': 'Zielwert',
    'simulation.view_details': 'Details anzeigen',
    'simulation.no_records': 'Keine Datensätze gefunden',
    'simulation.details_title': 'Details',
    'simulation.source_data': 'Quelldaten (SAP)',
    'simulation.target_data': 'Zieldaten (Plesk)',
    'simulation.no_target_data': 'Datensatz existiert nicht im Ziel',
    'simulation.differences': 'Unterschiede',
    'simulation.close': 'Schließen',
    'wizard.2fa_section': 'Zwei-Faktor-Authentifizierung',
    'wizard.2fa_enabled': '2FA für Plesk-Verbindung aktivieren',
    'wizard.2fa_method': '2FA-Methode',
    'wizard.2fa_totp': 'Authentifikator-App (TOTP)',
    'wizard.2fa_sms': 'SMS-Code',
    'wizard.2fa_email': 'E-Mail-Code',
    'wizard.2fa_totp_info': 'Verwenden Sie eine Authentifikator-App wie Google Authenticator oder Authy.',
    'wizard.2fa_tunnel_info': 'Beim Testen oder Verbinden wird das System in Echtzeit nach einem 2FA-Code fragen.',
    'wizard.2fa_title': 'Zwei-Faktor-Authentifizierung',
    'wizard.2fa_enter_code': 'Geben Sie den Bestätigungscode aus Ihrer Authentifikator-App ein.',
    'wizard.2fa_code': 'Bestätigungscode',
    'wizard.2fa_code_help': 'Geben Sie den 6-stelligen Code aus Ihrer Authentifikator-App ein.',
    'wizard.2fa_verify': 'Code bestätigen',
    'wizard.2fa_invalid': 'Ungültiger Code. Bitte versuchen Sie es erneut.',
    'wizard.2fa_code_required': 'Bitte geben Sie den Bestätigungscode ein.',
    'wizard.2fa_channel': 'Übermittlungskanal',
    'wizard.cancel': 'Abbrechen',
    'common.cancel': 'Abbrechen',
    'common.save': 'Speichern',
    'common.delete': 'Löschen',
    'common.edit': 'Bearbeiten',
    'common.refresh': 'Aktualisieren',
    'common.close': 'Schließen',
    'common.add': 'Hinzufügen',
    'common.update': 'Aktualisieren',
    'nav.conflicts': 'Konflikte',
    'nav.billing': 'Abrechnung',
    'nav.alerts': 'Warnungen',
    'nav.servers': 'Server',
    'nav.audit': 'Audit',
    'dashboard.sync_running': 'Synchronisation läuft...',
    'dashboard.no_sync': 'Keine Synchronisation aktiv',
    'dashboard.running': 'Läuft',
    'dashboard.completed_today': 'Heute abgeschlossen',
    'dashboard.failed_today': 'Heute fehlgeschlagen',
    'dashboard.database': 'Datenbank',
    'dashboard.healthy': 'Gesund',
    'dashboard.unhealthy': 'Ungesund',
    'dashboard.no_recent_jobs': 'Keine aktuellen Jobs',
    'dashboard.job': 'Job',
    'dashboard.internal_db': 'Interne Datenbank',
    'dashboard.connected': 'Verbunden',
    'dashboard.disconnected': 'Nicht verbunden',
    'dashboard.no_plesk': 'Kein Plesk-Server konfiguriert',
    'dashboard.no_sap': 'Kein SAP-Server konfiguriert',
    'settingsSecurity.title': 'Sicherheit',
    'settingsSecurity.mfa': 'Multi-Faktor-Authentifizierung',
    'settingsSecurity.mfaEnabled': 'MFA ist für Ihr Konto aktiviert.',
    'settingsSecurity.enableMfa': 'MFA aktivieren',
    'settingsSecurity.disableMfa': 'Deaktivieren',
    'settingsSecurity.changePassword': 'Passwort ändern',
    'settingsSecurity.currentPassword': 'Aktuelles Passwort',
    'settingsSecurity.newPassword': 'Neues Passwort',
    'settingsSecurity.confirmPassword': 'Neues Passwort bestätigen',
    'settingsSecurity.passwordHint': 'Das Passwort muss mindestens 8 Zeichen lang sein und Großbuchstaben, Kleinbuchstaben, Zahlen und Sonderzeichen enthalten.',
    'settingsSecurity.passwordChanged': 'Passwort erfolgreich geändert!',
    'settingsSecurity.passwordMismatch': 'Passwörter stimmen nicht überein',
    'settingsSecurity.passwordTooShort': 'Passwort muss mindestens 8 Zeichen lang sein',
    'settingsSecurity.mfaSetupTitle': 'Multi-Faktor-Authentifizierung einrichten',
    'settingsSecurity.mfaVerifyTitle': 'Multi-Faktor-Authentifizierung verifizieren',
    'settingsSecurity.mfaSuccessTitle': 'MFA erfolgreich aktiviert',
    'settingsSecurity.mfaSteps': 'Folgen Sie diesen Schritten um MFA zu aktivieren:',
    'settingsSecurity.mfaStep1': 'Schritt 1: QR-Code scannen',
    'settingsSecurity.mfaStep2': 'Schritt 2: Backup-Codes speichern',
    'settingsSecurity.mfaStep3': 'Schritt 3: 6-stelligen Code eingeben',
    'settingsSecurity.mfaScanHint': 'Scannen Sie diesen QR-Code mit Ihrer Authentifikator-App (Google Authenticator, Authy, etc.)',
    'settingsSecurity.mfaBackupWarning': 'Bewahren Sie diese Backup-Codes an einem sicheren Ort auf. Sie können sie verwenden, um auf Ihr Konto zuzugreifen, wenn Sie Ihr Authentifikator-Gerät verlieren.',
    'settingsSecurity.copy': 'Kopieren',
    'settingsSecurity.verificationCode': 'Bestätigungscode',
    'settingsSecurity.continueVerify': 'Weiter zur Verifizierung',
    'settingsSecurity.verifyEnable': 'Verifizieren und MFA aktivieren',
    'settingsSecurity.mfaSuccess': 'MFA wurde erfolgreich aktiviert!',
    'settingsSecurity.mfaSuccessHint': 'Ihr Konto ist jetzt sicherer. Sie werden in Kürze weitergeleitet.',
    'settingsSecurity.mfaInvalidCode': 'Ungültiger Code. Bitte versuchen Sie es erneut.',
    'settingsSecurity.mfaConfirmDisable': 'Sind Sie sicher, dass Sie MFA deaktivieren möchten?',
    'settingsProfile.title': 'Profil',
    'settingsProfile.comingSoon': 'Profileinstellungen demnächst verfügbar...',
    'settingsProfile.username': 'Benutzername',
    'settingsProfile.email': 'E-Mail',
    'settingsProfile.fullName': 'Vollständiger Name',
    'settingsProfile.company': 'Firma',
    'settingsProfile.save': 'Änderungen speichern',
    'settingsProfile.success': 'Profil erfolgreich aktualisiert!',
    'settingsSync.title': 'Synchroneinstellungen',
    'settingsSync.hint': 'Synchroneinstellungen sind jetzt im Einrichtungsassistenten verfügbar.',
    'settingsSync.status': 'Status',
    'settingsSync.lastSync': 'Letzte Synchronisierung',
    'settingsSync.nextSync': 'Nächste geplante Synchronisierung',
    'settingsNotifications.title': 'Benachrichtigungen',
    'settingsNotifications.comingSoon': 'Benachrichtigungseinstellungen demnächst verfügbar...',
    'settingsNotifications.emailNotifications': 'E-Mail-Benachrichtigungen',
    'settingsNotifications.emailNotificationsDesc': 'E-Mail-Benachrichtigungen für Sync-Ereignisse erhalten',
    'settingsNotifications.webhookNotifications': 'Webhook-Benachrichtigungen',
    'settingsNotifications.webhookNotificationsDesc': 'Benachrichtigungen über Webhooks senden',
    'settingsNotifications.webhooks': 'Webhooks',
    'settingsNotifications.webhookUrl': 'Webhook-URL',
    'settingsNotifications.webhookType': 'Ereignistyp',
    'settingsNotifications.addWebhook': 'Webhook hinzufügen',
    'settingsNotifications.noWebhooks': 'Keine Webhooks konfiguriert',
    'settingsNotifications.deleteConfirm': 'Sind Sie sicher, dass Sie diesen Webhook löschen möchten?',
    'settingsNotifications.save': 'Einstellungen speichern',
    'settingsNotifications.success': 'Benachrichtigungseinstellungen gespeichert!',
    'sync.title': 'Synchronisation',
    'sync.running': 'Synchronisation läuft...',
    'sync.idle': 'Inaktiv',
    'sync.startSync': 'Synchronisation starten',
    'sync.stopSync': 'Synchronisation stoppen',
    'sync.syncJobs': 'Sync-Jobs',
    'sync.startTitle': 'Synchronisation starten',
    'sync.syncType': 'Sync-Typ',
    'sync.fullSync': 'Vollsynchronisation',
    'sync.incrementalSync': 'Inkrementelle Synchronisation',
    'sync.partialSync': 'Teilsynchronisation',
    'sync.direction': 'Richtung',
    'sync.start': 'Starten',
    'sync.colId': 'ID',
    'sync.colType': 'Typ',
    'sync.colDirection': 'Richtung',
    'sync.colStatus': 'Status',
    'sync.colProcessed': 'Verarbeitet',
    'sync.colFailed': 'Fehlgeschlagen',
    'sync.colStarted': 'Gestartet',
    'sync.colCompleted': 'Abgeschlossen',
    'sync.startedSuccess': 'Sync-Job erfolgreich gestartet',
    'sync.startFailed': 'Sync-Job konnte nicht gestartet werden',
    'sync.stoppedSuccess': 'Sync-Job gestoppt',
    'sync.stopFailed': 'Sync-Job konnte nicht gestoppt werden',
    'reports.title': 'Berichte',
    'reports.reportType': 'Berichtstyp',
    'reports.syncHistory': 'Sync-Verlauf',
    'reports.usageMetrics': 'Nutzungsmetriken',
    'reports.revenue': 'Umsatz',
    'reports.dateRange': 'Zeitraum',
    'reports.last24h': 'Letzte 24 Stunden',
    'reports.last7d': 'Letzte 7 Tage',
    'reports.last30d': 'Letzte 30 Tage',
    'reports.last90d': 'Letzte 90 Tage',
    'reports.runningJobs': 'Laufende Jobs',
    'reports.completedToday': 'Heute abgeschlossen',
    'reports.failedToday': 'Heute fehlgeschlagen',
    'reports.reportRange': 'Berichtszeitraum',
    'reports.syncActivity': 'Sync-Aktivität (Letzte 7 Tage)',
    'reports.completed': 'Abgeschlossen',
    'reports.failed': 'Fehlgeschlagen',
    'reports.downloadSuccess': 'Bericht erfolgreich heruntergeladen',
    'reports.exportFailed': 'Bericht konnte nicht exportiert werden',
    'reports.colId': 'ID',
    'reports.colSubscription': 'Abonnement',
    'reports.colType': 'Typ',
    'reports.colValue': 'Wert',
    'reports.colUnit': 'Einheit',
    'reports.colRecorded': 'Erfasst',
    'conflicts.title': 'Konflikte',
    'conflicts.refresh': 'Aktualisieren',
    'conflicts.entityType': 'Entitätstyp',
    'conflicts.entityId': 'Entitäts-ID',
    'conflicts.sourceData': 'Quelldaten',
    'conflicts.targetData': 'Zieldaten',
    'conflicts.status': 'Status',
    'conflicts.actions': 'Aktionen',
    'conflicts.noConflicts': 'Keine Konflikte gefunden',
    'conflicts.resolve': 'Lösen',
    'conflicts.resolveConflict': 'Konflikt lösen',
    'conflicts.source': 'Quelle (SAP)',
    'conflicts.target': 'Ziel (Plesk)',
    'conflicts.resolutionAction': 'Lösungsaktion',
    'conflicts.keepSource': 'Quelle behalten',
    'conflicts.keepTarget': 'Ziel behalten',
    'conflicts.merge': 'Zusammenführen',
    'conflicts.skip': 'Überspringen',
    'conflicts.applyResolution': 'Lösung anwenden',
    'billing.title': 'Abrechnung',
    'billing.generate': 'Generieren',
    'billing.refresh': 'Aktualisieren',
    'billing.pricingSummary': 'Preisübersicht',
    'billing.active': 'Aktiv',
    'billing.inactive': 'Inaktiv',
    'billing.noPricing': 'Keine Preise konfiguriert',
    'billing.records': 'Abrechnungsdaten',
    'billing.customer': 'Kunde',
    'billing.period': 'Zeitraum',
    'billing.amount': 'Betrag',
    'billing.status': 'Status',
    'billing.created': 'Erstellt',
    'billing.actions': 'Aktionen',
    'billing.noRecords': 'Keine Abrechnungsdaten gefunden',
    'billing.draft': 'Entwurf',
    'billing.pending': 'Ausstehend',
    'billing.sent': 'Gesendet',
    'billing.synced': 'Synchronisiert',
    'billing.failed': 'Fehlgeschlagen',
    'billing.preview': 'Vorschau',
    'billing.syncToSap': 'Zu SAP synchronisieren',
    'billing.invoicePreview': 'Rechnungsvorschau',
    'billing.invoiceTo': 'Rechnungsempfänger',
    'billing.noLineItems': 'Keine Positionen',
    'billing.subtotal': 'Zwischensumme',
    'billing.tax': 'MwSt. (20%)',
    'billing.total': 'Gesamt',
    'alerts.title': 'Warnungen',
    'alerts.addThreshold': 'Schwellenwert hinzufügen',
    'alerts.refresh': 'Aktualisieren',
    'alerts.thresholds': 'Warnschwellenwerte',
    'alerts.noThresholds': 'Keine Warnschwellenwerte konfiguriert',
    'alerts.active': 'Aktiv',
    'alerts.inactive': 'Inaktiv',
    'alerts.recentAlerts': 'Aktuelle Warnungen',
    'alerts.noRecentAlerts': 'Keine aktuellen Warnungen',
    'alerts.value': 'Wert',
    'alerts.triggeredAt': 'ausgelöst am',
    'alerts.action': 'Aktion',
    'alerts.addThresholdTitle': 'Warnschwellenwert hinzufügen',
    'alerts.editThresholdTitle': 'Warnschwellenwert bearbeiten',
    'alerts.name': 'Name',
    'alerts.metricType': 'Metriktyp',
    'alerts.thresholdValue': 'Schwellenwert',
    'alerts.unit': 'Einheit',
    'alerts.comparison': 'Vergleich',
    'alerts.subscription': 'Abonnement (Optional)',
    'alerts.allSubscriptions': 'Alle Abonnements',
    'alerts.notifyOnly': 'Nur benachrichtigen',
    'alerts.notifySuspend': 'Benachrichtigen und sperren',
    'alerts.notifyLimit': 'Benachrichtigen und begrenzen',
    'alerts.colName': 'Name',
    'alerts.colMetric': 'Metrik',
    'alerts.colThreshold': 'Schwellenwert',
    'alerts.colAction': 'Aktion',
    'alerts.colStatus': 'Status',
    'alerts.colLastTriggered': 'Zuletzt ausgelöst',
    'alerts.colActions': 'Aktionen',
    'servers.title': 'Server',
    'servers.refresh': 'Aktualisieren',
    'servers.pleskServers': 'Plesk-Server',
    'servers.sapServers': 'SAP-Server',
    'servers.addPlesk': 'Plesk-Server hinzufügen',
    'servers.addSap': 'SAP-Server hinzufügen',
    'servers.noServers': 'Keine Server konfiguriert',
    'servers.colName': 'Name',
    'servers.colHost': 'Host',
    'servers.colPort': 'Port',
    'servers.colCompanyDb': 'Firmendatenbank',
    'servers.colStatus': 'Status',
    'servers.colLastConnected': 'Zuletzt verbunden',
    'servers.colActions': 'Aktionen',
    'servers.test': 'Testen',
    'servers.edit': 'Bearbeiten',
    'servers.delete': 'Löschen',
    'servers.confirmDelete': 'Sind Sie sicher, dass Sie diesen Server löschen möchten?',
    'servers.editPlesk': 'Plesk-Server bearbeiten',
    'servers.editSap': 'SAP-Server bearbeiten',
    'servers.addPleskTitle': 'Plesk-Server hinzufügen',
    'servers.addSapTitle': 'SAP-Server hinzufügen',
    'servers.apiKey': 'API-Schlüssel',
    'servers.username': 'Benutzername',
    'servers.usernameOptional': 'Benutzername (Optional)',
    'servers.password': 'Passwort',
    'servers.companyDb': 'Firmendatenbank',
    'audit.title': 'Audit',
    'audit.loginEvents': 'Anmeldeereignisse',
    'audit.syncEvents': 'Sync-Ereignisse',
    'audit.filters': 'Filter',
    'audit.exportCsv': 'CSV exportieren',
    'audit.eventType': 'Ereignistyp',
    'audit.allEvents': 'Alle Ereignisse',
    'audit.fromDate': 'Von Datum',
    'audit.toDate': 'Bis Datum',
    'audit.auditLogs': 'Audit-Protokolle',
    'audit.records': 'Einträge',
    'audit.noLogs': 'Keine Audit-Protokolle gefunden',
    'audit.colId': 'ID',
    'audit.colUser': 'Benutzer',
    'audit.colEvent': 'Ereignis',
    'audit.colIpAddress': 'IP-Adresse',
    'audit.colUserAgent': 'User Agent',
    'audit.colJobId': 'Job-ID',
    'audit.colEntityType': 'Entitätstyp',
    'audit.colEntityId': 'Entitäts-ID',
    'audit.colAction': 'Aktion',
    'audit.colStatus': 'Status',
    'audit.colTimestamp': 'Zeitstempel',
    'audit.colActions': 'Aktionen',
    'audit.details': 'Details',
    'audit.detailsTitle': 'Audit-Protokoll Details',
    'audit.metadata': 'Metadaten',
    'audit.userLogin': 'Benutzeranmeldung',
    'audit.userLogout': 'Benutzerabmeldung',
    'audit.mfaEnabled': 'MFA aktiviert',
    'audit.mfaDisabled': 'MFA deaktiviert',
    'audit.passwordChanged': 'Passwort geändert',
    'audit.fullSync': 'Vollsynchronisation',
    'audit.incrementalSync': 'Inkrementelle Synchronisation',
    'audit.partialSync': 'Teilsynchronisation',
    'audit.manualSync': 'Manuelle Synchronisation',
    'login.success': 'Anmeldung erfolgreich!',
    'login.failed': 'Anmeldung fehlgeschlagen',
    'login.failedHint': 'Anmeldung fehlgeschlagen. Bitte überprüfen Sie Ihre Anmeldedaten.',
  },
  fr: {
    'app.title': 'SAP Business One ↔ Plesk Sync',
    'login.title': 'Connexion',
    'login.subtitle': 'Veuillez vous connecter',
    'login.username': 'Nom d\'utilisateur',
    'login.password': 'Mot de passe',
    'login.submit': 'Se connecter',
    'dashboard.title': 'Tableau de bord',
    'dashboard.sync_status': 'État de synchronisation',
    'dashboard.health_status': 'État du système',
    'dashboard.recent_jobs': 'Derniers travaux',
    'settings.title': 'Paramètres',
    'settings.profile': 'Profil',
    'settings.security': 'Sécurité',
    'settings.sync': 'Paramètres de synchronisation',
    'settings.notifications': 'Notifications',
    'settings.username': 'Nom d\'utilisateur',
    'settings.email': 'E-mail',
    'settings.language': 'Langue',
    'settings.lang_german': 'Allemand',
    'settings.lang_english': 'Anglais',
    'settings.lang_french': 'Français',
    'settings.lang_spanish': 'Espagnol',
    'settings.change_password': 'Changer le mot de passe',
    'settings.current_password': 'Mot de passe actuel',
    'settings.new_password': 'Nouveau mot de passe',
    'settings.confirm_password': 'Confirmer le nouveau mot de passe',
    'settings.password_helper': 'Minimum 8 caractères, majuscules, minuscules, chiffre, caractère spécial',
    'settings.save': 'Enregistrer',
    'settings.two_factor': 'Authentification à deux facteurs',
    'settings.mfa_coming_soon': 'MFA sera disponible dans une mise à jour future',
    'settings.sync_direction': 'Direction de synchronisation par défaut',
    'settings.conflict_resolution': 'Résolution des conflits',
    'settings.sync_interval': 'Intervalle de synchronisation (minutes)',
    'settings.email_notifications': 'Activer les notifications par e-mail',
    'settings.webhook_notifications': 'Activer les notifications webhook',
    'nav.sync': 'Synchronisation',
    'nav.simulation': 'Simulation',
    'nav.reports': 'Rapports',
    'nav.settings': 'Paramètres',
    'nav.logout': 'Se déconnecter',
    'wizard.welcome': 'Bienvenue',
    'wizard.plesk': 'Plesk',
    'wizard.sap': 'SAP B1',
    'wizard.sync': 'Paramètres',
    'wizard.complete': 'Terminé',
    'wizard.welcome_title': 'Assistant de configuration',
    'wizard.welcome_desc': 'Configurez vos connexions SAP Business One et Plesk pour commencer la synchronisation.',
    'wizard.plesk_setup': 'Configuration Plesk',
    'wizard.plesk_setup_desc': 'Configurez vos identifiants API du serveur Plesk.',
    'wizard.sap_setup': 'Configuration SAP B1',
    'wizard.sap_setup_desc': 'Configurez votre connexion au serveur SAP B1.',
    'wizard.plesk_config': 'Configuration Plesk',
    'wizard.plesk_config_desc': 'Entrez les détails de votre serveur Plesk.',
    'wizard.sap_config': 'Configuration SAP B1',
    'wizard.sap_config_desc': 'Entrez les détails de connexion SAP B1.',
    'wizard.sync_config': 'Paramètres de synchronisation',
    'wizard.sync_config_desc': 'Configurez la synchronisation des données entre SAP et Plesk.',
    'wizard.plesk_host': 'Hôte Plesk',
    'wizard.sap_host': 'Hôte SAP',
    'wizard.port': 'Port',
    'wizard.username': 'Nom d\'utilisateur',
    'wizard.password': 'Mot de passe',
    'wizard.api_key': 'Clé API (Optionnel)',
    'wizard.api_key_helper': 'Alternative à l\'authentification utilisateur/mot de passe',
    'wizard.company_db': 'Base de données',
    'wizard.company_db_helper': 'Le nom de la base de données SAP B1',
    'wizard.test_connection': 'Tester la connexion',
    'wizard.connection_ok': 'Connexion réussie!',
    'wizard.connection_failed': 'Connexion échouée',
    'wizard.plesk_success': 'Connexion Plesk réussie!',
    'wizard.plesk_error': 'Connexion Plesk échouée',
    'wizard.sap_success': 'Connexion SAP réussie!',
    'wizard.sap_error': 'Connexion SAP échouée',
    'wizard.sync_direction': 'Direction de sync',
    'wizard.sync_interval': 'Intervalle de sync',
    'wizard.minutes': 'minutes',
    'wizard.conflict_resolution': 'Résolution des conflits',
    'wizard.sap_priority': 'Priorité SAP',
    'wizard.plesk_priority': 'Priorité Plesk',
    'wizard.timestamp_based': 'Basé sur timestamp',
    'wizard.manual': 'Manuel',
    'wizard.bidirectional': 'Bidirectionnel',
    'wizard.back': 'Retour',
    'wizard.next': 'Suivant',
    'wizard.complete_setup': 'Terminer',
    'wizard.save_success': 'Configuration enregistrée!',
    'wizard.save_error': 'Échec de l\'enregistrement',
    'wizard.setup_complete': 'Configuration terminée!',
    'wizard.setup_complete_desc': 'Vos connexions SAP B1 et Plesk sont configurées.',
    'wizard.go_dashboard': 'Aller au tableau de bord',
    'simulation.title': 'Simulation de sync',
    'simulation.description': 'Prévisualisez les données à synchroniser entre SAP et Plesk.',
    'simulation.not_configured': 'Veuillez configurer vos connexions SAP et Plesk.',
    'simulation.go_setup': 'Aller à la configuration',
    'simulation.data_type': 'Type de données',
    'simulation.direction': 'Direction',
    'simulation.bidirectional': 'Bidirectionnel',
    'simulation.run': 'Lancer la simulation',
    'simulation.running': 'Simulation...',
    'simulation.refresh': 'Rafraîchir',
    'simulation.analyzing': 'Analyse des sources...',
    'simulation.complete': 'Simulation terminée!',
    'simulation.error': 'Échec de la simulation',
    'simulation.total': 'Total',
    'simulation.status_new': 'Nouveau',
    'simulation.status_update': 'Mis à jour',
    'simulation.status_conflict': 'Conflits',
    'simulation.status_unchanged': 'Inchangé',
    'simulation.status_delete': 'Supprimé',
    'simulation.customers': 'Clients',
    'simulation.domains': 'Domaines',
    'simulation.subscriptions': 'Abonnements',
    'simulation.invoices': 'Factures',
    'simulation.contacts': 'Contacts',
    'simulation.all': 'Tous',
    'simulation.col_status': 'Statut',
    'simulation.col_source_id': 'ID Source',
    'simulation.col_target_id': 'ID Cible',
    'simulation.col_name': 'Nom',
    'simulation.col_actions': 'Actions',
    'simulation.col_field': 'Champ',
    'simulation.col_source_value': 'Valeur source',
    'simulation.col_target_value': 'Valeur cible',
    'simulation.view_details': 'Voir détails',
    'simulation.no_records': 'Aucun enregistrement',
    'simulation.details_title': 'Détails',
    'simulation.source_data': 'Données source (SAP)',
    'simulation.target_data': 'Données cible (Plesk)',
    'simulation.no_target_data': 'N\'existe pas dans la cible',
    'simulation.differences': 'Différences',
    'simulation.close': 'Fermer',
  },
  es: {
    'app.title': 'SAP Business One ↔ Plesk Sync',
    'login.title': 'Iniciar sesión',
    'login.subtitle': 'Por favor inicie sesión',
    'login.username': 'Nombre de usuario',
    'login.password': 'Contraseña',
    'login.submit': 'Iniciar sesión',
    'dashboard.title': 'Panel de control',
    'dashboard.sync_status': 'Estado de sincronización',
    'dashboard.health_status': 'Estado del sistema',
    'dashboard.recent_jobs': 'Trabajos recientes',
    'settings.title': 'Configuración',
    'settings.profile': 'Perfil',
    'settings.security': 'Seguridad',
    'settings.sync': 'Configuración de sincronización',
    'settings.notifications': 'Notificaciones',
    'settings.username': 'Nombre de usuario',
    'settings.email': 'Correo electrónico',
    'settings.language': 'Idioma',
    'settings.lang_german': 'Alemán',
    'settings.lang_english': 'Inglés',
    'settings.lang_french': 'Francés',
    'settings.lang_spanish': 'Español',
    'settings.change_password': 'Cambiar contraseña',
    'settings.current_password': 'Contraseña actual',
    'settings.new_password': 'Nueva contraseña',
    'settings.confirm_password': 'Confirmar nueva contraseña',
    'settings.password_helper': 'Mínimo 8 caracteres, mayúsculas, minúsculas, dígito, carácter especial',
    'settings.save': 'Guardar',
    'settings.two_factor': 'Autenticación de dos factores',
    'settings.mfa_coming_soon': 'MFA estará disponible en una actualización posterior',
    'settings.sync_direction': 'Dirección de sincronización predeterminada',
    'settings.conflict_resolution': 'Resolución de conflictos',
    'settings.sync_interval': 'Intervalo de sincronización (minutos)',
    'settings.email_notifications': 'Habilitar notificaciones por correo',
    'settings.webhook_notifications': 'Habilitar notificaciones webhook',
    'nav.sync': 'Sincronizar',
    'nav.simulation': 'Simulación',
    'nav.reports': 'Informes',
    'nav.settings': 'Configuración',
    'nav.logout': 'Cerrar sesión',
    'wizard.welcome': 'Bienvenido',
    'wizard.plesk': 'Plesk',
    'wizard.sap': 'SAP B1',
    'wizard.sync': 'Ajustes',
    'wizard.complete': 'Completado',
    'wizard.welcome_title': 'Asistente de configuración',
    'wizard.welcome_desc': 'Configure sus conexiones SAP Business One y Plesk para comenzar la sincronización.',
    'wizard.plesk_setup': 'Configuración Plesk',
    'wizard.plesk_setup_desc': 'Configure las credenciales de la API de Plesk.',
    'wizard.sap_setup': 'Configuración SAP B1',
    'wizard.sap_setup_desc': 'Configure la conexión al servidor SAP B1.',
    'wizard.plesk_config': 'Configuración Plesk',
    'wizard.plesk_config_desc': 'Ingrese los detalles de su servidor Plesk.',
    'wizard.sap_config': 'Configuración SAP B1',
    'wizard.sap_config_desc': 'Ingrese los detalles de conexión SAP B1.',
    'wizard.sync_config': 'Ajustes de sincronización',
    'wizard.sync_config_desc': 'Configure cómo se sincronizarán los datos.',
    'wizard.plesk_host': 'Host Plesk',
    'wizard.sap_host': 'Host SAP',
    'wizard.port': 'Puerto',
    'wizard.username': 'Usuario',
    'wizard.password': 'Contraseña',
    'wizard.api_key': 'Clave API (Opcional)',
    'wizard.api_key_helper': 'Alternativa a la autenticación usuario/contraseña',
    'wizard.company_db': 'Base de datos',
    'wizard.company_db_helper': 'El nombre de la base de datos SAP B1',
    'wizard.test_connection': 'Probar conexión',
    'wizard.connection_ok': '¡Conexión exitosa!',
    'wizard.connection_failed': 'Conexión fallida',
    'wizard.plesk_success': '¡Conexión Plesk exitosa!',
    'wizard.plesk_error': 'Conexión Plesk fallida',
    'wizard.sap_success': '¡Conexión SAP exitosa!',
    'wizard.sap_error': 'Conexión SAP fallida',
    'wizard.sync_direction': 'Dirección de sync',
    'wizard.sync_interval': 'Intervalo de sync',
    'wizard.minutes': 'minutos',
    'wizard.conflict_resolution': 'Resolución de conflictos',
    'wizard.sap_priority': 'Prioridad SAP',
    'wizard.plesk_priority': 'Prioridad Plesk',
    'wizard.timestamp_based': 'Basado en timestamp',
    'wizard.manual': 'Manual',
    'wizard.bidirectional': 'Bidireccional',
    'wizard.back': 'Atrás',
    'wizard.next': 'Siguiente',
    'wizard.complete_setup': 'Completar',
    'wizard.save_success': '¡Configuración guardada!',
    'wizard.save_error': 'Error al guardar',
    'wizard.setup_complete': '¡Configuración completada!',
    'wizard.setup_complete_desc': 'Sus conexiones SAP B1 y Plesk están configuradas.',
    'wizard.go_dashboard': 'Ir al panel',
    'simulation.title': 'Simulación de sync',
    'simulation.description': 'Previsualice los datos a sincronizar entre SAP y Plesk.',
    'simulation.not_configured': 'Configure primero sus conexiones SAP y Plesk.',
    'simulation.go_setup': 'Ir a configuración',
    'simulation.data_type': 'Tipo de datos',
    'simulation.direction': 'Dirección',
    'simulation.bidirectional': 'Bidireccional',
    'simulation.run': 'Ejecutar simulación',
    'simulation.running': 'Simulando...',
    'simulation.refresh': 'Actualizar',
    'simulation.analyzing': 'Analizando fuentes...',
    'simulation.complete': '¡Simulación completada!',
    'simulation.error': 'Error en la simulación',
    'simulation.total': 'Total',
    'simulation.status_new': 'Nuevo',
    'simulation.status_update': 'Actualizado',
    'simulation.status_conflict': 'Conflictos',
    'simulation.status_unchanged': 'Sin cambios',
    'simulation.status_delete': 'Eliminado',
    'simulation.customers': 'Clientes',
    'simulation.domains': 'Dominios',
    'simulation.subscriptions': 'Suscripciones',
    'simulation.invoices': 'Facturas',
    'simulation.contacts': 'Contactos',
    'simulation.all': 'Todos',
    'simulation.col_status': 'Estado',
    'simulation.col_source_id': 'ID Origen',
    'simulation.col_target_id': 'ID Destino',
    'simulation.col_name': 'Nombre',
    'simulation.col_actions': 'Acciones',
    'simulation.col_field': 'Campo',
    'simulation.col_source_value': 'Valor origen',
    'simulation.col_target_value': 'Valor destino',
    'simulation.view_details': 'Ver detalles',
    'simulation.no_records': 'Sin registros',
    'simulation.details_title': 'Detalles',
    'simulation.source_data': 'Datos origen (SAP)',
    'simulation.target_data': 'Datos destino (Plesk)',
    'simulation.no_target_data': 'No existe en destino',
    'simulation.differences': 'Diferencias',
    'simulation.close': 'Cerrar',
  },
};

export const I18nProvider: React.FC<{ children: React.ReactNode }> = ({ children }) => {
  const [language, setLanguage] = useState<string>(() => {
    return localStorage.getItem('language') || 'de';
  });

  const changeLanguage = (lang: string) => {
    localStorage.setItem('language', lang);
    setLanguage(lang);
  };

  const t = (key: string): string => {
    return translations[language]?.[key] || translations['en'][key] || key;
  };

  return (
    <I18nContext.Provider value={{ language, changeLanguage, t }}>
      {children}
    </I18nContext.Provider>
  );
};

export const useI18n = () => {
  const context = useContext(I18nContext);
  if (context === undefined) {
    throw new Error('useI18n must be used within an I18nProvider');
  }
  return context;
};
