Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #446 from flodolo/checkvar
Improve check variables controls, switch to MVC
- Loading branch information
Showing
7 changed files
with
226 additions
and
173 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 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,8 @@ | ||
<?php | ||
namespace Transvision; | ||
|
||
// Get requested repo and locale | ||
require_once INC . 'l10n-init.php'; | ||
|
||
include MODELS . 'check_variables.php'; | ||
include VIEWS . 'check_variables.php'; |
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,48 @@ | ||
<?php | ||
namespace Transvision; | ||
|
||
$source = Utils::getRepoStrings(Project::getReferenceLocale($repo), $repo); | ||
$target = Utils::getRepoStrings($locale, $repo); | ||
|
||
// Set up channel selector, ignore mozilla.org | ||
$channels = Project::getSupportedRepositories(); | ||
unset($channels['mozilla_org']); | ||
$channel_selector = Utils::getHtmlSelectOptions($channels, $repo, true); | ||
|
||
// Build the target locale switcher | ||
$target_locales_list = Utils::getHtmlSelectOptions( | ||
Project::getRepositoryLocales($repo), | ||
$locale | ||
); | ||
|
||
$source = array_map(['Transvision\AnalyseStrings', 'cleanUpEntities'], $source); | ||
$target = array_map(['Transvision\AnalyseStrings', 'cleanUpEntities'], $target); | ||
|
||
// We need to ignore some strings because of false positives | ||
$ignored_strings = [ | ||
'mail/chrome/messenger/aboutRights.dtd:rights.webservices-term4', | ||
'suite/chrome/branding/aboutRights.dtd:rights.webservices-term4', | ||
'toolkit/chrome/global/aboutRights.dtd:rights.webservices-term5', | ||
]; | ||
|
||
$var_errors = AnalyseStrings::differences($source, $target, $repo, $ignored_strings); | ||
$error_count = count($var_errors); | ||
|
||
// Add component filter | ||
if (in_array($repo, $desktop_repos)) { | ||
// Build logic to filter components | ||
$javascript_include = ['component_filter.js']; | ||
$components = Project::getComponents(array_flip($var_errors)); | ||
$filter_block = ''; | ||
foreach ($components as $value) { | ||
$filter_block .= " <a href='#{$value}' id='{$value}' class='filter'>{$value}</a>"; | ||
} | ||
} | ||
|
||
// RTL support | ||
$direction1 = RTLSupport::getDirection($source_locale); | ||
$direction2 = RTLSupport::getDirection($locale); | ||
|
||
$bugzilla_base_link = 'https://bugzilla.mozilla.org/enter_bug.cgi?format=__default__&component=' . | ||
Bugzilla::getURLencodedBugzillaLocale($locale, 'products') . | ||
'&product=Mozilla%20Localizations&status_whiteboard=%5Btransvision-feedback%5D'; |
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,76 @@ | ||
<?php | ||
namespace Transvision; | ||
|
||
// Include the common simple search form | ||
include __DIR__ . '/simplesearchform.php'; | ||
|
||
if ($error_count > 0) { | ||
$content = "<h2>{$error_count} " . | ||
($error_count == 1 ? 'result' : 'results') . | ||
" found</h2>\n"; | ||
|
||
if (isset($filter_block)) { | ||
$content .= "<div id='filters'>" . | ||
" <h4>Filter by folder:</h4>\n" . | ||
" <a href='#showall' id='showall' class='filter'>Show all results</a>\n" . | ||
$filter_block . | ||
"</div>\n"; | ||
} | ||
|
||
$content .= "<table class='collapsable'>\n" . | ||
" <tr>\n" . | ||
" <th>Entity</th>\n" . | ||
" <th>{$source_locale}</th>\n" . | ||
" <th>{$locale}</th>\n" . | ||
" </tr>\n"; | ||
|
||
foreach ($var_errors as $string_id) { | ||
// Link to entity | ||
$string_id_link = "?sourcelocale={$source_locale}" . | ||
"&locale={$locale}" . | ||
"&repo={$repo}" . | ||
"&search_type=entities&recherche={$string_id}"; | ||
$bug_summary = rawurlencode("Translation update proposed for {$string_id}"); | ||
$bug_message = rawurlencode( | ||
html_entity_decode( | ||
"The string:\n{$source[$string_id]}\n\n" . | ||
"Is translated as:\n{$target[$string_id]}\n\n" . | ||
"And should be:\n\n\n\n" . | ||
"Feedback via Transvision:\n" . | ||
"http://transvision.mozfr.org/{$string_id_link}" | ||
) | ||
); | ||
$bugzilla_link = "{$bugzilla_base_link}&short_desc={$bug_summary}&comment={$bug_message}"; | ||
|
||
$path_locale1 = VersionControl::hgPath($source_locale, $repo, $string_id); | ||
$path_locale2 = VersionControl::hgPath($locale, $repo, $string_id); | ||
|
||
$component = explode('/', $string_id)[0]; | ||
$content .= "<tr class='{$component}'> | ||
<td> | ||
<span class='celltitle'>Entity</span> | ||
<a class='link_to_entity' href=\"/{$string_id_link}\">" . ShowResults::formatEntity($string_id) . "</a> | ||
</td> | ||
<td dir='{$direction1}'> | ||
<span class='celltitle'>{$source_locale}</span> | ||
<div class='string'>" . Utils::secureText($source[$string_id]) . "</div> | ||
<div class='result_meta_link'> | ||
<a class='source_link' href='{$path_locale1}'><em><source></em></a> | ||
</div> | ||
</td> | ||
<td dir='{$direction2}'> | ||
<span class='celltitle'>$locale</span> | ||
<div class='string'>" . Utils::secureText($target[$string_id]) . "</div> | ||
<div class='result_meta_link'> | ||
<a class='source_link' href='{$path_locale2}'><em><source></em></a> | ||
<a class='bug_link' target='_blank' href='{$bugzilla_link}'><report a bug></a> | ||
</div> | ||
</td> | ||
</tr>\n"; | ||
} | ||
$content .= "</table>\n"; | ||
} else { | ||
$content = "<h2>Congratulations, no errors found.</h2>"; | ||
} | ||
|
||
print $content; |
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.