|
100 | 100 | // Overview of string count for the locale |
101 | 101 | $overview = function ($section_title, $columns, $rows, $anchor) { |
102 | 102 | // Titles |
103 | | - $html = '<table id="' . $anchor . '">' |
104 | | - . '<tr>' |
105 | | - . '<th colspan="3">' . $section_title . '</th>' |
106 | | - . '</tr>' |
107 | | - . '<tr>'; |
| 103 | + $html = " |
| 104 | + <p class='section_title'>{$section_title}</p> |
| 105 | + <table id='{$anchor}'> |
| 106 | + <thead> |
| 107 | + <tr class='column_headers'>"; |
108 | 108 | foreach ($columns as $key => $value) { |
109 | 109 | $html .= '<th>' . $value . '</th>'; |
110 | 110 | } |
111 | | - $html .= '</tr>'; |
| 111 | + $html .= "</tr>\n</thead>\n<tbody>\n"; |
112 | 112 |
|
113 | 113 | // Rows |
114 | 114 | foreach ($rows as $key => $row) { |
|
118 | 118 | } |
119 | 119 | $html .= '</tr>'; |
120 | 120 | } |
121 | | - $html .= '</table>'; |
| 121 | + $html .= "</tbody>\n</table>\n"; |
122 | 122 |
|
123 | 123 | return $html; |
124 | 124 | }; |
|
174 | 174 | $nb_sources = count($diverging_sources) + 1; |
175 | 175 | $width = 100 / $nb_sources; |
176 | 176 |
|
177 | | - $table = '<table id="' . $anchor . '" class="collapsable">' |
178 | | - . '<tr>' |
179 | | - . '<th colspan="' . $nb_sources . '">' . count($divergences) . ' diverging translations across repositories</th>' |
180 | | - . '</tr>' |
181 | | - . '<tr>'; |
182 | | - $table .= "<th style=\"width:$width%\">Keys</th>"; |
| 177 | + $section_title = count($divergences) . ' diverging translations across repositories'; |
| 178 | + $table = " |
| 179 | + <p class='section_title'>{$section_title}</p> |
| 180 | + <table id='{$anchor}' class='collapsable'> |
| 181 | + <thead> |
| 182 | + <tr class='column_headers'> |
| 183 | + <th style='width: {$width}%;'>Keys</th>"; |
183 | 184 | foreach ($diverging_sources as $key => $repo_name) { |
184 | | - $table .= "<th style=\"width:$width%\">" . $repos_nice_names[$repo_name] . '</th>'; |
| 185 | + $table .= "<th style='width: $width%;'>{$repos_nice_names[$repo_name]}</th>\n"; |
185 | 186 | } |
186 | 187 |
|
187 | | - $table .= '</tr>'; |
| 188 | + $table .= "</tr>\n</thead>\n<tbody>\n"; |
188 | 189 |
|
189 | 190 | foreach ($divergences as $v) { |
190 | 191 | $table .= '<tr>' |
|
195 | 196 | $table .= '</tr>'; |
196 | 197 | } |
197 | 198 |
|
198 | | - $table .= '</table>'; |
| 199 | + $table .= "</tbody>\n</table>\n"; |
199 | 200 |
|
200 | 201 | return $table; |
201 | 202 | }; |
|
217 | 218 |
|
218 | 219 | $repo_one = $repos_nice_names[$englishchanges[0]]; |
219 | 220 | $repo_two = $repos_nice_names[$englishchanges[1]]; |
220 | | -$table = '<table id="englishchanges" class="collapsable">' |
221 | | - . '<tr>' |
222 | | - . '<th colspan="3">Strings that have changed significantly in English between ' . $repo_one . ' and ' . $repo_two . ' but for which the entity name didn\'t change</th>' |
223 | | - . '</tr>' |
224 | | - . '<tr>' |
225 | | - . '<th>Key</th>' |
226 | | - . '<th>' . $repo_one . '</th>' |
227 | | - . '<th>' . $repo_two . '</th>' |
228 | | - . '</tr>'; |
229 | 221 |
|
| 222 | +$section_title = "Strings that have changed significantly in English between {$repo_one} and {$repo_two} but for which the entity name didn’t change"; |
| 223 | +$table = " |
| 224 | + <p class='section_title'>{$section_title}</p> |
| 225 | + <table id='englishchanges' class='collapsable'> |
| 226 | + <thead> |
| 227 | + <tr class='column_headers'> |
| 228 | + <th>Key</th> |
| 229 | + <th>{$repo_one}</th> |
| 230 | + <th>{$repo_two}</th> |
| 231 | + </tr> |
| 232 | + </thead> |
| 233 | + <tbody>\n"; |
| 234 | + |
| 235 | +$changed_strings = 0; |
230 | 236 | foreach ($common_keys as $key => $val) { |
231 | 237 | $get_localized_string = function ($id) use ($key, $strings) { |
232 | 238 | // Avoid warnings if the string is not localized |
|
246 | 252 | . ShowResults::highlight(Utils::secureText($strings[$englishchanges[1] . '-en-US'][$key])) |
247 | 253 | . '<br><small>' . $get_localized_string($englishchanges[1]) . '</small></div></td>' |
248 | 254 | . '</tr>'; |
| 255 | + $changed_strings++; |
249 | 256 | } |
250 | 257 | } |
251 | | -$table .= '</table>'; |
| 258 | + |
| 259 | +if ($changed_strings == 0) { |
| 260 | + $table .= "<tr><td colspan='3' class='no_highligth'>There are no changed strings.</td></tr>\n"; |
| 261 | +} |
| 262 | +$table .= "</tbody>\n</table>\n"; |
252 | 263 |
|
253 | 264 | print $anchor_title('changed_english'); |
254 | 265 | print $table; |
|
263 | 274 | $comparison_type = '<span class="deleted_string">' . $count . ' deleted strings</span>'; |
264 | 275 | } |
265 | 276 |
|
266 | | - $table = '<table id="' . $anchor . '" class="' . $cssclass . '">' |
267 | | - . '<tr>' |
268 | | - . '<th colspan="3">' . $comparison_type . ' between ' . $repos_nice_names[$repo_one] . ' and ' . $repos_nice_names[$repo_two] . '</th>' |
269 | | - . '</tr>' |
270 | | - . '<tr>' |
271 | | - . '<th>Key</th>' |
272 | | - . '<th>New strings</th>' |
273 | | - . '</tr>'; |
| 277 | + $section_title = "{$comparison_type} between {$repos_nice_names[$repo_one]} and {$repos_nice_names[$repo_two]}"; |
| 278 | + $table = " |
| 279 | + <p class='section_title'>{$section_title}</p> |
| 280 | + <table id='{$anchor}' class='{$cssclass}'> |
| 281 | + <thead> |
| 282 | + <tr class='column_headers'> |
| 283 | + <th>Key</th> |
| 284 | + <th>New strings</th> |
| 285 | + </tr> |
| 286 | + </thead> |
| 287 | + <tbody>\n"; |
274 | 288 |
|
275 | 289 | foreach ($temp as $k => $v) { |
276 | 290 | $translation = array_key_exists($k, $strings[$repo_one]) |
|
286 | 300 | . '</tr>'; |
287 | 301 | } |
288 | 302 |
|
289 | | - $table .= '</table>'; |
| 303 | + $table .= "</tbody>\n</table>\n"; |
290 | 304 |
|
291 | 305 | return $table; |
292 | 306 | }; |
|
0 commit comments