Permalink
Show file tree
Hide file tree
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
* improved server side perfs (memory and CPU) (#1)
* * improved server side perfs (memory and CPU) * add some caching to the view as calculations are still time intensive * add text blurb about # of occurrences * Add a column selector at the top to choose locales * nits
- Loading branch information
1 parent
815c07c
commit 6b677ba926cfd1a0ff727e7424c48eb5aebdaa3c
Showing
7 changed files
with
147 additions
and
141 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,46 +1,48 @@ | ||
<?php | ||
namespace Transvision; | ||
|
||
?> | ||
<p>You might be interested in high values to validate your translation choices and in low values to check for potential mistakes.</p> | ||
<?php | ||
// Include the common simple search form | ||
include __DIR__ . '/simplesearchform.php'; | ||
|
||
$search_id = 'unlocalized_strings'; | ||
|
||
$content = "<table class='collapsable results_table sortable {$search_id}'> | ||
<thead> | ||
<tr class='column_headers'> | ||
<th>English</th>"; | ||
|
||
foreach ($all_locales as $locale) { | ||
$content .= "<th>{$locale}</th>"; | ||
} | ||
|
||
$content .= "</tr> | ||
</thead> | ||
<tbody>\n"; | ||
|
||
foreach ($unlocalized_words as $english_term => $locales) { | ||
|
||
$content .= " <tr class='{$search_id}'>\n" . | ||
" <td>{$english_term}</td>\n"; | ||
|
||
foreach ($all_locales as $locale) { | ||
$count = 0; | ||
if (in_array($locale, array_keys($locales))) { | ||
$count = $locales[$locale]; | ||
?> | ||
<p>Click on each checkbox below to show/hide the corresponding column.</p> | ||
<fieldset id="grpChkBox"> | ||
<legend>Locales</legend> | ||
<?php foreach ($all_locales as $locale) : ?> | ||
<label><input type="checkbox" name="<?=$locale?>" /> <?=$locale?></label> | ||
<?php endforeach ?> | ||
</fieldset> | ||
<table class="collapsable results_table sortable" id="words"> | ||
<thead> | ||
<tr class="column_headers"> | ||
<th>Word</th> | ||
<?php foreach ($all_locales as $locale) : ?> | ||
<th class="<?=$locale?> hide"><?=$locale?></th> | ||
<?php endforeach ?> | ||
</tr> | ||
</thead> | ||
<tbody> | ||
<?php foreach ($unlocalized_words as $english_term => $locales) : ?> | ||
<tr><td><?=$english_term?></td><?php | ||
foreach ($all_locales as $locale) { | ||
$count = 0; | ||
if (in_array($locale, array_keys($locales))) { | ||
$count = $locales[$locale]; | ||
} | ||
|
||
$link = "/?recherche={$english_term}&repo={$repo}&sourcelocale={$locale}" . | ||
"&locale={$ref_locale}&search_type=strings&whole_word=whole_word"; | ||
|
||
if ($count > 0) { | ||
print "<td><a href='{$link}'>{$count}</a></td>"; | ||
} else { | ||
print "<td></td>"; | ||
} | ||
} | ||
|
||
$link = "/?recherche={$english_term}&repo={$repo}&sourcelocale={$locale}" . | ||
"&locale={$ref_locale}&search_type=strings&whole_word=whole_word"; | ||
|
||
$link_title = $count == 1 | ||
? 'Search for this occurrence' | ||
: 'Search for these occurrences'; | ||
|
||
$content .= " <td><a href='{$link}' title='{$link_title}'>{$count}</a></td>\n"; | ||
} | ||
$content .= " </tr>\n"; | ||
} | ||
$content .= "</tbody>\n</table>\n"; | ||
|
||
echo $content; | ||
?></tr> | ||
<?php endforeach ?> | ||
</tbody> | ||
</table> | ||
<?php unset($unlocalized_words);?> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
$(document).ready(function() { | ||
var $chk = $('#grpChkBox input:checkbox'); | ||
var $tbl = $('#words'); | ||
var $tblhead = $('#words th'); | ||
|
||
$chk.prop('checked', false); | ||
|
||
$chk.click(function() { | ||
var colToHide = $tblhead.filter('.' + $(this).attr('name')); | ||
var index = $(colToHide).index(); | ||
if (colToHide.css('display') === 'none') { | ||
$tbl.find('tr :nth-child(' + (index + 1) + ')').css('display', 'table-cell'); | ||
} else { | ||
$tbl.find('tr :nth-child(' + (index + 1) + ')').css('display', 'none'); | ||
} | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters