$common_keys = array_intersect_key($strings[$englishchanges[0] . '-en-US'], $strings[$englishchanges[1] . '-en-US']); $repo_one = $repos_nice_names[$englishchanges[0]]; $repo_two = $repos_nice_names[$englishchanges[1]]; $table = '<table id="englishchanges" class="collapsable">' . '<tr>' . '<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>' . '</tr>' . '<tr>' . '<th>Key</th>' . '<th>' . $repo_one . '</th>' . '<th>' . $repo_two . '</th>' . '</tr>'; foreach ($common_keys as $key => $val) { if (trim(strtolower($strings[$englishchanges[0] . '-en-US'][$key])) != trim(strtolower($strings[$englishchanges[1] . '-en-US'][$key]))) { $table .= '<tr>' . '<td><span class="celltitle">Key</span><div class="string">' . ShowResults::formatEntity($key) . '</div></td>' . '<td><span class="celltitle">Gaia' . $repo_one . '</span><div class="string">' . ShowResults::highlight(Utils::secureText($strings[$englishchanges[0] . '-en-US'][$key]), 'en-US') . '<br><small>' . Utils::secureText($strings[$englishchanges[0]][$key]) . '</small></div></td>' . '<td><span class="celltitle">Gaia' . $repo_two . '</span><div class="string">' . ShowResults::highlight(Utils::secureText($strings[$englishchanges[1] . '-en-US'][$key]), 'en-US') . '<br><small>' . Utils::secureText($strings[$englishchanges[1]][$key]) . '</small></div></td>' . '</tr>'; } } $table .= '</table>'; print $anchor_title('changed_english'); print $table; // String diff between two repositories $strings_added = function ($reverted_comparison, $strings, $repo_one, $repo_two, $anchor, $cssclass) use($locale, $repos_nice_names) { $temp = array_diff_key($strings[$repo_one . '-en-US'], $strings[$repo_two . '-en-US']); $count = count($temp); if ($reverted_comparison) { $comparison_type = '<span class="added_string">' . $count . ' new strings</span>'; } else { $comparison_type = '<span class="deleted_string">' . $count . ' deleted strings</span>'; } $table = '<table id="' . $anchor . '" class="' . $cssclass . '">' . '<tr>' . '<th colspan="3">' . $comparison_type . ' between ' . $repos_nice_names[$repo_one] . ' and ' . $repos_nice_names[$repo_two] . '</th>' . '</tr>' . '<tr>' . '<th>Key</th>' . '<th>New strings</th>' . '</tr>'; foreach ($temp as $k => $v) { $translation = array_key_exists($k, $strings[$repo_one]) ? $strings[$repo_one][$k] : '<b>String untranslated</b>'; $table .= '<tr>' . '<td><span class="celltitle">Key</span><div class="string">' . ShowResults::formatEntity($k) . '</td>' . '<td><span class="celltitle">' . $locale . '</span><div class="string">' . ShowResults::highlight(Utils::secureText($strings[$repo_one . '-en-US'][$k]), 'en-US') . '<br><small>' . ShowResults::highlight(Utils::secureText($translation), $locale) . '</small></div></td>' . '</tr>'; } $table .= '</table>'; return $table; }; print $anchor_title('new_strings'); print $strings_added($reverted_comparison, $strings, $repo1, $repo2, 'newstrings', 'collapsable');
echo $target_locales_list; ?> </select> </fieldset> <fieldset> <label>Channel 1:</label> <select name='chan1'> <?php echo $chan_selector1; ?> </select> </fieldset> <fieldset> <label>Channel 2:</label> <select name='chan2'> <?php echo $chan_selector2; ?> </select> </fieldset> <input type="submit" value="Go" alt="Go" /> </fieldset> </form> <?php echo "\n<table class='collapsable'>" . " <tr>\n" . " <th colspan='3'>Locale: {$locale}</th>\n" . " </tr>\n" . " <tr>\n" . " <th>Key</th>\n" . " <th>{$chan1}</th>\n" . " <th>{$chan2}</th>\n" . " </tr>\n"; foreach ($temp as $k => $v) { echo " <tr>" . " <td><span class='celltitle'>Key</span><div class='string'>" . ShowResults::formatEntity($k) . "</div></td>\n" . " <td><span class='celltitle'>{$chan1}</span><div class='string'>" . ShowResults::highlight($v, $locale) . "</div></td>\n" . " <td><span class='celltitle'>{$chan2}</span><div class='string'>" . ShowResults::highlight($strings[$chan2][$k], $locale) . "</div></td>\n" . " </tr>\n"; } echo "</table>\n";