$total_strings = $total_words = $total_files = 0; foreach (Project::getWebsiteFiles($current_website) as $current_filename) { if ($website_data_source == 'lang') { $reference_locale = Project::getReferenceLocale($current_website); $reference_data = LangManager::loadSource($current_website, $reference_locale, $current_filename); $get_words = function ($item) { return str_word_count(strip_tags($item)); }; $nb_words = array_sum(array_map($get_words, $reference_data['strings'])); $nb_strings = count($reference_data['strings']); $total_strings += $nb_strings; $total_words += $nb_words; $total_files++; $html_output .= "<tr>\n"; // Check if the file is obsolete for all locales if (Project::isObsoleteFile($current_website, $current_filename, 'all')) { $html_output .= " <td class='obsolete' title='Obsolete file'>{$current_filename}</td>\n"; } else { $html_output .= " <td>{$current_filename}</td>\n"; } $html_output .= ' <td>' . Project::getLocalizedURL($reference_data, '', 'html') . "</td>\n" . " <td><a class='table_small_link' href='?locale=all&website={$site_index}&file={$current_filename}'>Status</a></td>\n" . " <td><a class='table_small_link' href='?website={$site_index}&file={$current_filename}&action=translate&show'>Show</a></td>\n" . " <td>{$nb_strings}</td>\n" . " <td>{$nb_words}</td>\n" . "</tr>\n"; } else { $html_output .= "<tr>\n" . " <td>" . basename($current_filename) . "</td>\n" . " <td><a class='table_small_link' href='?locale=all&website={$site_index}&file={$current_filename}'>Status</a></td>\n" . "</tr>\n"; } } $total_files .= $total_files != 1 ? ' files' : ' file'; if ($website_data_source == 'lang') { $html_output .= "<tr class=\"tabletotals\">\n" . " <th colspan=\"3\">Total</th>\n" . " <td>{$total_files}</td>\n" . " <td>{$total_strings}</td>\n" . " <td>{$total_words}</td>\n" . "</tr>\n"; } $html_output .= " </tbody>\n</table>\n\n"; }
foreach (Project::getWebsiteFiles($current_website) as $current_filename) { // I need to check only files that can be activated if (!in_array($current_filename, $no_active_tag)) { // Read en-US data only once $reference_data = LangManager::loadSource($current_website, $reference_locale, $current_filename); $supported_locales = Project::getSupportedLocales($current_website, $current_filename, $langfiles_subsets); foreach ($supported_locales as $current_locale) { if ($current_locale == $reference_locale) { // Ignore reference language continue; } if (!file_exists(Project::getLocalFilePath($current_website, $current_locale, $current_filename))) { // If the .lang file does not exist, just skip the locale for this file continue; } if (Project::isObsoleteFile($current_website, $current_filename, $current_locale)) { // If the .lang file is obsolete, skip it continue; } $locale_analysis = LangManager::analyzeLangFile($current_website, $current_locale, $current_filename, $reference_data); $todo = count($locale_analysis['Identical']) + count($locale_analysis['Missing']) + LangManager::countErrors($locale_analysis['errors']); $activation_status = $locale_analysis['activated'] ? 'yes' : 'no'; if ($todo == 0 && $activation_status == 'no') { $svn_path = 'http://viewvc.svn.mozilla.org/vc/projects/mozilla.com/trunk/locales/' . $current_locale . '/' . $current_filename; $table_rows .= " <tr>\n"; $table_rows .= ' <td><a href="./?locale=' . $current_locale . '" title="See full status of this locale">' . $current_locale . "</a></td>\n"; $table_rows .= ' <td><a href="' . $svn_path . '" target="_blank" title="Open this file on SVN">' . $current_filename . "</a></td>\n"; $table_rows .= ' <td>' . count($locale_analysis['Identical']) . "</td>\n"; $table_rows .= ' <td>' . count($locale_analysis['Translated']) . "</td>\n"; $table_rows .= ' <td>' . count($locale_analysis['Missing']) . "</td>\n"; $table_rows .= ' <td>' . count($locale_analysis['Obsolete']) . "</td>\n";