|
1 | 1 | <?php |
2 | 2 | namespace Transvision; |
3 | 3 |
|
4 | | -$strings = []; |
| 4 | +// Include the common simple search form |
| 5 | +include __DIR__ . '/simplesearchform.php'; |
5 | 6 |
|
6 | | -// We only want software on this view, not websites |
7 | | -unset($repos[array_search('mozilla_org', $repos)]); |
| 7 | +?> |
| 8 | +<p class="page_description">Note that it’s not possible to distinguish between untranslated |
| 9 | + strings and strings left blank on purpose.<br> For this reason the number of <em>Missing</em> |
| 10 | + string reported on this page might not be completely accurate.</p> |
| 11 | +<p class="page_description">Click on the column headers to order the table.</p> |
8 | 12 |
|
9 | | -$repo = (isset($_GET['repo']) && in_array($_GET['repo'], $repos)) |
10 | | - ? $_GET['repo'] |
11 | | - : 'gaia'; |
12 | | - |
13 | | -$channel_selector = ''; |
14 | | - |
15 | | -foreach ($repos as $val) { |
16 | | - $ch = ($val == $repo) ? ' selected' : ''; |
17 | | - $channel_selector .= "\t<option" . $ch . " value=" . $val . ">" . $repos_nice_names[$val] . "</option>\n"; |
18 | | -} |
19 | | - |
20 | | -// Using a callback with strlen() avoids filtering out numeric strings with a value of 0 |
21 | | -$strings['en-US'][$repo] = array_filter(Utils::getRepoStrings('en-US', $repo), 'strlen'); |
22 | | -$gaia_locales = Project::getRepositoryLocales($repo); |
23 | | - |
24 | | -// We don't want en-US in the repos |
25 | | -if ($key = array_search('en-US', $gaia_locales)) { |
26 | | - unset($gaia_locales[$key]); |
27 | | -} |
28 | | - |
29 | | -$string_count = []; |
30 | | - |
31 | | -// Reference locale count |
32 | | -$count_reference = count($strings['en-US'][$repo]); |
33 | | - |
34 | | -foreach ($gaia_locales as $val) { |
35 | | - $strings[$val][$repo] = array_filter(Utils::getRepoStrings($val, $repo), 'strlen'); |
36 | | - $string_count[$val] = [ |
37 | | - 'total' => count($strings[$val][$repo]), |
38 | | - 'missing' => count(array_diff_key($strings['en-US'][$repo], $strings[$val][$repo])), |
39 | | - 'identical' => count(array_intersect_assoc($strings['en-US'][$repo], $strings[$val][$repo])), |
40 | | - ]; |
41 | | - unset($strings[$val][$repo]); |
42 | | -} |
43 | | - |
44 | | -$json = []; |
45 | | -$table = ' |
46 | | -<table id="showrepos_table"> |
| 13 | +<table id="showrepos_table" class="sortable"> |
47 | 14 | <thead> |
48 | 15 | <tr class="column_headers"> |
49 | 16 | <th>Locale</th> |
|
52 | 19 | <th>Translated</th> |
53 | 20 | <th>Identical</th> |
54 | 21 | <th>Completion</th> |
55 | | - <th>Status estimate</th> |
| 22 | + <th class="sorttable_nosort">Status estimate</th> |
56 | 23 | </tr> |
57 | 24 | </thead> |
58 | | - <tbody>'; |
59 | | - |
60 | | -foreach ($string_count as $locale => $numbers) { |
61 | | - $completion = $count_reference - $numbers['identical'] - $numbers['missing']; |
62 | | - |
63 | | - // Making sure we never divide by zero while computing percentage |
64 | | - $completion = $count_reference == 0 ? 0 : number_format($completion / $count_reference * 100); |
65 | | - |
66 | | - if ($completion >= 99) { |
67 | | - $confidence = 'Highest'; |
68 | | - } elseif ($completion >= 95) { |
69 | | - $confidence = 'High'; |
70 | | - } elseif ($completion >= 90) { |
71 | | - $confidence = 'High'; |
72 | | - } elseif ($completion >= 60) { |
73 | | - $confidence = 'In progress'; |
74 | | - } elseif ($completion >= 50) { |
75 | | - $confidence = 'Low'; |
76 | | - } elseif ($completion >= 30) { |
77 | | - $confidence = 'very Low'; |
78 | | - } elseif ($completion >= 10) { |
79 | | - $confidence = 'Barely started'; |
80 | | - } elseif ($completion >= 1) { |
81 | | - $confidence = 'just started'; |
82 | | - } else { |
83 | | - $confidence = 'No localization'; |
| 25 | + <tbody> |
| 26 | +<?php |
| 27 | + foreach ($table_data as $locale => $stats) { |
| 28 | + $translated = $stats['total'] - $stats['identical']; |
| 29 | + echo " |
| 30 | + <tr id=\"{$locale}\"> |
| 31 | + <th>{$locale}</th> |
| 32 | + <td>{$stats['total']}</td> |
| 33 | + <td>{$stats['missing']}</td> |
| 34 | + <td>{$translated}</td> |
| 35 | + <td>{$stats['identical']}</td> |
| 36 | + <td sorttable_customkey=\"{$stats['completion']}\">{$stats['completion']} %</td> |
| 37 | + <td>{$stats['confidence']}</td> |
| 38 | + </tr>\n"; |
84 | 39 | } |
85 | | - |
86 | | - $json[$locale] = [ |
87 | | - 'total' => $numbers['total'], |
88 | | - 'missing' => $numbers['missing'], |
89 | | - 'translated' => ($numbers['total'] - $numbers['identical']), |
90 | | - 'identical' => $numbers['identical'], |
91 | | - 'completion' => $completion, |
92 | | - 'confidence' => $confidence, |
93 | | - ]; |
94 | | - |
95 | | - $table .= |
96 | | - "<tr id=\"{$locale}\"> |
97 | | - <th>{$locale}</th> |
98 | | - <td>{$numbers['total']}</td> |
99 | | - <td>{$numbers['missing']}</td>" |
100 | | - . '<td>' . ($numbers['total'] - $numbers['identical']) . '</td>' |
101 | | - . "<td>{$numbers['identical']}</td> |
102 | | - <td>{$completion} %</td> |
103 | | - <td>{$confidence}</td> |
104 | | - </tr>"; |
105 | | -} |
106 | | - |
107 | | -$table .= "</tbody>\n</table>\n"; |
108 | | - |
109 | | -if (isset($_GET['json'])) { |
110 | | - include VIEWS . 'json.php'; |
111 | | -} else { |
112 | | - // Include the common simple search form |
113 | | - include __DIR__ . '/simplesearchform.php'; |
114 | | - echo $table; |
115 | | -} |
| 40 | +?> |
| 41 | + </tbody> |
| 42 | +</table> |
0 commit comments