<?php namespace Transvision; $tmx_target2 = Utils::getRepoStrings($locale2, $check['repo']); if ($search->isPerfectMatch()) { $locale3_strings = preg_grep($search->getRegex(), $tmx_target2); } else { $locale3_strings = $tmx_target2; foreach (Utils::uniqueWords($initial_search) as $word) { $search->setRegexSearchTerms($word); $locale3_strings = preg_grep($search->getRegex(), $locale3_strings); } } array_splice($locale3_strings, 200); foreach (Project::getRepositories() as $repository) { $loc_list[$repository] = Project::getRepositoryLocales($repository); $target_locales_list2[$repository] = Utils::getHtmlSelectOptions($loc_list[$repository], $locale2); }
foreach ($array_in as $elm) { $ch = $elm == $selected_elm ? ' selected' : ''; $elm_nice_name = isset($repos_nice_names[$elm]) ? $repos_nice_names[$elm] : $elm; $string_out .= "<option" . $ch . " value=" . $elm . ">" . $elm_nice_name . "</option>\n"; } return $string_out; }; // Variables // Project::getGaiaRepositories() returns ordered repos from newest to oldest $repo1 = 'gaia'; $repo2 = Project::getLastGaiaBranch(); $locale = $get_or_set($all_locales, 'locale', $locale); $repo1 = $get_or_set($gaia_repos, 'repo1', $repo1); $repo2 = $get_or_set($gaia_repos, 'repo2', $repo2); // Get the locale list $loc_list = Project::getRepositoryLocales('gaia'); // build the target locale & channels switchers $target_locales_list = ''; $channel_selector1 = ''; $channel_selector2 = ''; $target_locales_list = $build_select($loc_list, $locale); $channel_selector1 = $build_select($gaia_repos, $repo1); $channel_selector2 = $build_select($gaia_repos, $repo2); // Check if repo1 is a newer branch than repo2 $reverted_comparison = array_search($repo1, $gaia_repos) < array_search($repo2, $gaia_repos); // Get strings + status for both channel $status = []; $strings = []; foreach ($gaia_repos as $repo) { if ($repo == $repo1 || $repo == $repo2) { $strings[$repo] = $get_repo_strings($locale, $repo);
<?php namespace Transvision; $source = Utils::getRepoStrings(Project::getReferenceLocale($repo), $repo); $target = Utils::getRepoStrings($locale, $repo); // Set up channel selector, ignore mozilla.org $channels = Project::getSupportedRepositories(); unset($channels['mozilla_org']); $channel_selector = Utils::getHtmlSelectOptions($channels, $repo, true); // Build the target locale switcher $target_locales_list = Utils::getHtmlSelectOptions(Project::getRepositoryLocales($repo), $locale); $source = array_map(['Transvision\\AnalyseStrings', 'cleanUpEntities'], $source); $target = array_map(['Transvision\\AnalyseStrings', 'cleanUpEntities'], $target); // We need to ignore some strings because of false positives $ignored_strings = ['mail/chrome/messenger/aboutRights.dtd:rights.webservices-term4', 'suite/chrome/branding/aboutRights.dtd:rights.webservices-term4', 'toolkit/chrome/global/aboutRights.dtd:rights.webservices-term5']; $var_errors = AnalyseStrings::differences($source, $target, $repo, $ignored_strings); $error_count = count($var_errors); // Add component filter if (in_array($repo, $desktop_repos)) { // Build logic to filter components $javascript_include = ['component_filter.js']; $components = Project::getComponents(array_flip($var_errors)); $filter_block = ''; foreach ($components as $value) { $filter_block .= " <a href='#{$value}' id='{$value}' class='filter'>{$value}</a>"; } } // RTL support $direction1 = RTLSupport::getDirection($source_locale); $direction2 = RTLSupport::getDirection($locale);
<?php namespace Transvision; $locales_list = []; $javascript_include = ['/js/show_hide_tabs.js']; foreach (Project::getRepositories() as $repo) { $locales_list = array_merge($locales_list, Project::getRepositoryLocales($repo)); } $ignored_locales = ['es', 'gu-IN', 'ja-JP-mac']; $locales_list = array_unique(array_diff($locales_list, $ignored_locales)); // Sort by locale name sort($locales_list); if (isset($_GET['locale'])) { $page_locale = Utils::getOrSet($locales_list, $_GET['locale'], 'en-US'); } else { $l10n = new \tinyl10n\ChooseLocale($locales_list); $page_locale = $l10n->getCompatibleLocale(); } include MODELS . 'health_status.php'; include VIEWS . 'health_status.php';
} if (isset($_GET['chan2']) && in_array($_GET['chan2'], $desktop_repos)) { $chan2 = $_GET['chan2']; } $strings = []; $strings[$chan1] = Utils::getRepoStrings($locale, $chan1); $strings[$chan2] = Utils::getRepoStrings($locale, $chan2); $chan_selector1 = $chan_selector2 = ''; foreach ($desktop_repos as $repo) { $ch1 = $repo == $chan1 ? ' selected' : ''; $ch2 = $repo == $chan2 ? ' selected' : ''; $chan_selector1 .= "\t<option" . $ch1 . " value=" . $repo . ">" . $repos_nice_names[$repo] . "</option>\n"; $chan_selector2 .= "\t<option" . $ch2 . " value=" . $repo . ">" . $repos_nice_names[$repo] . "</option>\n"; } // Get the locale list $loc_list = Project::getRepositoryLocales($repo); // Build the target locale switcher $target_locales_list = ''; foreach ($loc_list as $loc) { $ch = $loc == $locale ? ' selected' : ''; $target_locales_list .= "\t<option" . $ch . " value=" . $loc . ">" . $loc . "</option>\n"; } $temp = array_intersect_key($strings[$chan1], $strings[$chan2]); $temp = array_diff($temp, $strings[$chan2]); ?> <form id ="searchform" name="searchform" method="get" action=""> <fieldset id="main_search"> <fieldset> <label>Locale:</label> <select name='locale'>
?> "></script> <?php } ?> <script> var supported_locales = []; <?php /* Building array of supported locales for JavaScript functions. * This is inline because it shouldn't be cached by the browser. * Note: encoding array_values() instead of the array makes sure * that json_encode returns an array and not an object. */ foreach (Project::getSupportedRepositories() as $repo_id => $repo_name) { print " supported_locales['{$repo_id}'] = " . json_encode(array_values(Project::getRepositoryLocales($repo_id))) . ";\n"; } ?> </script> <?php // Piwik Optional integration in production mode if (!LOCAL_DEV) { include VIEWS . 'templates/piwik.php'; } ?> </body> </html> <?php $content = ob_get_contents();
<?php namespace Transvision; $strings = []; // We only want software on this view, not websites unset($repos[array_search('mozilla_org', $repos)]); $repo = isset($_GET['repo']) && in_array($_GET['repo'], $repos) ? $_GET['repo'] : 'gaia'; $channel_selector = ''; foreach ($repos as $val) { $ch = $val == $repo ? ' selected' : ''; $channel_selector .= "\t<option" . $ch . " value=" . $val . ">" . $repos_nice_names[$val] . "</option>\n"; } // Using a callback with strlen() avoids filtering out numeric strings with a value of 0 $strings['en-US'][$repo] = array_filter(Utils::getRepoStrings('en-US', $repo), 'strlen'); $gaia_locales = Project::getRepositoryLocales($repo); // We don't want en-US in the repos if ($key = array_search('en-US', $gaia_locales)) { unset($gaia_locales[$key]); } $string_count = []; // Referen_ce locale count $count_reference = count($strings['en-US'][$repo]); foreach ($gaia_locales as $val) { $strings[$val][$repo] = array_filter(Utils::getRepoStrings($val, $repo), 'strlen'); $string_count[$val] = ['total' => count($strings[$val][$repo]), 'missing' => count(array_diff_key($strings['en-US'][$repo], $strings[$val][$repo])), 'identical' => count(array_intersect_assoc($strings['en-US'][$repo], $strings[$val][$repo]))]; unset($strings[$val][$repo]); } $json = []; $table = ' <style>td {text-align:right;} form[name="searchform"] { text-align: center; }</style>
<?php namespace Transvision; $json = Project::getRepositoryLocales($request->parameters[2]);