Skip to content

Commit b5d29fb

Browse files
committed
Keep both unlocalized and unlocalized-all side by side
1 parent 6b677ba commit b5d29fb

File tree

9 files changed

+99
-44
lines changed

9 files changed

+99
-44
lines changed

README.md

-2
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,6 @@ The Transvision team uses Git and GitHub for both development and issue tracking
3333
* Composer (Dependency Manager for PHP, https://getcomposer.org/)
3434
* mercurial, git, svn to check out data sources (only for a Full installation for production)
3535
* php5-xsl and GraphViz packages for generating the documentation with [phpDocumentor][]
36-
* libpspell-dev, php5-pspell and aspell-en packages for running spell checking in English on [Unlocalized words view][]
3736
* Apache with mod_rewrite activated
3837
* [npm][] and eslint for JavaScript files (optional)
3938
```
@@ -77,5 +76,4 @@ MPL 2
7776
[Transvision Project]: https://github.com/mozfr/transvision
7877
[phpDocumentor]: http://phpdoc.org/
7978
[npm]: https://www.npmjs.com
80-
[Unlocalized words view]: https://transvision.mozfr.org/unlocalized
8179
[Coding Standards]:https://github.com/mozfr/transvision/wiki/Code-conventions

app/controllers/unlocalized_words.php

+11-2
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,23 @@
44
// Get requested repo and locale.
55
require_once INC . 'l10n-init.php';
66

7-
include MODELS . 'unlocalized_words.php';
8-
97
switch ($page) {
8+
case 'unlocalized_all':
9+
$all_locales = array_diff($all_locales, ['en-US', 'en-ZA', 'en-GB', 'ja-JP-mac', 'ltg']);
10+
include MODELS . 'unlocalized_words.php';
11+
include VIEWS . 'unlocalized_words_all.php';
12+
break;
1013
case 'unlocalized_json':
14+
$all_locales = [];
15+
$all_locales[] = $locale;
16+
include MODELS . 'unlocalized_words.php';
1117
$json = $unlocalized_words;
1218
include VIEWS . 'json.php';
1319
break;
1420
default:
21+
$all_locales = [];
22+
$all_locales[] = $locale;
23+
include MODELS . 'unlocalized_words.php';
1524
include VIEWS . 'unlocalized_words.php';
1625
break;
1726
}

app/inc/dispatcher.php

+7
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,13 @@
123123
$page_title = 'Commonly Unlocalized Words';
124124
$page_descr = 'Display the list of the most common untranslated words. Click on the table headers to sort results.';
125125
$js_files[] = '/js/sorttable.js';
126+
break;
127+
case 'unlocalized-all':
128+
$experimental = true;
129+
$controller = 'unlocalized_words';
130+
$page_title = 'Commonly Unlocalized Words (Global view)';
131+
$page_descr = 'Display the list of the most common untranslated words for all locales. Click on the table headers to sort results.';
132+
$js_files[] = '/js/sorttable.js';
126133
$js_files[] = '/js/hide_table_rows.js';
127134
break;
128135
case 'unlocalized-json':

app/inc/urls.php

+1
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
'gaia' => 'gaia',
1515
'unchanged' => 'unchangedstrings',
1616
'unlocalized' => 'unlocalized',
17+
'unlocalized-all' => 'unlocalized_all',
1718
'unlocalized-json' => 'unlocalized_json',
1819
'variables' => 'checkvariables',
1920
'3locales' => '3locales',

app/views/templates/base.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@
4747
{$li_link('checkvariables', 'Check what variable differences there are from English', 'Check Variables')}
4848
{$li_link('consistency', 'Translation Consistency', 'Translation Consistency')}
4949
{$li_link('unchangedstrings', 'Display all strings identical to English', 'Unchanged Strings')}
50-
{$li_link('unlocalized', 'Display common words remaining in English', 'Unlocalized Words')}
50+
{$li_link('unlocalized-all', 'Display common words remaining in English', 'Unlocalized Words')}
5151
</ul>
5252
<ul>
5353
{$li_link('channelcomp', 'Compare strings betwen channels', 'Channel Comparison')}

app/views/unlocalized_words.php

+24-34
Original file line numberDiff line numberDiff line change
@@ -6,43 +6,33 @@
66
<?php
77
// Include the common simple search form
88
include __DIR__ . '/simplesearchform.php';
9+
910
?>
10-
<p>Click on each checkbox below to show/hide the corresponding column.</p>
11-
<fieldset id="grpChkBox">
12-
<legend>Locales</legend>
13-
<?php foreach ($all_locales as $locale) : ?>
14-
<label><input type="checkbox" name="<?=$locale?>" /> <?=$locale?></label>
15-
<?php endforeach ?>
16-
</fieldset>
17-
<table class="collapsable results_table sortable" id="words">
11+
<table class='collapsable results_table sortable'>
1812
<thead>
19-
<tr class="column_headers">
20-
<th>Word</th>
21-
<?php foreach ($all_locales as $locale) : ?>
22-
<th class="<?=$locale?> hide"><?=$locale?></th>
23-
<?php endforeach ?>
24-
</tr>
25-
</thead>
26-
<tbody>
27-
<?php foreach ($unlocalized_words as $english_term => $locales) : ?>
28-
<tr><td><?=$english_term?></td><?php
29-
foreach ($all_locales as $locale) {
30-
$count = 0;
31-
if (in_array($locale, array_keys($locales))) {
32-
$count = $locales[$locale];
33-
}
13+
<tr class='column_headers'>
14+
<th>English</th>
15+
<th>Occurrences</th>
16+
</tr>
17+
</thead>
18+
<tbody>
3419

35-
$link = "/?recherche={$english_term}&repo={$repo}&sourcelocale={$locale}" .
36-
"&locale={$ref_locale}&search_type=strings&whole_word=whole_word";
20+
<?php foreach ($unlocalized_words as $english_term => $locales) :
21+
$string_count = $locales[$all_locales[0]];
22+
$link = "/?recherche={$english_term}&repo={$repo}&sourcelocale={$locale}" .
23+
"&locale={$ref_locale}&search_type=strings&whole_word=whole_word";
3724

38-
if ($count > 0) {
39-
print "<td><a href='{$link}'>{$count}</a></td>";
40-
} else {
41-
print "<td></td>";
42-
}
43-
}
44-
?></tr>
45-
<?php endforeach ?>
25+
$link_title = $string_count == 1
26+
? 'Search for this occurrence'
27+
: 'Search for these occurrences';
28+
?>
29+
<tr>
30+
<td><a href='<?=$link?>' title='<?=$link_title?>'><?=$english_term?></a></td>
31+
<td><?=$string_count?></td>
32+
</tr>
33+
<?php endforeach; ?>
4634
</tbody>
4735
</table>
48-
<?php unset($unlocalized_words);?>
36+
37+
<?php
38+
unset($unlocalized_words);

app/views/unlocalized_words_all.php

+48
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
<?php
2+
namespace Transvision;
3+
4+
?>
5+
<p>You might be interested in high values to validate your translation choices and in low values to check for potential mistakes.</p>
6+
<?php
7+
// Include the common simple search form
8+
include __DIR__ . '/simplesearchform.php';
9+
?>
10+
<p>Click on each checkbox below to show/hide the corresponding column.</p>
11+
<fieldset id="grpChkBox">
12+
<legend>Locales</legend>
13+
<?php foreach ($all_locales as $locale) : ?>
14+
<label><input type="checkbox" name="<?=$locale?>" /> <?=$locale?></label>
15+
<?php endforeach ?>
16+
</fieldset>
17+
<table class="collapsable results_table sortable" id="words">
18+
<thead>
19+
<tr class="column_headers">
20+
<th>Word</th>
21+
<?php foreach ($all_locales as $locale) : ?>
22+
<th class="<?=$locale?> hide"><?=$locale?></th>
23+
<?php endforeach ?>
24+
</tr>
25+
</thead>
26+
<tbody>
27+
<?php foreach ($unlocalized_words as $english_term => $locales) : ?>
28+
<tr><td><?=$english_term?></td><?php
29+
foreach ($all_locales as $locale) {
30+
$count = 0;
31+
if (in_array($locale, array_keys($locales))) {
32+
$count = $locales[$locale];
33+
}
34+
35+
$link = "/?recherche={$english_term}&repo={$repo}&sourcelocale={$locale}" .
36+
"&locale={$ref_locale}&search_type=strings&whole_word=whole_word";
37+
38+
if ($count > 0) {
39+
print "<td><a href='{$link}'>{$count}</a></td>";
40+
} else {
41+
print "<td></td>";
42+
}
43+
}
44+
?></tr>
45+
<?php endforeach ?>
46+
</tbody>
47+
</table>
48+
<?php unset($unlocalized_words);?>

tests/functional/pages.php

+2-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,8 @@
1515
['stats/', 200, 'Repository status overview', 'Status estimate'],
1616
['string/?entity=browser/chrome/browser/places/places.properties:bookmarkResultLabel&repo=central', 200, 'supportedLocales', 'Marque-page'],
1717
['unchanged/', 200, 'Display a list of strings identical', 'Locale'],
18-
['unlocalized/', 200, 'Display the list of the most common untranslated words', 'Word'],
18+
['unlocalized/', 200, 'Display the list of the most common untranslated words', 'Occurrences'],
19+
['unlocalized-all/', 200, 'Click on each checkbox below', 'Word'],
1920
['variables/', 200, 'Show potential errors related to', 'no errors found'],
2021
['foo/', 400, '404: Page Not Found', 'You can use the menu at the top'],
2122
['123/', 400, '404: Page Not Found', 'You can use the menu at the top'],

web/style/transvision.css

+5-4
Original file line numberDiff line numberDiff line change
@@ -1166,21 +1166,22 @@ fieldset {
11661166
}
11671167

11681168
/* Unlocalized words view */
1169-
#unlocalized fieldset#grpChkBox {
1169+
#unlocalized_all fieldset#grpChkBox {
11701170
border: 1px solid #000;
11711171
background-color: rgba(255, 255, 255, 0.5);
11721172
}
11731173

1174+
#unlocalized_all #pagecontent p,
11741175
#unlocalized #pagecontent p {
11751176
text-align: center;
11761177
}
11771178

1178-
#unlocalized label {
1179+
#unlocalized_all label {
11791180
display: inline-block;
11801181
width: 5em;
11811182
}
11821183

1183-
#unlocalized #words th.hide,
1184-
#unlocalized #words tr :nth-child(1) ~ td {
1184+
#unlocalized_all #words th.hide,
1185+
#unlocalized_all #words tr :nth-child(1) ~ td {
11851186
display: none;
11861187
}

0 commit comments

Comments
 (0)