get_stylesheet(); $af_translate_theme_summary = class_exists( 'AF_Translate_Analyzer' ) ? AF_Translate_Analyzer::get_component_summary( $af_translate_theme_slug, 'theme' ) : array( 'text_domain' => $af_translate_theme_slug, 'pot_exists' => false, 'po_count' => 0 ); $af_translate_active_plugins_list = get_option( 'active_plugins', array() ); // Evaluate total languages configured on this WordPress site $af_translate_installed_languages = get_available_languages(); if ( ! in_array( 'en_US', $af_translate_installed_languages, true ) ) { $af_translate_installed_languages[] = 'en_US'; } $af_translate_total_plugin_po = 0; $af_translate_ready_plugins_count = 0; $af_translate_plugin_rows_catalog = array(); if ( ! function_exists( 'get_plugins' ) ) { require_once ABSPATH . 'wp-admin/includes/plugin.php'; } $af_translate_all_plugins = get_plugins(); if ( ! empty( $af_translate_active_plugins_list ) ) { foreach ( $af_translate_active_plugins_list as $af_translate_plugin_path ) { if ( ! isset( $af_translate_all_plugins[ $af_translate_plugin_path ] ) ) { continue; } $af_translate_plugin_data = $af_translate_all_plugins[ $af_translate_plugin_path ]; $af_translate_plugin_slug = dirname( $af_translate_plugin_path ); if ( '.' === $af_translate_plugin_slug ) { $af_translate_plugin_slug = basename( $af_translate_plugin_path, '.php' ); } $af_translate_plugin_summary = class_exists( 'AF_Translate_Analyzer' ) ? AF_Translate_Analyzer::get_component_summary( $af_translate_plugin_slug, 'plugin' ) : array( 'pot_exists' => false, 'po_count' => 0 ); $af_translate_total_plugin_po += intval( $af_translate_plugin_summary['po_count'] ); if ( $af_translate_plugin_summary['pot_exists'] ) { $af_translate_ready_plugins_count++; } $af_translate_plugin_rows_catalog[] = array( 'name' => $af_translate_plugin_data['Name'], 'text_domain' => ! empty( $af_translate_plugin_data['TextDomain'] ) ? $af_translate_plugin_data['TextDomain'] : $af_translate_plugin_slug, 'slug' => $af_translate_plugin_slug, 'pot_exists' => $af_translate_plugin_summary['pot_exists'], 'po_count' => $af_translate_plugin_summary['po_count'] ); } } $af_translate_total_po_files_discovered = intval( $af_translate_theme_summary['po_count'] ) + $af_translate_total_plugin_po; $af_translate_cached_data = array( 'theme_name' => $af_translate_active_theme->get( 'Name' ), 'theme_slug' => $af_translate_theme_slug, 'theme_summary' => $af_translate_theme_summary, 'total_plugins' => count( $af_translate_all_plugins ), 'total_languages' => count( $af_translate_installed_languages ), 'total_po_files' => $af_translate_total_po_files_discovered, 'ready_plugins' => $af_translate_ready_plugins_count, 'plugin_catalog' => $af_translate_plugin_rows_catalog, 'generation_time' => current_time( 'timestamp' ) ); // Reduced transient duration to 1 hour for practical background caching set_transient( $af_translate_cache_key, $af_translate_cached_data, 1 * HOUR_IN_SECONDS ); } // 3. Live Configuration Fallbacks (Processed live so UI changes display instantly) $af_translate_api_settings = get_option( 'af_translate_api_settings', array() ); $af_translate_active_provider = isset( $af_translate_api_settings['active_provider'] ) ? sanitize_key( $af_translate_api_settings['active_provider'] ) : 'none'; $af_translate_provider_manifest = array( 'none' => __( 'No Translation Engine Connected', 'af-translate' ), 'deepl' => __( 'DeepL Pro / Free API', 'af-translate' ), 'google' => __( 'Google Translate Cloud v2', 'af-translate' ), 'lecto' => __( 'Lecto AI Engine', 'af-translate' ), 'microsoft' => __( 'Microsoft Cognitive Services', 'af-translate' ), 'openai' => __( 'OpenAI Enterprise (GPT Array)', 'af-translate' ), 'anthropic' => __( 'Anthropic LLM Core (Claude)', 'af-translate' ), 'grok' => __( 'xAI Enterprise Core (Grok)', 'af-translate' ), 'gemini' => __( 'Google Gemini Multimodal Framework', 'af-translate' ), ); $af_translate_display_provider = isset( $af_translate_provider_manifest[ $af_translate_active_provider ] ) ? $af_translate_provider_manifest[ $af_translate_active_provider ] : ucfirst( $af_translate_active_provider ); $af_translate_model_field_key = $af_translate_active_provider . '_model'; $af_translate_display_model = ( ! empty( $af_translate_api_settings[ $af_translate_model_field_key ] ) ) ? $af_translate_api_settings[ $af_translate_model_field_key ] : __( 'Standard Default Mode', 'af-translate' ); $af_translate_active_plugins_count = count( get_option( 'active_plugins', array() ) ); $af_translate_recent_activities = get_option( 'af_translate_activity_logs', array() ); $af_translate_refresh_url = wp_nonce_url( add_query_arg( 'refresh_stats', '1', admin_url( 'admin.php?page=af-translate&tab=overview' ) ), 'af_translate_refresh_analytics', 'aft_nonce' ); ?>
array(), 'code' => array() ) ), '' . esc_html( get_locale() ) . '' );
?>
|
✓ ' . esc_html__( 'Template Ready', 'af-translate' ) . ''; } else { echo '⚠️ ' . esc_html__( 'Missing Base Template (.pot)', 'af-translate' ) . ''; } ?> |