$file, 'filename' => $filename, 'is_sandbox' => false, ); } } // 1b. Scan and overlay custom Sandboxed items from the Uploads directory if (is_dir($safe_upload_dir)) { $sandbox_files = glob(trailingslashit($safe_upload_dir) . '*.po'); if (! empty($sandbox_files) && is_array($sandbox_files)) { foreach ($sandbox_files as $file) { $filename = basename($file); $locale_code = str_replace('.po', '', $filename); // Handle both unified "component-locale.po" and standalone "locale.po" types if (strpos($locale_code, '-') !== false) { $parts = explode('-', $locale_code); $file_prefix = $parts[0]; if ($file_prefix !== $slug) { continue; // Belongs to a different theme/plugin sandbox profile } $locale_code = end($parts); } $locale_code = sanitize_key($locale_code); // Inject or completely override vendor core items with sandboxed options $unified_matrix[$locale_code] = array( 'file_path' => $file, 'filename' => $filename, 'is_sandbox' => true, ); } } } // --- STEP 2: RENDER COMPREHENSIVE LOCALIZATION LINES --- if (empty($unified_matrix)) { echo ''; } else { foreach ($unified_matrix as $locale_code => $data) { $file = $data['file_path']; $filename = $data['filename']; $is_sandbox_file = $data['is_sandbox']; $lang_name = isset($all_locales[$locale_code]) ? $all_locales[$locale_code] : $locale_code; $metrics = AF_Translate_Analyzer::analyze_po_file($file); $mod_time = date_i18n(get_option('date_format') . ' ' . get_option('time_format'), filemtime($file)); $total_strings = isset($metrics['total']) ? (int) $metrics['total'] : 0; $trans_strings = isset($metrics['translated']) ? (int) $metrics['translated'] : 0; $pct_val = isset($metrics['percentage']) ? (int) $metrics['percentage'] : 0; $pending = $total_strings - $trans_strings; $edit_target_url = add_query_arg(array('action' => 'edit', 'lang' => $locale_code), $base_action_url); ?>
' . esc_html__('No translations found. Click "Add New Language" above to start.', 'af-translate') . '
[]
| | | |
%