Permalink
Browse files

Keep both unlocalized and unlocalized-all side by side

  • Loading branch information...
TheoChevalier committed Apr 13, 2016
1 parent 6b677ba commit b5d29fb8d99336acb793bc665b848035c5cac1cf
View
@@ -33,7 +33,6 @@ The Transvision team uses Git and GitHub for both development and issue tracking
* Composer (Dependency Manager for PHP, https://getcomposer.org/)
* mercurial, git, svn to check out data sources (only for a Full installation for production)
* php5-xsl and GraphViz packages for generating the documentation with [phpDocumentor][]
-* libpspell-dev, php5-pspell and aspell-en packages for running spell checking in English on [Unlocalized words view][]
* Apache with mod_rewrite activated
* [npm][] and eslint for JavaScript files (optional)
```
@@ -77,5 +76,4 @@ MPL 2
[Transvision Project]: https://github.com/mozfr/transvision
[phpDocumentor]: http://phpdoc.org/
[npm]: https://www.npmjs.com
-[Unlocalized words view]: https://transvision.mozfr.org/unlocalized
[Coding Standards]:https://github.com/mozfr/transvision/wiki/Code-conventions
@@ -4,14 +4,23 @@
// Get requested repo and locale.
require_once INC . 'l10n-init.php';
-include MODELS . 'unlocalized_words.php';
-
switch ($page) {
+ case 'unlocalized_all':
+ $all_locales = array_diff($all_locales, ['en-US', 'en-ZA', 'en-GB', 'ja-JP-mac', 'ltg']);
+ include MODELS . 'unlocalized_words.php';
+ include VIEWS . 'unlocalized_words_all.php';
+ break;
case 'unlocalized_json':
+ $all_locales = [];
+ $all_locales[] = $locale;
+ include MODELS . 'unlocalized_words.php';
$json = $unlocalized_words;
include VIEWS . 'json.php';
break;
default:
+ $all_locales = [];
+ $all_locales[] = $locale;
+ include MODELS . 'unlocalized_words.php';
include VIEWS . 'unlocalized_words.php';
break;
}
View
@@ -123,6 +123,13 @@
$page_title = 'Commonly Unlocalized Words';
$page_descr = 'Display the list of the most common untranslated words. Click on the table headers to sort results.';
$js_files[] = '/js/sorttable.js';
+ break;
+ case 'unlocalized-all':
+ $experimental = true;
+ $controller = 'unlocalized_words';
+ $page_title = 'Commonly Unlocalized Words (Global view)';
+ $page_descr = 'Display the list of the most common untranslated words for all locales. Click on the table headers to sort results.';
+ $js_files[] = '/js/sorttable.js';
$js_files[] = '/js/hide_table_rows.js';
break;
case 'unlocalized-json':
View
@@ -14,6 +14,7 @@
'gaia' => 'gaia',
'unchanged' => 'unchangedstrings',
'unlocalized' => 'unlocalized',
+ 'unlocalized-all' => 'unlocalized_all',
'unlocalized-json' => 'unlocalized_json',
'variables' => 'checkvariables',
'3locales' => '3locales',
@@ -47,7 +47,7 @@
{$li_link('checkvariables', 'Check what variable differences there are from English', 'Check Variables')}
{$li_link('consistency', 'Translation Consistency', 'Translation Consistency')}
{$li_link('unchangedstrings', 'Display all strings identical to English', 'Unchanged Strings')}
- {$li_link('unlocalized', 'Display common words remaining in English', 'Unlocalized Words')}
+ {$li_link('unlocalized-all', 'Display common words remaining in English', 'Unlocalized Words')}
</ul>
<ul>
{$li_link('channelcomp', 'Compare strings betwen channels', 'Channel Comparison')}
@@ -6,43 +6,33 @@
<?php
// Include the common simple search form
include __DIR__ . '/simplesearchform.php';
+
?>
-<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">
+<table class='collapsable results_table sortable'>
<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];
- }
+ <tr class='column_headers'>
+ <th>English</th>
+ <th>Occurrences</th>
+ </tr>
+ </thead>
+ <tbody>
- $link = "/?recherche={$english_term}&repo={$repo}&sourcelocale={$locale}" .
- "&locale={$ref_locale}&search_type=strings&whole_word=whole_word";
+<?php foreach ($unlocalized_words as $english_term => $locales) :
+ $string_count = $locales[$all_locales[0]];
+ $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>";
- }
- }
- ?></tr>
-<?php endforeach ?>
+ $link_title = $string_count == 1
+ ? 'Search for this occurrence'
+ : 'Search for these occurrences';
+?>
+ <tr>
+ <td><a href='<?=$link?>' title='<?=$link_title?>'><?=$english_term?></a></td>
+ <td><?=$string_count?></td>
+ </tr>
+<?php endforeach; ?>
</tbody>
</table>
-<?php unset($unlocalized_words);?>
+
+<?php
+unset($unlocalized_words);
@@ -0,0 +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';
+?>
+<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>";
+ }
+ }
+ ?></tr>
+<?php endforeach ?>
+ </tbody>
+</table>
+<?php unset($unlocalized_words);?>
@@ -15,7 +15,8 @@
['stats/', 200, 'Repository status overview', 'Status estimate'],
['string/?entity=browser/chrome/browser/places/places.properties:bookmarkResultLabel&repo=central', 200, 'supportedLocales', 'Marque-page'],
['unchanged/', 200, 'Display a list of strings identical', 'Locale'],
- ['unlocalized/', 200, 'Display the list of the most common untranslated words', 'Word'],
+ ['unlocalized/', 200, 'Display the list of the most common untranslated words', 'Occurrences'],
+ ['unlocalized-all/', 200, 'Click on each checkbox below', 'Word'],
['variables/', 200, 'Show potential errors related to', 'no errors found'],
['foo/', 400, '404: Page Not Found', 'You can use the menu at the top'],
['123/', 400, '404: Page Not Found', 'You can use the menu at the top'],
@@ -1166,21 +1166,22 @@ fieldset {
}
/* Unlocalized words view */
-#unlocalized fieldset#grpChkBox {
+#unlocalized_all fieldset#grpChkBox {
border: 1px solid #000;
background-color: rgba(255, 255, 255, 0.5);
}
+#unlocalized_all #pagecontent p,
#unlocalized #pagecontent p {
text-align: center;
}
-#unlocalized label {
+#unlocalized_all label {
display: inline-block;
width: 5em;
}
-#unlocalized #words th.hide,
-#unlocalized #words tr :nth-child(1) ~ td {
+#unlocalized_all #words th.hide,
+#unlocalized_all #words tr :nth-child(1) ~ td {
display: none;
}

0 comments on commit b5d29fb

Please sign in to comment.