|
| 1 | +<?php |
| 2 | +namespace Transvision; |
| 3 | + |
| 4 | +?> |
| 5 | +<p class="intro">This view displays strings that are empty in the reference language |
| 6 | + but have a translation in the requested language, and viceversa. |
| 7 | + It can be used to identify strings that should have been localized and |
| 8 | + are empty by mistake, and strings that should actually remain empty. |
| 9 | +</p> |
| 10 | +<form name="searchform" id="simplesearchform" method="get" action=""> |
| 11 | + <fieldset id="main_search"> |
| 12 | + |
| 13 | + <?php if (isset($target_locales_list)) : ?> |
| 14 | + <fieldset> |
| 15 | + <label>Locale</label> |
| 16 | + <div class="select-style"> |
| 17 | + <select name="locale" title="Locale" id="simplesearch_locale"> |
| 18 | + <?=$target_locales_list?> |
| 19 | + </select> |
| 20 | + </div> |
| 21 | + </fieldset> |
| 22 | + <?php endif; ?> |
| 23 | + |
| 24 | + <?php if (isset($channel_selector)) : ?> |
| 25 | + <fieldset> |
| 26 | + <label>Repository</label> |
| 27 | + <div class="select-style"> |
| 28 | + <select name="repo" title="Repository" id="simplesearch_repository"> |
| 29 | + <?=$channel_selector?> |
| 30 | + </select> |
| 31 | + </div> |
| 32 | + </fieldset> |
| 33 | + <?php endif; ?> |
| 34 | + |
| 35 | + <input type="submit" value="Go" alt="Go" /> |
| 36 | + </fieldset> |
| 37 | +</form> |
| 38 | +<?php if (isset($filter_block)) { |
| 39 | + ?> |
| 40 | +<div id="filters"> |
| 41 | + <h4>Filter by folder:</h4> |
| 42 | + <a href="#showall" id="showall" class="filter">Show all results</a> |
| 43 | + <?=$filter_block; ?> |
| 44 | +</div> |
| 45 | +<?php |
| 46 | + |
| 47 | +} |
| 48 | + |
| 49 | +if (count($empty_strings) == 0) { |
| 50 | + echo "<div class=\"message\"><p>No strings found.</p></div>"; |
| 51 | +} else { |
| 52 | + $text_direction = RTLSupport::getDirection($locale); |
| 53 | + $table = "<table class='collapsable results_table sortable'> |
| 54 | + <thead> |
| 55 | + <tr class='column_headers'> |
| 56 | + <th>Entity</th> |
| 57 | + <th>{$reference_locale}</th> |
| 58 | + <th>{$locale}</th> |
| 59 | + </tr> |
| 60 | + </thead> |
| 61 | + <tbody>\n"; |
| 62 | + |
| 63 | + foreach ($empty_strings as $key => $strings) { |
| 64 | + $entity = ShowResults::formatEntity($key); |
| 65 | + $component = explode('/', $key)[0]; |
| 66 | + $reference_string = htmlspecialchars($strings['reference']); |
| 67 | + $locale_string = Strings::highlightSpecial(htmlspecialchars($strings['translation']), false); |
| 68 | + |
| 69 | + $entity_link = "?sourcelocale={$reference_locale}" |
| 70 | + . "&locale={$locale}" |
| 71 | + . "&repo={$repo}" |
| 72 | + . "&search_type=entities&recherche={$key}" |
| 73 | + . "&perfect_match=perfect_match"; |
| 74 | + |
| 75 | + $bugzilla_link = [Bugzilla::reportErrorLink( |
| 76 | + $locale, $key, $reference_string, $locale_string, $repo, $entity_link |
| 77 | + )]; |
| 78 | + |
| 79 | + $reference_path = VersionControl::hgPath($reference_locale, $repo, $key); |
| 80 | + $locale_path = VersionControl::hgPath($locale, $repo, $key); |
| 81 | + |
| 82 | + if (! $reference_string) { |
| 83 | + $reference_string = '<em class="error">(empty)</em>'; |
| 84 | + } |
| 85 | + if ($locale_string == '@@missing@@') { |
| 86 | + $locale_string = '<em class="error">Missing string</em>'; |
| 87 | + } elseif ($locale_string == '') { |
| 88 | + $locale_string = '<em class="error">(empty)</em>'; |
| 89 | + } |
| 90 | + |
| 91 | + // Replace / and : in the key name and use it as an anchor name |
| 92 | + $anchor_name = str_replace(['/', ':'], '_', $key); |
| 93 | + |
| 94 | + $table .= " |
| 95 | + <tr class='{$component}'> |
| 96 | + <td> |
| 97 | + <span class='celltitle'>Entity</span> |
| 98 | + <a class='resultpermalink tag' id='{$anchor_name}' href='#{$anchor_name}' title='Permalink to this string'>link</a> |
| 99 | + <a class='l10n tag' href='/string/?entity={$key}&repo={$repo}' title='List all translations for this entity'>l10n</a> |
| 100 | + <a class='link_to_entity' href=\"/{$entity_link}\">{$entity}</a> |
| 101 | + </td> |
| 102 | + <td dir='ltr' lang='{$reference_locale}'> |
| 103 | + <span class='celltitle'>{$reference_locale}</span> |
| 104 | + <div class='string'> |
| 105 | + {$reference_string} |
| 106 | + </div> |
| 107 | + <div dir='ltr' class='result_meta_link'> |
| 108 | + <a class='source_link' href='{$reference_path}'> |
| 109 | + <source> |
| 110 | + </a> |
| 111 | + </div> |
| 112 | + </td> |
| 113 | + <td dir='{$text_direction}' lang='{$locale}'> |
| 114 | + <span class='celltitle'>{$locale}</span> |
| 115 | + <div class='string'>{$locale_string}</div> |
| 116 | + <div dir='ltr' class='result_meta_link'> |
| 117 | + <a class='source_link' href='{$locale_path}'> |
| 118 | + <source> |
| 119 | + </a> |
| 120 | + |
| 121 | + <a class='bug_link' target='_blank' href='{$bugzilla_link[0]}'> |
| 122 | + <report a bug> |
| 123 | + </a> |
| 124 | + </div> |
| 125 | + </td> |
| 126 | + </tr>"; |
| 127 | + } |
| 128 | + $table .= " </tbody>\n</table>\n"; |
| 129 | + |
| 130 | + echo $table; |
| 131 | +} |
0 commit comments