diff options
author | filip <filip.komar@gmail.com> | 2021-03-19 15:58:29 +0100 |
---|---|---|
committer | filip <filip.komar@gmail.com> | 2021-03-19 15:58:29 +0100 |
commit | 65c45260fc7d9118823fc688e6bcf4640b439eb3 (patch) | |
tree | f92f258e7be60b5cd381bb148443aebcc0063f10 | |
parent | e956c17e7f73ad096d4f08828052abbbc1626912 (diff) | |
download | www-65c45260fc7d9118823fc688e6bcf4640b439eb3.tar www-65c45260fc7d9118823fc688e6bcf4640b439eb3.tar.gz www-65c45260fc7d9118823fc688e6bcf4640b439eb3.tar.bz2 www-65c45260fc7d9118823fc688e6bcf4640b439eb3.tar.xz www-65c45260fc7d9118823fc688e6bcf4640b439eb3.zip |
color cells with difference is bigger than 10% or 50 strings
-rw-r--r-- | langs/report_tx_git.php | 27 |
1 files changed, 24 insertions, 3 deletions
diff --git a/langs/report_tx_git.php b/langs/report_tx_git.php index 76460a1a5..8eebed3b0 100644 --- a/langs/report_tx_git.php +++ b/langs/report_tx_git.php @@ -485,6 +485,12 @@ if (0 < $num_of_resources_w_difference && $num_for_switch_table_to_list > $num_o $table_rows[] = "<thead>" . PHP_EOL; $first_row_pass = TRUE; $col_repeat = 8; + $limit_factor_difference = 10; // difference is bigger than 10% + $limit_number_difference = 50; // difference is bigger than 50 strings + $clr_red = ' style="background-color: hsl(0, 100%, 85%);"'; + $clr_yellow = ' style="background-color: hsl(60, 100%, 85%);"'; + $legend = ''; + $show_legend = FALSE; foreach ($tx_git_difference as $one_language => $one_language_array) { $j = 0; $row = array(); @@ -517,7 +523,18 @@ if (0 < $num_of_resources_w_difference && $num_for_switch_table_to_list > $num_o $stat_data['git_path'] = $one_language_array[$resource_with_tx_git_diff]['webgit_path']; $stat_data['pot_name'] = $one_language_array[$resource_with_tx_git_diff]['pot_name']; - $cell = "<span class=\"stat\">"; + $completion_difference_number = abs($stat_data['tx_untran'] - $stat_data['git_untran']); + $completion_difference_factor = $completion_difference_number / $stat_data['num_of_all']; + if (0 == $stat_data['tx_untran'] || 0 == $stat_data['git_untran']) { + $cell_style = $clr_red; + $show_legend = TRUE; + } else if ($limit_factor_difference < 100 * $completion_difference_factor || $limit_number_difference < $completion_difference_number) { // difference is bigger than limits + $cell_style = $clr_yellow; + $show_legend = TRUE; + } else { + $cell_style = ''; + } + $cell = "<span$cell_style class=\"stat\">"; $cell .= build_links($resource_with_tx_git_diff, $one_language, $resource_type, $stat_data); $cell .= "</span>"; $row[] = $cell; @@ -529,6 +546,10 @@ if (0 < $num_of_resources_w_difference && $num_for_switch_table_to_list > $num_o $table_rows[] = "<tr><td class=\"add\">" . implode("</td><td>", $row) . "</td></tr>" . PHP_EOL; $i++; } + if (TRUE == $show_legend) { + $legend = " (<span$clr_yellow>difference is bigger than $limit_factor_difference% or "; + $legend .= "$limit_number_difference strings</span>, <span$clr_red>fully translated in either git or Transifex</span>)"; + } $table_rows[] = "</tbody>" . PHP_EOL; $table_rows[] = "</table>" . PHP_EOL; $table_difference = implode($table_rows); @@ -622,7 +643,7 @@ $resources_link = implode(", ", $resources_links); $reports_links = '<p>You can also see reports about differences in ' . implode(" or ", $links) . '.</p>'; $reports_links .= "<p>For software translations please choose one of it's $num_of_tx_cauldron_resources resources ($resources_link) or "; -$reports_links .= "one of a $num_of_tx_langs languages ($languages_link) currently present in Transifex.</p>"; +$reports_links .= "one of a $num_of_tx_langs languages with variants ($languages_link) currently present in Transifex.</p>"; $reports_links .= '<p>There is a nice '; $reports_links .= '<a href="https://wiki.mageia.org/en/Transifex_and_git_syncing">wiki page about Transifex and git synchronising</a>.</p>'; echo $reports_links . PHP_EOL; @@ -655,7 +676,7 @@ if (0 < $num_of_resources_w_difference) { } echo $diff_title; echo '<p>To avoid further alienation and confusion please synchronise them.</p>'; - echo '<p>They differs on number of untranslated strings in resources:</p>'; + echo "<p>They differs on number of untranslated strings in resources$legend:</p>"; // print a detailed strings difference table if wanted if ($details_wanted) { echo $table_w_details . PHP_EOL; |