Permalink
Browse files

Remove consistency section in Gaia view

  • Loading branch information...
flodolo committed Mar 5, 2016
1 parent 53cea4d commit a7937db1ed22dc987229f1b76220fb76ade1e770
Showing with 10 additions and 52 deletions.
  1. +2 −2 app/models/consistency.php
  2. +7 −49 app/views/gaia.php
  3. +1 −1 web/style/transvision.css
@@ -19,8 +19,8 @@
$strings_number = 0;
$source_strings = Utils::getRepoStrings($reference_locale, $repo);
// Ignore empty strings in translations
$target_strings = array_filter(Utils::getRepoStrings($locale, $repo));
// Remove blanks strings. Using 'strlen' to avoid filtering out strings set to 0
$target_strings = array_filter(Utils::getRepoStrings($locale, $repo), 'strlen');
if (! empty($source_strings)) {
// Remove known problematic strings
View
@@ -65,11 +65,10 @@
}
$sections = [
'translation_status' => 'Translation Status',
'diverging_strings' => 'Diverging Strings',
'translation_consistency' => 'Translation Consistency',
'changed_english' => 'String Changes in English',
'new_strings' => 'New Strings',
'translation_status' => 'Translation Status',
'diverging_strings' => 'Diverging Strings',
'changed_english' => 'String Changes in English',
'new_strings' => 'New Strings',
];
?>
@@ -134,6 +133,8 @@
foreach ($sections as $anchor_name => $section_title) {
print " <li><a href='#{$anchor_name}'>{$section_title}</a></li>\n";
}
// Adding a manual link for consistency (to the specific view)
print " <li>Translation consistency for <a href='/consistency/?locale={$locale}&repo={$repo1}'>{$repos_nice_names[$repo1]}</a> or <a href='/consistency/?locale={$locale}&repo={$repo2}'>{$repos_nice_names[$repo2]}</a></li>\n";
print "</ul>\n";
print $anchor_title('translation_status');
@@ -157,7 +158,7 @@
$temp[] = $repo[$k];
}
// Remove blanks
// Remove blanks strings. Using 'strlen' to avoid filtering out strings set to 0
$temp = array_filter($temp, 'strlen');
// Remove duplicates
@@ -209,49 +210,6 @@
'diverging'
);
$english_repo = "{$repo1}-en-US";
$l10n_repo = $repo1;
$duplicated_strings_english = Consistency::findDuplicates($strings[$english_repo]);
$duplicated_strings_translation = Consistency::findDuplicates($strings[$l10n_repo]);
// Filter English duplicates before comparing them with the localization
$duplicated_strings_english = Consistency::filterStrings($duplicated_strings_english, $l10n_repo);
// Get the strings duplicated in English but not in the localization
$missing_duplicates = array_diff_key($duplicated_strings_english, $duplicated_strings_translation);
$inconsistent_translations = [];
foreach ($duplicated_strings_english as $key => $value) {
if (in_array($value, $missing_duplicates)) {
// Store inconsistency only if there's a translation available
if (isset($strings[$l10n_repo][$key])) {
$inconsistent_translations[] = [
'key' => $key,
'en-US' => $strings[$english_repo][$key],
'l10n' => $strings[$repo1][$key],
];
}
}
}
if (count($inconsistent_translations) > 0) {
$inconsistent_results = "\n<table><tr><th>Label</th><th>English</th><th>Translation</th></tr>";
foreach ($inconsistent_translations as $inconsistent_translation) {
$inconsistent_results .= "<tr>
<td>" . ShowResults::formatEntity($inconsistent_translation['key']) . "</td>
<td>" . Utils::secureText($inconsistent_translation['en-US']) . "</td>
<td>" . Utils::secureText($inconsistent_translation['l10n']) . "</td>
</tr>\n";
}
$inconsistent_results .= "</table>\n";
} else {
$inconsistent_results = "<p>No inconsistent translations found.</p>";
}
print $anchor_title('translation_consistency');
print "<p class='subtitle'>Analysis of translation consistency in {$repos_nice_names[$repo1]}.</p>";
print $inconsistent_results;
// Changes in en-US
$englishchanges = [$repo1, $repo2];
@@ -762,7 +762,7 @@ fieldset {
#gaia_views_list {
margin: 10px auto;
width: 200px;
width: 350px;
}
#gaia h3 {

0 comments on commit a7937db

Please sign in to comment.