<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[3003] sites/trunk: Translate: Add a view to check translation consistency.</title>
</head>
<body>
<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; }
#msg dl a { font-weight: bold}
#msg dl a:link { color:#fc3; }
#msg dl a:active { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta" style="font-size: 105%">
<dt style="float: left; width: 6em; font-weight: bold">Revision</dt> <dd><a style="font-weight: bold" href="http://meta.trac.wordpress.org/changeset/3003">3003</a><script type="application/ld+json">{"@context":"http://schema.org","@type":"EmailMessage","description":"Review this Commit","action":{"@type":"ViewAction","url":"http://meta.trac.wordpress.org/changeset/3003","name":"Review Commit"}}</script></dd>
<dt style="float: left; width: 6em; font-weight: bold">Author</dt> <dd>ocean90</dd>
<dt style="float: left; width: 6em; font-weight: bold">Date</dt> <dd>2016-04-25 15:59:44 +0000 (Mon, 25 Apr 2016)</dd>
</dl>
<pre style='padding-left: 1em; margin: 2em 0; border-left: 2px solid #ccc; line-height: 1.25; font-size: 105%; font-family: sans-serif'>Translate: Add a view to check translation consistency.
Available at https://translate.wordpress.org/consistency.
See <a href="http://meta.trac.wordpress.org/ticket/1682">#1682</a>.</pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#sitestrunktranslatewordpressorgpublic_htmlgptemplatesnewstylecss">sites/trunk/translate.wordpress.org/public_html/gp-templates-new/style.css</a></li>
<li><a href="#sitestrunkwordpressorgpublic_htmlwpcontentpluginswporggproutesincclasspluginphp">sites/trunk/wordpress.org/public_html/wp-content/plugins/wporg-gp-routes/inc/class-plugin.php</a></li>
</ul>
<h3>Added Paths</h3>
<ul>
<li><a href="#sitestrunktranslatewordpressorgpublic_htmlgptemplatesnewconsistencyphp">sites/trunk/translate.wordpress.org/public_html/gp-templates-new/consistency.php</a></li>
<li><a href="#sitestrunkwordpressorgpublic_htmlwpcontentpluginswporggproutesincroutesclassconsistencyphp">sites/trunk/wordpress.org/public_html/wp-content/plugins/wporg-gp-routes/inc/routes/class-consistency.php</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="sitestrunktranslatewordpressorgpublic_htmlgptemplatesnewconsistencyphp"></a>
<div class="addfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Added: sites/trunk/translate.wordpress.org/public_html/gp-templates-new/consistency.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- sites/trunk/translate.wordpress.org/public_html/gp-templates-new/consistency.php (rev 0)
+++ sites/trunk/translate.wordpress.org/public_html/gp-templates-new/consistency.php 2016-04-25 15:59:44 UTC (rev 3003)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -0,0 +1,144 @@
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+<?php
+gp_title( 'Translation Consistency < GlotPress' );
+$breadcrumb = array();
+$breadcrumb[] = gp_link_get( '/', 'Locales' );
+$breadcrumb[] = 'Translation Consistency';
+gp_breadcrumb( $breadcrumb );
+gp_tmpl_header();
+?>
+
+<p>Analyze translation consistency across projects.</p>
+
+
+<form action="" method="get" class="consistency-form">
+ <p>
+ <input type="text" name="search" required value="<?php echo esc_attr( $search ); ?>" class="consistency-form-search" placeholder="Enter original to search for…">
+ <?php
+ $options = [];
+ $options[''] = 'Select a locale';
+ $options = array_merge( $options, $sets );
+ echo gp_select( 'set', $options, $set, [ 'class' => 'consistency-form-locale', 'required' => 'required' ] );
+ ?>
+ <button type="submit" class="consistency-form-submit">Search</button>
+ </p>
+
+ <p class="consistency-form-filters">
+ <label>
+ <input type="checkbox" name="search_case_senstive" value="1"<?php checked( $search_case_senstive ); ?>>
+ Case Sensitive
+ </label>
+ <label>
+ <input type="checkbox" name="search_fuzzy" value="1"<?php checked( $search_fuzzy ); ?>>
+ Fuzzy Search (<em>term*</em>)
+ </label>
+ </p>
+
+</form>
+
+<?php
+if ( $performed_search && ! $results ) {
+ echo '<p class="notice">No results were found.</p>';
+
+} elseif ( $performed_search && $results ) {
+ if ( ! $search_fuzzy && $translations_unique ) {
+ $translations_unique_count = count( $translations_unique );
+ if ( 1 === $translations_unique_count ) {
+ echo '<p class="notice">All originals have the same translations</p>';
+ } else {
+ echo '<div class="notice wporg-notice-warning"><p>There are ' . $translations_unique_count . ' different translations. <a id="toggle-translations-unique" href="#show">View</a></p>';
+ echo '<ul class="translations-unique hidden">';
+ foreach ( $translations_unique as $translation ) {
+ printf(
+ '<li data-id="%s">%s</li>',
+ md5( $translation ),
+ str_replace( ' ', '<span class="space"> </span>', esc_translation( $translation ) )
+ );
+ }
+ echo '</ul>';
+ echo '</div>';
+ }
+ }
+
+ ?>
+ <table class="consistency-table">
+ <thead>
+ <th>Original</th>
+ <th>Translation</th>
+ </thead>
+ <tbody>
+ <?php
+ foreach ( $results as $result ) {
+ $project_name = $result->project_name;
+ $parent_project_id = $result->project_parent_id;
+ while ( $parent_project_id ) {
+ $parent_project = GP::$project->get( $parent_project_id );
+ $parent_project_id = $parent_project->parent_project_id;
+ $project_name = "{$parent_project->name} - {$project_name}";
+ }
+
+ $original_context = '';
+ if ( $result->original_context ) {
+ $original_context = sprintf(
+ ' <span class="context">%s</span>',
+ esc_translation( $result->original_context )
+ );
+ }
+
+ $search_link = '';
+ if ( $search_fuzzy ) {
+ $search_link = sprintf(
+ ' | <a href="%s">Search</a>',
+ esc_url( add_query_arg( [
+ 'search' => urlencode( $result->original_singular ),
+ 'search_fuzzy' => 0,
+ 'search_case_senstive' => 1,
+ ] ) )
+ );
+ }
+
+ printf(
+ '<tr><td>%s</td><td>%s</td></tr>',
+ sprintf(
+ '<div class="string">%s%s</div>
+ <div class="meta">Project: <a href="/projects/%s">%s</a>%s</div>',
+ esc_translation( $result->original_singular ),
+ $original_context,
+ $result->project_path,
+ $project_name,
+ $search_link
+ ),
+ sprintf(
+ '<div class="string%s">%s</div>
+ <div class="meta">
+ <a href="/projects/%s/%s?filters[status]=either&filters[original_id]=%d&filters[translation_id]=%d">Source</a> |
+ Added: %s
+ </div>',
+ $locale_is_rtl ? ' rtl' : '',
+ esc_translation( $result->translation ),
+ $result->project_path,
+ $set,
+ $result->original_id,
+ $result->translation_id,
+ $result->translation_added
+ ),
+ esc_translation( $result->translation )
+ );
+ }
+ ?>
+ </tbody>
+ </table>
+ <?php
+}
+?>
+
+<script>
+ jQuery( document ).ready( function( $ ) {
+ $( '#toggle-translations-unique' ).on( 'click', function( event ) {
+ event.preventDefault();
+ $( '.translations-unique' ).toggleClass( 'hidden' );
+ });
+
+ });
+</script>
+
+<?php gp_tmpl_footer();
</ins></span></pre></div>
<a id="sitestrunktranslatewordpressorgpublic_htmlgptemplatesnewstylecss"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: sites/trunk/translate.wordpress.org/public_html/gp-templates-new/style.css</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- sites/trunk/translate.wordpress.org/public_html/gp-templates-new/style.css 2016-04-25 15:38:34 UTC (rev 3002)
+++ sites/trunk/translate.wordpress.org/public_html/gp-templates-new/style.css 2016-04-25 15:59:44 UTC (rev 3003)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -200,6 +200,8 @@
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> .editor .textareas textarea {
</span><span class="cx" style="display: block; padding: 0 10px"> width: 100%;
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ -webkit-box-sizing: border-box;
+ -moz-box-sizing: border-box;
</ins><span class="cx" style="display: block; padding: 0 10px"> box-sizing: border-box;
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -207,6 +209,8 @@
</span><span class="cx" style="display: block; padding: 0 10px"> margin: 0;
</span><span class="cx" style="display: block; padding: 0 10px"> padding-left: 2em;
</span><span class="cx" style="display: block; padding: 0 10px"> width: 40%;
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ -webkit-box-sizing: border-box;
+ -moz-box-sizing: border-box;
</ins><span class="cx" style="display: block; padding: 0 10px"> box-sizing: border-box;
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -265,6 +269,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> display: inline-block;
</span><span class="cx" style="display: block; padding: 0 10px"> position: relative;
</span><span class="cx" style="display: block; padding: 0 10px"> -webkit-box-sizing: border-box;
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ -moz-box-sizing: border-box;
</ins><span class="cx" style="display: block; padding: 0 10px"> box-sizing: border-box;
</span><span class="cx" style="display: block; padding: 0 10px"> margin: 30px 0;
</span><span class="cx" style="display: block; padding: 0 10px"> padding: 0 20px;
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -370,6 +375,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> box-shadow: 0 1px 1px -1px rgba(0,0,0,0.1);
</span><span class="cx" style="display: block; padding: 0 10px"> background: #fff;
</span><span class="cx" style="display: block; padding: 0 10px"> -webkit-box-sizing: border-box;
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ -moz-box-sizing: border-box;
</ins><span class="cx" style="display: block; padding: 0 10px"> box-sizing: border-box;
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -496,6 +502,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> box-shadow: 0 1px 1px -1px rgba(0,0,0,0.1);
</span><span class="cx" style="display: block; padding: 0 10px"> background: #fff;
</span><span class="cx" style="display: block; padding: 0 10px"> -webkit-box-sizing: border-box;
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ -moz-box-sizing: border-box;
</ins><span class="cx" style="display: block; padding: 0 10px"> box-sizing: border-box;
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -512,6 +519,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> box-shadow: 0 1px 1px -1px rgba(0,0,0,0.1);
</span><span class="cx" style="display: block; padding: 0 10px"> background: #fff;
</span><span class="cx" style="display: block; padding: 0 10px"> -webkit-box-sizing: border-box;
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ -moz-box-sizing: border-box;
</ins><span class="cx" style="display: block; padding: 0 10px"> box-sizing: border-box;
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -600,6 +608,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> padding: 0 20px;
</span><span class="cx" style="display: block; padding: 0 10px"> text-align: center;
</span><span class="cx" style="display: block; padding: 0 10px"> -webkit-box-sizing: border-box;
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ -moz-box-sizing: border-box;
</ins><span class="cx" style="display: block; padding: 0 10px"> box-sizing: border-box;
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -651,6 +660,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> box-shadow: 0 1px 1px -1px rgba(0,0,0,0.1);
</span><span class="cx" style="display: block; padding: 0 10px"> background: #fff;
</span><span class="cx" style="display: block; padding: 0 10px"> -webkit-box-sizing: border-box;
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ -moz-box-sizing: border-box;
</ins><span class="cx" style="display: block; padding: 0 10px"> box-sizing: border-box;
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -724,6 +734,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> top: 50%;
</span><span class="cx" style="display: block; padding: 0 10px"> right: 15px;
</span><span class="cx" style="display: block; padding: 0 10px"> -webkit-transform: translateY(-50%);
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ -ms-transform: translateY(-50%);
</ins><span class="cx" style="display: block; padding: 0 10px"> transform: translateY(-50%);
</span><span class="cx" style="display: block; padding: 0 10px"> font-size: 20px;
</span><span class="cx" style="display: block; padding: 0 10px"> font-weight: 600;
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -803,6 +814,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> font: 20px/1 "dashicons";
</span><span class="cx" style="display: block; padding: 0 10px"> border-left: 1px solid #eee;
</span><span class="cx" style="display: block; padding: 0 10px"> padding: 5px 0 5px 12px;
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ -webkit-box-shadow: inset 1px 0 0 #fff;
</ins><span class="cx" style="display: block; padding: 0 10px"> box-shadow: inset 1px 0 0 #fff;
</span><span class="cx" style="display: block; padding: 0 10px"> -webkit-font-smoothing: antialiased;
</span><span class="cx" style="display: block; padding: 0 10px"> -moz-osx-font-smoothing: grayscale;
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -993,6 +1005,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> text-align: left;
</span><span class="cx" style="display: block; padding: 0 10px"> padding: 10px;
</span><span class="cx" style="display: block; padding: 0 10px"> background: #f9f9f9;
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ -webkit-box-shadow: inset 0 1px 0 rgba(0,0,0,.05);
</ins><span class="cx" style="display: block; padding: 0 10px"> box-shadow: inset 0 1px 0 rgba(0,0,0,.05);
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -1010,6 +1023,7 @@
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> .stats-table tbody td {
</span><span class="cx" style="display: block; padding: 0 10px"> padding: 10px 0;
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ -webkit-box-shadow: inset 0 1px 0 rgba(255,255,255,.15);
</ins><span class="cx" style="display: block; padding: 0 10px"> box-shadow: inset 0 1px 0 rgba(255,255,255,.15);
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -1147,6 +1161,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> width: 12px;
</span><span class="cx" style="display: block; padding: 0 10px"> height: 12px;
</span><span class="cx" style="display: block; padding: 0 10px"> border: 3px solid transparent;
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ -webkit-border-radius: 2px;
</ins><span class="cx" style="display: block; padding: 0 10px"> border-radius: 2px;
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -1175,7 +1190,11 @@
</span><span class="cx" style="display: block; padding: 0 10px"> -webkit-column-gap: 3%;
</span><span class="cx" style="display: block; padding: 0 10px"> -moz-column-count: 2;
</span><span class="cx" style="display: block; padding: 0 10px"> -moz-column-gap: 3%;
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ -webkit-column-count: 2;
+ -moz-column-count: 2;
</ins><span class="cx" style="display: block; padding: 0 10px"> column-count: 2;
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ -webkit-column-gap: 3%;
+ -moz-column-gap: 3%;
</ins><span class="cx" style="display: block; padding: 0 10px"> column-gap: 3%;
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -1188,6 +1207,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> border: 1px solid #ccc;
</span><span class="cx" style="display: block; padding: 0 10px"> background: #fff;
</span><span class="cx" style="display: block; padding: 0 10px"> -webkit-box-sizing: border-box;
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ -moz-box-sizing: border-box;
</ins><span class="cx" style="display: block; padding: 0 10px"> box-sizing: border-box;
</span><span class="cx" style="display: block; padding: 0 10px"> -webkit-column-break-inside: avoid;
</span><span class="cx" style="display: block; padding: 0 10px"> page-break-inside: avoid;
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -1409,3 +1429,119 @@
</span><span class="cx" style="display: block; padding: 0 10px"> clear: both;
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+
+.consistency-form {
+ margin: 30px 0;
+ text-align: center;
+}
+
+.consistency-form-search,
+.consistency-form-locale {
+ height: 30px;
+ padding: 3px;
+ color: #666;
+ -webkit-box-sizing: border-box;
+ -moz-box-sizing: border-box;
+ box-sizing: border-box;
+ font-size: 15px;
+ line-height: 1;
+ color: #333;
+ border: 0;
+ outline: 1px solid #ccc;
+ background-color: white;
+ outline-offset: 0;
+ margin: 0 3px;
+}
+
+.consistency-form-search {
+ width: 300px;
+}
+
+.consistency-form-locale {
+ width: 150px;
+}
+
+.consistency-form-submit {
+ font-weight: 200;
+ font-size: 15px;
+ line-height: 1;
+ height: 30px;
+ background-color: #21759b;
+ background-image: -webkit-gradient(linear, left top, left bottom, from(#2a95c5), to(#21759b));
+ background-image: -webkit-linear-gradient(top, #2a95c5, #21759b);
+ background-image: linear-gradient(to bottom, #2a95c5, #21759b);
+ border: 1px solid #21759b;
+ border-bottom-color: #1e6a8d;
+ -webkit-box-shadow: inset 0 1px 0 rgba(120, 200, 230, 0.5);
+ box-shadow: inset 0 1px 0 rgba(120, 200, 230, 0.5);
+ color: #fff;
+ text-shadow: 0 -1px 0 rgba(0, 0, 0, 0.3);
+ padding: 3px 10px;
+ cursor: pointer;
+}
+
+.consistency-form-submit:hover {
+ background-color: #278ab7;
+ background-image: -webkit-gradient(linear, left top, left bottom, from(#2e9fd2), to(#21759b));
+ background-image: -webkit-linear-gradient(top, #2e9fd2, #21759b);
+ background-image: linear-gradient(to bottom, #2e9fd2, #21759b);
+ border-color: #1b607f;
+ -webkit-box-shadow: inset 0 1px 0 rgba(120, 200, 230, 0.6);
+ box-shadow: inset 0 1px 0 rgba(120, 200, 230, 0.6);
+}
+
+.consistency-form-filters {
+ margin-top: 8px;
+}
+
+.consistency-form-filters label {
+ border-right: 1px solid #ccc;
+ padding: 0 15px 0 10px;
+ display: inline-block;
+}
+
+.consistency-form-filters label:last-child {
+ border: none;
+}
+
+.consistency-table {
+ width: 100%;
+ border-collapse: collapse;
+ table-layout: fixed;
+ margin: 30px 0;
+}
+
+.consistency-table th {
+ width: 50%;
+ font-weight: bold;
+ text-align: center;
+ padding: 10px 0;
+}
+
+.consistency-table tr {
+ border-bottom: 1px solid #eee;
+}
+
+.consistency-table td {
+ padding: 10px 5px 0 0;
+ vertical-align: top;
+}
+
+.consistency-table .string.rtl {
+ direction: rtl;
+}
+
+.consistency-table .meta {
+ margin-top: 10px;
+ opacity: .6;
+}
+
+.translations-unique {
+ margin: 5px;
+}
+
+.translations-unique .space {
+ background: #cbcdce;
+ white-space: pre;
+ opacity: .5;
+}
</ins></span></pre></div>
<a id="sitestrunkwordpressorgpublic_htmlwpcontentpluginswporggproutesincclasspluginphp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: sites/trunk/wordpress.org/public_html/wp-content/plugins/wporg-gp-routes/inc/class-plugin.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- sites/trunk/wordpress.org/public_html/wp-content/plugins/wporg-gp-routes/inc/class-plugin.php 2016-04-25 15:38:34 UTC (rev 3002)
+++ sites/trunk/wordpress.org/public_html/wp-content/plugins/wporg-gp-routes/inc/class-plugin.php 2016-04-25 15:59:44 UTC (rev 3003)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -106,7 +106,9 @@
</span><span class="cx" style="display: block; padding: 0 10px"> GP::$router->prepend( "/locale/$locale/$path", array( __NAMESPACE__ . '\Routes\Locale', 'get_locale_projects' ) );
</span><span class="cx" style="display: block; padding: 0 10px"> GP::$router->prepend( "/locale/$locale/$path/$path", array( __NAMESPACE__ . '\Routes\Locale', 'get_locale_projects' ) );
</span><span class="cx" style="display: block; padding: 0 10px"> GP::$router->prepend( "/locale/$locale/$path/$path/$path", array( __NAMESPACE__ . '\Routes\Locale', 'get_locale_project' ) );
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- GP::$router->prepend( '/stats/?', array( __NAMESPACE__ . '\Routes\Stats', 'get_stats_overview' ) );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ GP::$router->prepend( '/stats', array( __NAMESPACE__ . '\Routes\Stats', 'get_stats_overview' ) );
+ GP::$router->prepend( '/consistency', array( __NAMESPACE__ . '\Routes\Consistency', 'get_search_form' ) );
+
</ins><span class="cx" style="display: block; padding: 0 10px"> $project = '([^/]*)/?';
</span><span class="cx" style="display: block; padding: 0 10px"> GP::$router->prepend( "/projects/wp-plugins/$project", array( __NAMESPACE__ . '\Routes\WP_Plugins', 'get_plugin_projects' ) );
</span><span class="cx" style="display: block; padding: 0 10px"> GP::$router->prepend( "/projects/wp-plugins/$project/contributors", array( __NAMESPACE__ . '\Routes\WP_Plugins', 'get_plugin_contributors' ) );
</span></span></pre></div>
<a id="sitestrunkwordpressorgpublic_htmlwpcontentpluginswporggproutesincroutesclassconsistencyphp"></a>
<div class="addfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Added: sites/trunk/wordpress.org/public_html/wp-content/plugins/wporg-gp-routes/inc/routes/class-consistency.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- sites/trunk/wordpress.org/public_html/wp-content/plugins/wporg-gp-routes/inc/routes/class-consistency.php (rev 0)
+++ sites/trunk/wordpress.org/public_html/wp-content/plugins/wporg-gp-routes/inc/routes/class-consistency.php 2016-04-25 15:59:44 UTC (rev 3003)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -0,0 +1,162 @@
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+<?php
+
+namespace WordPressdotorg\GlotPress\Routes\Routes;
+
+use GP_Locales;
+use GP_Route;
+
+/**
+ * Consistency Route Class.
+ *
+ * Provides the route for translate.wordpress.org/consistency.
+ */
+class Consistency extends GP_Route {
+
+ private $cache_group = 'wporg-translate';
+
+ /**
+ * Prints a search form and the search results for a consistency view.
+ */
+ public function get_search_form() {
+ $sets = $this->get_translation_sets();
+
+ $search = $set = '';
+ $search_fuzzy = false;
+ $search_case_senstive = true;
+
+ if ( ! empty( $_REQUEST['search'] ) ) {
+ $search = wp_unslash( $_REQUEST['search'] );
+ }
+
+ if ( ! empty( $_REQUEST['set'] ) ) {
+ $set = wp_unslash( $_REQUEST['set'] );
+ if ( ! isset( $sets[ $set ] ) ) {
+ $set = '';
+ }
+ }
+
+ if ( ! empty( $_REQUEST ) && empty( $_REQUEST['search_case_senstive'] ) ) {
+ $search_case_senstive = false;
+ }
+
+ if ( ! empty( $_REQUEST['search_fuzzy'] ) ) {
+ $search_fuzzy = true;
+ }
+
+ $locale_is_rtl = false;
+ if ( $set ) {
+ list( $locale, $slug ) = explode( '/', $set );
+ $locale_is_rtl = 'rtl' === GP_Locales::by_slug( $locale )->text_direction;
+ }
+
+ $results = [];
+ $performed_search = false;
+ if ( $search && $set ) {
+ $performed_search = true;
+ $results = $this->query( [
+ 'search' => $search,
+ 'set' => $set,
+ 'fuzzy' => $search_fuzzy,
+ 'case_senstive' => $search_case_senstive,
+ ] );
+
+ $translations = wp_list_pluck( $results, 'translation', 'translation_id' );
+ $translations_unique = array_unique( $translations );
+ }
+
+ $this->tmpl( 'consistency', get_defined_vars() );
+ }
+
+ /**
+ * Retrieves a list of unique translation sets.
+ *
+ * @return array Array of sets.
+ */
+ private function get_translation_sets() {
+ global $wpdb;
+
+ $sets = wp_cache_get( 'translation-sets', $this->cache_group );
+
+ if ( false === $sets ) {
+ $_sets = $wpdb->get_results( "SELECT name, locale, slug FROM {$wpdb->gp_translation_sets} GROUP BY locale, slug ORDER BY name" );
+
+ $sets = array();
+ foreach ( $_sets as $set ) {
+ $sets[ "{$set->locale}/$set->slug" ] = $set->name;
+ }
+
+ wp_cache_set( 'translation-sets', $sets, $this->cache_group, DAY_IN_SECONDS );
+ }
+
+ return $sets;
+ }
+
+ /**
+ * Performs the search query.
+ *
+ * @param array $args Query arguments.
+ *
+ * @return array The search results.
+ */
+ private function query( $args ) {
+ global $wpdb;
+
+ list( $locale, $slug ) = explode( '/', $args['set'] );
+
+ if ( $args['case_senstive'] ) {
+ $collation = 'BINARY';
+ } else {
+ $collation = '';
+ }
+
+ if ( $args['fuzzy'] ) {
+ $search = $wpdb->prepare( "LIKE {$collation} %s", $wpdb->esc_like( $args['search'] ) . '%%' );
+ } else {
+ $search = $wpdb->prepare( "= {$collation} %s", $args['search'] );
+ }
+
+ $results = $wpdb->get_results( $wpdb->prepare( "
+ SELECT
+ p.name AS project_name,
+ p.id AS project_id,
+ p.path AS project_path,
+ p.parent_project_id AS project_parent_id,
+ o.singular AS original_singular,
+ o.plural AS original_plural,
+ o.context AS original_context,
+ o.id AS original_id,
+ t.translation_0 AS translation,
+ t.date_added AS translation_added,
+ t.id AS translation_id
+ FROM {$wpdb->gp_originals} AS o
+ JOIN
+ {$wpdb->gp_projects} AS p ON p.id = o.project_id
+ JOIN
+ {$wpdb->gp_translations} AS t ON o.id = t.original_id
+ JOIN
+ {$wpdb->gp_translation_sets} as ts on ts.id = t.translation_set_id
+ WHERE
+ p.active = 1
+ AND t.status = 'current'
+ AND o.status = '+active' AND o.singular {$search}
+ AND ts.locale = '%s' AND ts.slug = '%s'
+ LIMIT 0, 500
+ ",
+ $locale,
+ $slug
+ ) );
+
+ if ( ! $results ) {
+ return [];
+ }
+
+ // Group by translation. Done in PHP because it's faster as in MySQL.
+ usort( $results, [ $this, '_sort_callback' ] );
+
+ return $results;
+ }
+
+ public function _sort_callback( $a, $b ) {
+ return strnatcmp( $a->translation, $b->translation );
+ }
+}
</ins></span></pre>
</div>
</div>
</body>
</html>