/** * @dataProvider isObsoleteFileDP */ public function testIsObsoleteFile($a, $b, $c, $d) { $obj = new _Project(); $this->boolean($obj->isObsoleteFile($a, $b, $c))->isEqualTo($d); }
$current_locale = $locale; foreach ($sites as $website) { if (Project::isSupportedLocale($website, $current_locale)) { $website_data_source = Project::getWebsiteDataType($website); foreach (Project::getWebsiteFiles($website) as $filename) { if (!Project::isSupportedLocale($website, $current_locale, $filename, $langfiles_subsets)) { // File is not managed for this website+locale, ignore it continue; } $reference_locale = Project::getReferenceLocale($website); $website_name = Project::getWebsiteName($website); $displayed_filename = $website_data_source == 'lang' ? $filename : basename($filename); $file_flags = Project::getFileFlags($website, $filename, $current_locale); if ($website_data_source == 'lang') { $locale_filename = Project::getLocalFilePath($website, $current_locale, $filename); if (!is_file($locale_filename) || Project::isObsoleteFile($website, $filename, $current_locale)) { // File is missing or marked as obsolete continue; } // Load reference strings $reference_data = LangManager::loadSource($website, $reference_locale, $filename); $locale_analysis = LangManager::analyzeLangFile($website, $current_locale, $filename, $reference_data); $export_data[$website_name][$displayed_filename]['identical'] = count($locale_analysis['Identical']); $export_data[$website_name][$displayed_filename]['missing'] = count($locale_analysis['Missing']); $export_data[$website_name][$displayed_filename]['obsolete'] = count($locale_analysis['Obsolete']); $export_data[$website_name][$displayed_filename]['translated'] = count($locale_analysis['Translated']); $export_data[$website_name][$displayed_filename]['errors'] = LangManager::countErrors($locale_analysis['errors']); } else { $file_analysis = RawManager::compareRawFiles($website, $current_locale, $filename); $cmp_result = $file_analysis['cmp_result']; $export_data[$website_name][$displayed_filename]['status'] = $cmp_result;
$untranslated[$current_locale] = 0; $translated[$current_locale] = 0; $file_count[$current_locale] = 0; foreach (Project::getWebsitesByDataType($sites, 'lang') as $current_website) { $reference_locale = Project::getReferenceLocale($current_website); // Ignore reference language if ($current_locale == $reference_locale) { continue; } foreach (Project::getWebsiteFiles($current_website) as $current_filename) { // File not supported if (!Project::isSupportedLocale($current_website, $current_locale, $current_filename, $langfiles_subsets)) { continue; } // File marked as obsolete if (Project::isObsoleteFile($current_website, $current_filename, $current_locale)) { continue; } // File doesn't exist if (!file_exists(Project::getLocalFilePath($current_website, $current_locale, $current_filename))) { continue; } $reference_data = LangManager::loadSource($current_website, $reference_locale, $current_filename); $locale_analysis = LangManager::analyzeLangFile($current_website, $current_locale, $current_filename, $reference_data); $untranslated[$current_locale] += count($locale_analysis['Identical']) + count($locale_analysis['Missing']); $translated[$current_locale] += count($locale_analysis['Translated']); $file_count[$current_locale] += 1; } } $all_strings[$current_locale] = $untranslated[$current_locale] + $translated[$current_locale]; }
$complete_locales_count = 0; $complete_locales_list = []; $json_data = []; $reference_locale = Project::getReferenceLocale($current_website); if ($website_data_source == 'lang') { // Websites using .lang files $activated_locales_count = 0; $activated_locales_list = []; $file_activable = !in_array($current_filename, $no_active_tag); $reference_data = LangManager::loadSource($current_website, $reference_locale, $current_filename); $translation_link = "?website={$website}&file={$current_filename}&action=translate"; echo ' <table class="sortable globallist"> <caption class="filename"> <a href="' . $translation_link . '" title="View available translations for this file">' . $current_filename . '</a>'; if (Project::isObsoleteFile($current_website, $current_filename, 'all')) { echo '<span class="obsolete_warning">(this file is obsolete)</span>'; } echo ' </caption> <thead> <tr> <th>Locale</th> <th>Identical</th> <th>Translated</th> <th>Missing</th> <th>Obsolete</th> <th>Tags</th> <th>URL</th> <th>Activated</th> </tr>