|
| 1 | +<?php |
| 2 | +namespace Transvision; |
| 3 | + |
| 4 | +// Include the common simple search form |
| 5 | +include __DIR__ . '/simplesearchform.php'; |
| 6 | + |
| 7 | +if (! empty($commandkey_results)) { |
| 8 | + $search_id = 'commandkeys'; |
| 9 | + $content = ''; |
| 10 | + if (! empty($error_messages)) { |
| 11 | + $content .= '<p class="error">' . |
| 12 | + implode('<br/>', $error_messages) . |
| 13 | + '</p>'; |
| 14 | + } |
| 15 | + $content .= "<h2><span class=\"results_count_{$search_id}\">" |
| 16 | + . Utils::pluralize(count($commandkey_results), 'potential keyboard shortcuts error') |
| 17 | + . "</span> found</h2>\n"; |
| 18 | + |
| 19 | + if (isset($filter_block)) { |
| 20 | + $content .= "<div id='filters'>" . |
| 21 | + " <h4>Filter by folder:</h4>\n" . |
| 22 | + " <a href='#showall' id='showall' class='filter'>Show all results</a>\n" . |
| 23 | + $filter_block . |
| 24 | + "</div>\n"; |
| 25 | + } |
| 26 | + |
| 27 | + $content .= " |
| 28 | + <table class='collapsable results_table sortable {$search_id}'> |
| 29 | + <thead> |
| 30 | + <tr class='column_headers'> |
| 31 | + <th>Entity</th> |
| 32 | + <th>{$reference_locale}</th> |
| 33 | + <th>{$locale}</th> |
| 34 | + </tr> |
| 35 | + </thead> |
| 36 | + <tbody>\n"; |
| 37 | + |
| 38 | + // Get the tool used to edit strings for the target locale |
| 39 | + $toolUsedByTargetLocale = Project::getLocaleTool($locale); |
| 40 | + |
| 41 | + foreach ($commandkey_results as $key) { |
| 42 | + $entity = ShowResults::formatEntity($key); |
| 43 | + $component = explode('/', $key)[0]; |
| 44 | + |
| 45 | + $entity_link = "?sourcelocale={$reference_locale}" |
| 46 | + . "&locale={$locale}" |
| 47 | + . "&repo={$repo}" |
| 48 | + . "&search_type=entities&recherche={$key}" |
| 49 | + . '&entire_string=entire_string'; |
| 50 | + |
| 51 | + $translated_shortcut = $target[$key]; |
| 52 | + $source_shortcut = $source[$key]; |
| 53 | + |
| 54 | + $edit_link = $toolUsedByTargetLocale != '' |
| 55 | + ? ShowResults::getEditLink($toolUsedByTargetLocale, $repo, $key, $translated_shortcut, $locale) |
| 56 | + : ''; |
| 57 | + |
| 58 | + $bugzilla_link = [Bugzilla::reportErrorLink( |
| 59 | + $locale, $key, $source_shortcut, $translated_shortcut, $repo, $entity_link |
| 60 | + )]; |
| 61 | + |
| 62 | + $reference_path = VersionControl::hgPath($reference_locale, $repo, $key); |
| 63 | + $locale_path = VersionControl::hgPath($locale, $repo, $key); |
| 64 | + |
| 65 | + if (! $source_shortcut) { |
| 66 | + $source_shortcut = '<em class="error">(empty)</em>'; |
| 67 | + } |
| 68 | + if ($translated_shortcut == '@@missing@@') { |
| 69 | + $translated_shortcut = '<em class="error">Missing string</em>'; |
| 70 | + } elseif ($translated_shortcut == '') { |
| 71 | + $translated_shortcut = '<em class="error">(empty)</em>'; |
| 72 | + } |
| 73 | + |
| 74 | + // Replace / and : in the key name and use it as an anchor name |
| 75 | + $anchor_name = str_replace(['/', ':'], '_', $key); |
| 76 | + |
| 77 | + $content .= " |
| 78 | + <tr class='{$component} {$search_id}'> |
| 79 | + <td> |
| 80 | + <span class='celltitle'>Entity</span> |
| 81 | + <a class='resultpermalink tag' id='{$anchor_name}' href='#{$anchor_name}' title='Permalink to this string'>#</a> |
| 82 | + <a class='l10n tag' href='/string/?entity={$key}&repo={$repo}' title='List all translations for this entity'>all locales</a> |
| 83 | + <span class='link_to_entity'> |
| 84 | + <a href=\"/{$entity_link}\">{$entity}</a> |
| 85 | + </span> |
| 86 | + </td> |
| 87 | + <td dir='ltr' lang='{$reference_locale}'> |
| 88 | + <span class='celltitle'>{$reference_locale}</span> |
| 89 | + <div class='string'> |
| 90 | + {$source_shortcut} |
| 91 | + </div> |
| 92 | + <div dir='ltr' class='result_meta_link'> |
| 93 | + <a class='source_link' href='{$reference_path}'> |
| 94 | + <source> |
| 95 | + </a> |
| 96 | + </div> |
| 97 | + </td> |
| 98 | + <td dir='{$text_direction}' lang='{$locale}'> |
| 99 | + <span class='celltitle'>{$locale}</span> |
| 100 | + <div class='string'>{$translated_shortcut}</div> |
| 101 | + <div dir='ltr' class='result_meta_link'> |
| 102 | + <a class='source_link' href='{$locale_path}'> |
| 103 | + <source> |
| 104 | + </a> |
| 105 | + {$edit_link} |
| 106 | + |
| 107 | + <a class='bug_link' target='_blank' href='{$bugzilla_link[0]}'> |
| 108 | + <report a bug> |
| 109 | + </a> |
| 110 | + </div> |
| 111 | + </td> |
| 112 | + </tr>"; |
| 113 | + } |
| 114 | + $content .= "</tbody>\n</table>\n"; |
| 115 | +} else { |
| 116 | + $content = '<h2>Congratulations, no errors found.</h2>'; |
| 117 | +} |
| 118 | + |
| 119 | +print $content; |
0 commit comments