<!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>[2864] sites/trunk: Translate: Display stats, contributors and language packs on theme project pages.</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/2864">2864</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/2864","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-03-31 20:25:15 +0000 (Thu, 31 Mar 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: Display stats, contributors and language packs on theme project pages.

See <a href="http://meta.trac.wordpress.org/ticket/1388">#1388</a>.</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#sitestrunktranslatewordpressorgpublic_htmlgptemplatesnewprojectswppluginsphp">sites/trunk/translate.wordpress.org/public_html/gp-templates-new/projects-wp-plugins.php</a></li>
<li><a href="#sitestrunktranslatewordpressorgpublic_htmlgptemplatesnewstatsoverviewphp">sites/trunk/translate.wordpress.org/public_html/gp-templates-new/stats-overview.php</a></li>
<li><a href="#sitestrunktranslatewordpressorgpublic_htmlgptemplatesnewstylecss">sites/trunk/translate.wordpress.org/public_html/gp-templates-new/style.css</a></li>
<li><a href="#sitestrunkwordpressorgpublic_htmlwpcontentpluginswporggproutesrouteswppluginsphp">sites/trunk/wordpress.org/public_html/wp-content/plugins/wporg-gp-routes/routes/wp-plugins.php</a></li>
<li><a href="#sitestrunkwordpressorgpublic_htmlwpcontentpluginswporggprouteswporggproutesphp">sites/trunk/wordpress.org/public_html/wp-content/plugins/wporg-gp-routes/wporg-gp-routes.php</a></li>
</ul>

<h3>Added Paths</h3>
<ul>
<li><a href="#sitestrunktranslatewordpressorgpublic_htmlgptemplatesnewprojectswpthemescontributorsphp">sites/trunk/translate.wordpress.org/public_html/gp-templates-new/projects-wp-themes-contributors.php</a></li>
<li><a href="#sitestrunktranslatewordpressorgpublic_htmlgptemplatesnewprojectswpthemeslanguagepacksphp">sites/trunk/translate.wordpress.org/public_html/gp-templates-new/projects-wp-themes-language-packs.php</a></li>
<li><a href="#sitestrunktranslatewordpressorgpublic_htmlgptemplatesnewprojectswpthemesphp">sites/trunk/translate.wordpress.org/public_html/gp-templates-new/projects-wp-themes.php</a></li>
<li><a href="#sitestrunkwordpressorgpublic_htmlwpcontentpluginswporggproutesrouteswpdirectoryphp">sites/trunk/wordpress.org/public_html/wp-content/plugins/wporg-gp-routes/routes/wp-directory.php</a></li>
<li><a href="#sitestrunkwordpressorgpublic_htmlwpcontentpluginswporggproutesrouteswpthemesphp">sites/trunk/wordpress.org/public_html/wp-content/plugins/wporg-gp-routes/routes/wp-themes.php</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="sitestrunktranslatewordpressorgpublic_htmlgptemplatesnewprojectswppluginsphp"></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/projects-wp-plugins.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/projects-wp-plugins.php  2016-03-31 20:14:20 UTC (rev 2863)
+++ sites/trunk/translate.wordpress.org/public_html/gp-templates-new/projects-wp-plugins.php    2016-03-31 20:25:15 UTC (rev 2864)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -55,8 +55,8 @@
</span><span class="cx" style="display: block; padding: 0 10px">        <table id="stats-table" class="table">
</span><span class="cx" style="display: block; padding: 0 10px">                <thead>
</span><span class="cx" style="display: block; padding: 0 10px">                        <tr>
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                                <?php foreach ( $table_headings as $heading ) : ?>
-                               <th class="title"><?php echo $heading; ?></th>
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                         <?php foreach ( $table_headings as $key => $heading ) : ?>
+                               <th class="col-<?php echo $key; ?>"><?php echo $heading; ?></th>
</ins><span class="cx" style="display: block; padding: 0 10px">                                 <?php endforeach; ?>
</span><span class="cx" style="display: block; padding: 0 10px">                        </tr>
</span><span class="cx" style="display: block; padding: 0 10px">                </thead>
</span></span></pre></div>
<a id="sitestrunktranslatewordpressorgpublic_htmlgptemplatesnewprojectswpthemescontributorsphpfromrev2858sitestrunktranslatewordpressorgpublic_htmlgptemplatesnewprojectswppluginscontributorsphp"></a>
<div class="copfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Copied: sites/trunk/translate.wordpress.org/public_html/gp-templates-new/projects-wp-themes-contributors.php (from rev 2858, sites/trunk/translate.wordpress.org/public_html/gp-templates-new/projects-wp-plugins-contributors.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/projects-wp-themes-contributors.php                              (rev 0)
+++ sites/trunk/translate.wordpress.org/public_html/gp-templates-new/projects-wp-themes-contributors.php        2016-03-31 20:25:15 UTC (rev 2864)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -0,0 +1,187 @@
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+<?php
+$edit_link = gp_link_project_edit_get( $project, __( '(edit)' ) );
+gp_title( sprintf( __( '%s &lt; GlotPress' ), esc_html( $project->name ) ) );
+gp_breadcrumb( array(
+       gp_project_links_from_root( $project ),
+       'Editors &amp; Contributors',
+) );
+
+
+gp_enqueue_script( 'common' );
+gp_enqueue_style( 'chartist' );
+gp_enqueue_script( 'chartist' );
+
+gp_tmpl_header();
+?>
+<div class="project-header">
+       <p class="project-description"><?php echo apply_filters( 'project_description', $project->description, $project ); ?></p>
+
+       <div class="project-box">
+               <div class="project-box-header">
+                       <div class="project-icon">
+                               <?php echo $project->icon; ?>
+                       </div>
+
+                       <ul class="project-meta">
+                               <li class="project-name"><?php echo $project->name; ?> <?php echo $edit_link; ?></li>
+                       </ul>
+               </div>
+
+               <div class="project-box-footer">
+                       <ul class="projects-dropdown">
+                               <li><span>Contributors</span>
+                                       <ul>
+                                               <li><a href="<?php echo gp_url_project( $project ); ?>">Projects</a></li>
+                                               <li><a href="<?php echo gp_url_join( gp_url_project( $project ), 'language-packs' ); ?>">Language Packs</a></li>
+                                       </ul>
+                               </li>
+                       </ul>
+               </div>
+       </div>
+</div>
+
+<div class="project-sub-page">
+
+       <h3>Activity</h3>
+       <p>The graph shows the recent activity of your contributors. It&#8217;s updated once per day.</p>
+
+       <div class="ct-chart ct-chart-contributors"></div>
+
+       <h3>Teams</h3>
+       <p>For each locale a theme can have translation editors and contributors. If a locale has no editor yet then you should probably <a href="https://make.wordpress.org/polyglots/handbook/rosetta/theme-plugin-directories/#translating-themes-plugins">make a request</a>.</p>
+       <?php
+       if ( $contributors_by_locale ) {
+               ?>
+               <div class="contributors-list-filter">
+                       <button type="button" class="button-link filter active" data-filter="all">All</button> |
+                       <button type="button" class="button-link filter" data-filter="has-editors">With Editors</button> |
+                       <button type="button" class="button-link filter" data-filter="no-editors">Without Editors</button>
+
+                       <input type="search" class="search" placeholder="Filter teams&hellip;" id="contributors-list-search">
+               </div>
+               <?php
+               echo '<div id="contributors-list" class="contributors-list">';
+               foreach ( $contributors_by_locale as $locale_slug => $data ) {
+                       $locale = GP_Locales::by_slug( $locale_slug );
+                       $has_editors = ! empty ( $data['editors'] );
+
+                       $editors_list = array();
+                       foreach ( $data['editors'] as $editor ) {
+                               $editors_list[] = sprintf(
+                                       '<a href="https://profiles.wordpress.org/%s/">%s</a>',
+                                       $editor->nicename,
+                                       $editor->display_name ? $editor->display_name : $editor->nicename
+                               );
+                       }
+
+                       if ( ! $editors_list ) {
+                               $editors_list[] = 'None';
+                       }
+
+                       $contributor_list = array();
+                       foreach ( $data['contributors'] as $contributor ) {
+                               $contributor_list[] = sprintf(
+                                       '<a href="https://profiles.wordpress.org/%s/">%s</a>',
+                                       $contributor->nicename,
+                                       $contributor->display_name ? $contributor->display_name : $contributor->nicename
+                               );
+                       }
+
+                       if ( ! $contributor_list ) {
+                               $contributor_list[] = 'None';
+                       }
+
+                       printf(
+                               '<div class="contributors-list-box%s">
+                                       <h4><span class="locale-name">%s<span> <span class="contributors-count">%s</span> <span class="locale-code">#%s</span></h4>
+                                       <p><strong>Editors:</strong> %s</p>
+                                       <p><strong>Contributors:</strong> %s</p>
+                               </div>',
+                               $has_editors ? ' has-editors' : ' no-editors',
+                               $locale->english_name,
+                               sprintf( _n( '%s person', '%s persons', $data['count'] ), number_format_i18n( $data['count'] ) ),
+                               $locale->wp_locale,
+                               wp_sprintf( '%l', $editors_list ),
+                               wp_sprintf( '%l', $contributor_list )
+                       );
+               }
+               echo '</div>';
+       } else {
+               echo '<p>The plugin has no contributors, yet.</p>';
+       }
+       ?>
+</div>
+
+<script type="text/javascript">
+jQuery( function( $ ) {
+       $( '.projects-dropdown > li' ).on( 'click', function() {
+               $( this ).parent( '.projects-dropdown' ).toggleClass( 'open' );
+       });
+
+       $rows = $( '#contributors-list' ).find( '.contributors-list-box' );
+       $( '#contributors-list-search' ).on( 'input keyup',function() {
+               var words = this.value.toLowerCase().split( ' ' );
+
+               if ( '' === this.value.trim() ) {
+                       $rows.show();
+               } else {
+                       $rows.hide();
+                       $rows.filter( function( i, v ) {
+                               var $t = $(this).find( '.locale-name' );
+                               for ( var d = 0; d < words.length; ++d ) {
+                                       if ( $t.text().toLowerCase().indexOf( words[d] ) != -1 ) {
+                                               return true;
+                                       }
+                               }
+                               return false;
+                       }).show();
+               }
+       });
+
+       $( '.contributors-list-filter .filter' ).on( 'click', function() {
+               var $el = $( this ), filter = $el.data( 'filter' );
+
+               $el.siblings( '.active' ).removeClass( 'active' );
+               $el.addClass( 'active' );
+               $( '#contributors-list' ).attr( 'data-current-filter', filter );
+       });
+});
+
+new Chartist.Line('.ct-chart-contributors', {
+       labels: <?php echo json_encode( $chart_data['labels'] ); ?>,
+       series: <?php echo json_encode( $chart_data['series'] ); ?>
+}, {
+       lineSmooth: Chartist.Interpolation.simple({
+               divisor: 2
+       }),
+       low: 0,
+       showPoint: false,
+       showLine: false,
+       showArea: true,
+       fullWidth: true,
+       axisX: {
+               showGrid: false,
+       },
+       axisY: {
+               onlyInteger: true,
+               offset: 30
+       },
+       chartPadding: {
+               right: 0,
+               left: 0
+       },
+       plugins: [
+               Chartist.plugins.legend()
+       ]
+}, [
+       ['screen and (max-width: 500px)', {
+               axisX: {
+                       labelInterpolationFnc: function( value, index ) {
+                               return index % 2 === 0 ? value : null;
+                       }
+               }
+       }]
+]);
+</script>
+
+<?php gp_tmpl_footer();
</ins></span></pre></div>
<a id="sitestrunktranslatewordpressorgpublic_htmlgptemplatesnewprojectswpthemeslanguagepacksphpfromrev2858sitestrunktranslatewordpressorgpublic_htmlgptemplatesnewprojectswppluginslanguagepacksphp"></a>
<div class="copfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Copied: sites/trunk/translate.wordpress.org/public_html/gp-templates-new/projects-wp-themes-language-packs.php (from rev 2858, sites/trunk/translate.wordpress.org/public_html/gp-templates-new/projects-wp-plugins-language-packs.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/projects-wp-themes-language-packs.php                            (rev 0)
+++ sites/trunk/translate.wordpress.org/public_html/gp-templates-new/projects-wp-themes-language-packs.php      2016-03-31 20:25:15 UTC (rev 2864)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -0,0 +1,75 @@
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+<?php
+$edit_link = gp_link_project_edit_get( $project, __( '(edit)' ) );
+gp_title( sprintf( __( '%s &lt; GlotPress' ), esc_html( $project->name ) ) );
+gp_breadcrumb( array(
+       gp_project_links_from_root( $project ),
+       'Language Packs',
+) );
+
+
+gp_enqueue_script( 'common' );
+
+gp_tmpl_header();
+?>
+
+<div class="project-header">
+       <p class="project-description"><?php echo apply_filters( 'project_description', $project->description, $project ); ?></p>
+
+       <div class="project-box">
+               <div class="project-box-header">
+                       <div class="project-icon">
+                               <?php echo $project->icon; ?>
+                       </div>
+
+                       <ul class="project-meta">
+                               <li class="project-name"><?php echo $project->name; ?> <?php echo $edit_link; ?></li>
+                       </ul>
+               </div>
+
+               <div class="project-box-footer">
+                       <ul class="projects-dropdown">
+                               <li><span>Language Packs</span>
+                                       <ul>
+                                               <li><a href="<?php echo gp_url_project( $project ); ?>">Projects</a></li>
+                                               <li><a href="<?php echo gp_url_join( gp_url_project( $project ), 'contributors' ); ?>">Contributors</a></li>
+                                       </ul>
+                               </li>
+                       </ul>
+               </div>
+       </div>
+</div>
+
+<div class="project-sub-page">
+       <h3>Language Packs</h3>
+
+       <p>Language packs are installed automatically if they are available. Once a locale has reached the threshold for a package build it will be listed here. It also means that you don&#8217;t have to include this language in your theme anymore.</p>
+
+       <?php
+       if ( isset( $language_packs->translations ) && $language_packs->translations ) {
+               echo '<ul class="language-packs-list">';
+               foreach ( $language_packs->translations as $language_pack ) {
+                       printf(
+                               '<li><strong>%s <span class="locale-code">(%s)</span>:</strong> Last updated %s for version %s (<a href="%s">zip</a>)</li>',
+                               $language_pack->english_name,
+                               $language_pack->language,
+                               $language_pack->updated,
+                               $language_pack->version,
+                               $language_pack->package
+                       );
+               }
+               echo '</ul>';
+       } else {
+               echo '<p>The are no language packs yet.</p>';
+       }
+       ?>
+</div>
+
+<script type="text/javascript">
+jQuery( function( $ ) {
+       $( '.projects-dropdown > li' ).on( 'click', function() {
+               $( this ).parent( '.projects-dropdown' ).toggleClass( 'open' );
+       });
+});
+</script>
+
+<?php gp_tmpl_footer();
</ins></span></pre></div>
<a id="sitestrunktranslatewordpressorgpublic_htmlgptemplatesnewprojectswpthemesphpfromrev2858sitestrunktranslatewordpressorgpublic_htmlgptemplatesnewprojectswppluginsphp"></a>
<div class="copfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Copied: sites/trunk/translate.wordpress.org/public_html/gp-templates-new/projects-wp-themes.php (from rev 2858, sites/trunk/translate.wordpress.org/public_html/gp-templates-new/projects-wp-plugins.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/projects-wp-themes.php                           (rev 0)
+++ sites/trunk/translate.wordpress.org/public_html/gp-templates-new/projects-wp-themes.php     2016-03-31 20:25:15 UTC (rev 2864)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -0,0 +1,139 @@
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+<?php
+$edit_link = gp_link_project_edit_get( $project, __( '(edit)' ) );
+$table_headings = array(
+       'locale'        => __( 'Locale' ),
+       'stable'        => __( 'Stable' ),
+       'waiting'       => __( 'Waiting' ),
+);
+
+gp_title( sprintf( __( '%s &lt; GlotPress' ), esc_html( $project->name ) ) );
+gp_breadcrumb_project( $project );
+
+gp_enqueue_script( 'common' );
+gp_enqueue_script( 'tablesorter' );
+
+gp_tmpl_header();
+?>
+
+<div class="project-header">
+       <p class="project-description"><?php echo apply_filters( 'project_description', $project->description, $project ); ?></p>
+
+       <div class="project-box">
+               <div class="project-box-header">
+                       <div class="project-icon">
+                               <?php echo $project->icon; ?>
+                       </div>
+
+                       <ul class="project-meta">
+                               <li class="project-name"><?php echo $project->name; ?> <?php echo $edit_link; ?></li>
+                       </ul>
+               </div>
+
+               <div class="project-box-footer">
+                       <ul class="projects-dropdown">
+                               <li><span>Projects</span>
+                                       <ul>
+                                               <li><a href="<?php echo gp_url_join( gp_url_project( $project ), 'contributors' ); ?>">Contributors</a></li>
+                                               <li><a href="<?php echo gp_url_join( gp_url_project( $project ), 'language-packs' ); ?>">Language Packs</a></li>
+                                       </ul>
+                               </li>
+                       </ul>
+               </div>
+       </div>
+</div>
+
+<div class="stats-table">
+       <table id="stats-table" class="table">
+               <thead>
+                       <tr>
+                               <?php foreach ( $table_headings as $key => $heading ) : ?>
+                               <th class="col-<?php echo $key; ?>"><?php echo $heading; ?></th>
+                               <?php endforeach; ?>
+                       </tr>
+               </thead>
+               <tbody>
+                       <?php
+                       foreach ( $translation_locale_complete as $locale_slug => $total_complete ) :
+                               $gp_locale = GP_Locales::by_slug( $locale_slug );
+                               $set_slug  = 'default';
+
+                               // Variants (de/formal for example) don't have GP_Locales in this context
+                               if ( ! $gp_locale && ( list( $base_locale_slug, $set_slug ) = explode( '/', $locale_slug ) ) ) :
+                                       $gp_locale = clone GP_Locales::by_slug( $base_locale_slug );
+
+                                       // Just append it for now..
+                                       $gp_locale->wp_locale .= '/' . $set_slug;
+                                       $gp_locale->english_name .=  ' (' . ucfirst( $set_slug ) . ')';
+                               endif;
+
+                               if ( ! $gp_locale || ! $gp_locale->wp_locale ) :
+                                       continue;
+                               endif;
+                       ?>
+                               <tr>
+                                       <th title="<?php echo esc_attr( $gp_locale->wp_locale ); ?>">
+                                               <a href="<?php echo gp_url( gp_url_join( 'locale', $gp_locale->slug, $set_slug, $project->path ) ); ?>">
+                                                       <?php echo esc_html( $gp_locale->english_name ); ?>
+                                               </a>
+                                       </th>
+                                       <?php
+                                               if ( $translation_locale_statuses[ $locale_slug ] ) :
+                                                       foreach ( array( 'stable', 'waiting' ) as $subproject_slug ) :
+                                                               if ( isset( $translation_locale_statuses[ $locale_slug ][ $subproject_slug ] ) ) :
+                                                                       $percent = $translation_locale_statuses[ $locale_slug ][ $subproject_slug ];
+
+                                                                       if ( 'waiting' === $subproject_slug ) :
+                                                                               // Color code it on -0~500 waiting strings
+                                                                               $percent_class = 100 - min( (int) ( $percent / 50 ) * 10, 100 );
+
+                                                                               // It's only 100 if it has 0 strings.
+                                                                               if ( 100 == $percent_class && $percent ) {
+                                                                                       $percent_class = 90;
+                                                                               }
+
+                                                                               $link_url  = gp_url( gp_url_join( 'locale', $gp_locale->slug, $set_slug, $project->path ) );
+                                                                               $link_text = number_format( $percent );
+                                                                       else :
+                                                                               $percent_class = (int) ( $percent / 10 ) * 10;
+                                                                               $link_url  = gp_url_project( $project->path, gp_url_join( $gp_locale->slug, $set_slug ) );
+                                                                               $link_text = "$percent%";
+
+                                                                       endif;
+
+                                                                       echo '<td data-column-title="' . esc_attr( $table_headings[ $subproject_slug ] ) . '" data-sort-value="' . esc_attr( $percent ) . '" class="percent' . $percent_class .'">'. gp_link_get( $link_url, $link_text ) . '</td>';
+                                                               else :
+                                                                       echo '<td class="none" data-column-title="" data-sort-value="-1">&mdash;</td>';
+                                                               endif;
+                                                       endforeach;
+                                               else :
+                                                       echo '<td class="none" data-sort-value="-1">&mdash;</td>';
+                                                       echo '<td class="none" data-sort-value="-1">&mdash;</td>';
+                                                       echo '<td class="none" data-sort-value="-1">&mdash;</td>';
+                                                       echo '<td class="none" data-sort-value="-1">&mdash;</td>';
+                                                       echo '<td class="none" data-sort-value="-1">&mdash;</td>';
+                                               endif;
+                                       ?>
+                               </tr>
+                       <?php endforeach; ?>
+               </tbody>
+       </table>
+</div>
+
+<script type="text/javascript">
+jQuery( function( $ ) {
+       $( '#stats-table' ).tablesorter( {
+               textExtraction: function( node ) {
+                       var cellValue = $( node ).text(),
+                               sortValue = $( node ).data( 'sortValue' );
+
+                       return ( undefined !== sortValue ) ? sortValue : cellValue;
+               }
+       });
+
+       $( '.projects-dropdown > li' ).on( 'click', function() {
+               $( this ).parent( '.projects-dropdown' ).toggleClass( 'open' );
+       });
+});
+</script>
+
+<?php gp_tmpl_footer();
</ins></span></pre></div>
<a id="sitestrunktranslatewordpressorgpublic_htmlgptemplatesnewstatsoverviewphp"></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/stats-overview.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/stats-overview.php       2016-03-31 20:14:20 UTC (rev 2863)
+++ sites/trunk/translate.wordpress.org/public_html/gp-templates-new/stats-overview.php 2016-03-31 20:25:15 UTC (rev 2864)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -13,7 +13,7 @@
</span><span class="cx" style="display: block; padding: 0 10px">        <table id="stats-table" class="table">
</span><span class="cx" style="display: block; padding: 0 10px">                <thead>
</span><span class="cx" style="display: block; padding: 0 10px">                        <tr>
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                                <th class="title"><?php _e( 'Locale' ); ?></th>
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                         <th class="col-locale-code"><?php _e( 'Locale' ); ?></th>
</ins><span class="cx" style="display: block; padding: 0 10px">                                 <?php foreach ( $projects as $slug => $project ) : ?>
</span><span class="cx" style="display: block; padding: 0 10px">                                        <th><?php
</span><span class="cx" style="display: block; padding: 0 10px">                                                $namereplace = array( 'WordPress.org ', 'WordPress for ', 'WordPress ', 'ectory' );
</span></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-03-31 20:14:20 UTC (rev 2863)
+++ sites/trunk/translate.wordpress.org/public_html/gp-templates-new/style.css  2016-03-31 20:25:15 UTC (rev 2864)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -948,6 +948,7 @@
</span><span class="cx" style="display: block; padding: 0 10px">        width: 100%;
</span><span class="cx" style="display: block; padding: 0 10px">        text-align: center;
</span><span class="cx" style="display: block; padding: 0 10px">        border-collapse: collapse;
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+        table-layout: fixed;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px"> .stats-table table thead {
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -961,7 +962,6 @@
</span><span class="cx" style="display: block; padding: 0 10px">        font-weight: bold;
</span><span class="cx" style="display: block; padding: 0 10px">        text-align: center;
</span><span class="cx" style="display: block; padding: 0 10px">        vertical-align: bottom;
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-        width: 79px;
</del><span class="cx" style="display: block; padding: 0 10px">         padding: 10px 3px;
</span><span class="cx" style="display: block; padding: 0 10px">        font-size: .8em;
</span><span class="cx" style="display: block; padding: 0 10px">        line-height: 1.2;
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -973,10 +973,18 @@
</span><span class="cx" style="display: block; padding: 0 10px">        border-right: none;
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-.stats-table table th.title {
-       width: 140px!important;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+.stats-table table th {
+       word-break: break-word;
</ins><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">+.stats-table table th.col-locale-code {
+       width: 110px;
+}
+
+.stats-table table th.col-locale {
+       width: 180px;
+}
+
</ins><span class="cx" style="display: block; padding: 0 10px"> .stats-table .none {
</span><span class="cx" style="display: block; padding: 0 10px">        color: #ccc;
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span></span></pre></div>
<a id="sitestrunkwordpressorgpublic_htmlwpcontentpluginswporggproutesrouteswpdirectoryphpfromrev2858sitestrunkwordpressorgpublic_htmlwpcontentpluginswporggproutesrouteswppluginsphp"></a>
<div class="copfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Copied: sites/trunk/wordpress.org/public_html/wp-content/plugins/wporg-gp-routes/routes/wp-directory.php (from rev 2858, sites/trunk/wordpress.org/public_html/wp-content/plugins/wporg-gp-routes/routes/wp-plugins.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/routes/wp-directory.php                          (rev 0)
+++ sites/trunk/wordpress.org/public_html/wp-content/plugins/wporg-gp-routes/routes/wp-directory.php    2016-03-31 20:25:15 UTC (rev 2864)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -0,0 +1,238 @@
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+<?php
+
+class WPorg_GP_Route_WP_Directory extends GP_Route {
+
+       /**
+        * Prints stats about contributors of a specific project.
+        *
+        * @param GP_Project $project The project.
+        * @return array|false False if project not found, otherwise array with contributors.
+        */
+       public function get_contributors( $project ) {
+               global $wpdb;
+
+               $contributors_by_locale = array();
+               $default_value = array(
+                       'count' => 0,
+                       'editors' => array(),
+                       'contributors' => array(),
+               );
+
+               $translation_editors = $wpdb->get_results( $wpdb->prepare( "
+                       SELECT
+                               `user_id`, `locale`
+                       FROM {$wpdb->wporg_translation_editors}
+                       WHERE `project_id` = %d
+               ", $project->id ), OBJECT );
+
+               foreach ( $translation_editors as $translation_editor ) {
+                       if ( ! isset( $contributors_by_locale[ $translation_editor->locale ] ) ) {
+                               $contributors_by_locale[ $translation_editor->locale ] = $default_value;
+                       }
+
+                       $user = get_user_by( 'id', $translation_editor->user_id );
+                       if ( ! $user ) {
+                               continue;
+                       }
+
+                       $contributors_by_locale[ $translation_editor->locale ]['editors'][ $translation_editor->user_id ] = (object) array(
+                               'nicename'     => $user->user_nicename,
+                               'display_name' => $this->_encode( $user->display_name ),
+                       );
+
+                       $contributors_by_locale[ $translation_editor->locale ]['count']++;
+               }
+
+               unset( $translation_editors );
+
+               foreach( $this->get_translation_contributors_by_locale( $project->id ) as $row ) {
+                       if ( ! isset( $contributors_by_locale[ $row->locale ] ) ) {
+                               $contributors_by_locale[ $row->locale ] = $default_value;
+                       }
+
+                       if ( isset( $contributors_by_locale[ $row->locale ]['editors'][ $row->user_id ] ) ) {
+                               continue;
+                       }
+
+                       if ( isset( $contributors_by_locale[ $row->locale ]['contributors'][ $row->user_id ] ) ) {
+                               continue;
+                       }
+
+                       $user = get_user_by( 'id', $row->user_id );
+                       if ( ! $user ) {
+                               continue;
+                       }
+
+                       $contributors_by_locale[ $row->locale ]['contributors'][ $row->user_id ] = (object) array(
+                               'nicename'     => $user->user_nicename,
+                               'display_name' => $this->_encode( $user->display_name ),
+                       );
+
+                       $contributors_by_locale[ $row->locale ]['count']++;
+               }
+
+               $sub_projects = $wpdb->get_col( $wpdb->prepare( "
+                       SELECT id
+                       FROM {$wpdb->gp_projects}
+                       WHERE parent_project_id = %d
+               ", $project->id ) );
+
+               foreach ( $sub_projects as $sub_project ) {
+                       foreach( $this->get_translation_contributors_by_locale( $sub_project ) as $row ) {
+                               if ( ! isset( $contributors_by_locale[ $row->locale ] ) ) {
+                                       $contributors_by_locale[ $row->locale ] = $default_value;
+                               }
+
+                               if ( isset( $contributors_by_locale[ $row->locale ]['editors'][ $row->user_id ] ) ) {
+                                       continue;
+                               }
+
+                               if ( isset( $contributors_by_locale[ $row->locale ]['contributors'][ $row->user_id ] ) ) {
+                                       continue;
+                               }
+
+                               $user = get_user_by( 'id', $row->user_id );
+                               if ( ! $user ) {
+                                       continue;
+                               }
+
+                               $contributors_by_locale[ $row->locale ]['contributors'][ $row->user_id ] = (object) array(
+                                       'nicename'     => $user->user_nicename,
+                                       'display_name' => $this->_encode( $user->display_name ),
+                               );
+
+                               $contributors_by_locale[ $row->locale ]['count']++;
+                       }
+               }
+
+               return $contributors_by_locale;
+       }
+
+       /**
+        * Generates the chart data for contributors activity.
+        *
+        * @param GP_Project $project_id The project.
+        * @return array The data to build a chart via Chartist.js.
+        */
+       protected function get_contributors_chart_data( $project ) {
+               global $wpdb;
+
+               $sub_projects = $wpdb->get_col( $wpdb->prepare( "
+                       SELECT id
+                       FROM {$wpdb->gp_projects}
+                       WHERE parent_project_id = %d
+               ", $project->id ) );
+
+               $project_ids = array_merge( array( $project->id ), $sub_projects );
+               $translation_set_ids = $wpdb->get_col( "
+                       SELECT `id` FROM {$wpdb->gp_translation_sets} WHERE `project_id` IN (" . implode( ',', $project_ids ) . ")
+               " );
+
+               if ( ! $translation_set_ids ) {
+                       return array();
+               }
+
+               $date_begin = new DateTime( '-6 day' );
+               $date_end = new DateTime( 'NOW' );
+               $date_interval = new DateInterval( 'P1D' );
+               $date_range = new DatePeriod( $date_begin, $date_interval, $date_end );
+
+               $days = array();
+               foreach( $date_range as $date ) {
+                       $days[] = $date->format( 'Y-m-d' );
+               }
+               $days[] = $date_end->format( 'Y-m-d' );
+
+               $counts = $wpdb->get_results( "
+                       SELECT
+                               DATE(date_modified) AS `day`, COUNT(*) AS `count`, `status`
+                       FROM {$wpdb->gp_translations}
+                       WHERE
+                               `translation_set_id` IN (" . implode( ',', $translation_set_ids ) . ")
+                               AND date_modified >= ( CURDATE() - INTERVAL 7 DAY )
+                       GROUP BY `status`, `day`
+                       ORDER BY `day` DESC
+               " );
+
+               $status = array( 'current', 'waiting', 'rejected' );
+               $data = [];
+               foreach ( $days as $day ) {
+                       $data[ $day ] = array_fill_keys( $status, 0 );
+                       foreach ( $counts as $count ) {
+                               if ( $count->day !== $day || ! in_array( $count->status, $status ) ) {
+                                       continue;
+                               }
+
+                               $data[ $day ][ $count->status ] = (int) $count->count;
+                       }
+               }
+
+               $labels = array_keys( $data );
+               array_pop( $labels );
+               $labels[] = ''; // Don't show a label for today
+
+               $series = array();
+               $series_data = array_values( $data );
+               foreach ( $status as $stati ) {
+                       $series[] = (object) array(
+                               'name' => $stati,
+                               'data' => wp_list_pluck( $series_data, $stati ),
+                       );
+               }
+
+               $chart_data = compact( 'labels', 'series' );
+
+               return $chart_data;
+       }
+
+       /**
+        * Prints stats about language packs of a specific project.
+        *
+        * @param string $type Type of the language pack, plugin or theme.
+        * @param string $slug Slug of a project.
+        */
+       public function get_language_packs( $type, $slug ) {
+               $http_context = stream_context_create( array(
+                       'http' => array(
+                               'user_agent' => 'WordPress.org Translate',
+                       ),
+               ) );
+               if ( 'plugin' === $type ) {
+                       $type = 'plugins';
+               } else {
+                       $type = 'themes';
+               }
+               $json = file_get_contents( "https://api.wordpress.org/translations/$type/1.0/?slug={$slug}", null, $http_context );
+               $language_packs = $json && '{' == $json[0] ? json_decode( $json ) : null;
+
+               return $language_packs;
+       }
+
+       /**
+        * Retrieves translators of a specific project.
+        *
+        * @param int $project_id Project ID.
+        * @return object Translators of the project.
+        */
+       private function get_translation_contributors_by_locale( $project_id ) {
+               global $wpdb;
+
+               $sql = $wpdb->prepare( "
+                       SELECT ts.`locale`, ts.`slug` AS `locale_slug`, t.`user_id`
+                       FROM `{$wpdb->gp_translations}` t, `{$wpdb->gp_translation_sets}` ts
+                       WHERE t.`translation_set_id` = ts.`id`
+                           AND t.`user_id` IS NOT NULL AND t.`user_id` != 0
+                           AND t.`date_modified` > %s
+                           AND ts.`project_id` = %d
+                           AND t.`status` <> 'rejected'
+                       GROUP BY ts.`locale`, ts.`slug`, t.`user_id`
+               ", date( 'Y-m-d', time() - YEAR_IN_SECONDS ), $project_id );
+
+               return $wpdb->get_results( $sql );
+       }
+
+       private function _encode( $raw ) {
+               $raw = mb_convert_encoding( $raw, 'UTF-8', 'ASCII, JIS, UTF-8, Windows-1252, ISO-8859-1' );
+               return ent2ncr( htmlspecialchars_decode( htmlentities( $raw, ENT_NOQUOTES, 'UTF-8' ), ENT_NOQUOTES ) );
+       }
+}
</ins></span></pre></div>
<a id="sitestrunkwordpressorgpublic_htmlwpcontentpluginswporggproutesrouteswppluginsphp"></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/routes/wp-plugins.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/routes/wp-plugins.php    2016-03-31 20:14:20 UTC (rev 2863)
+++ sites/trunk/wordpress.org/public_html/wp-content/plugins/wporg-gp-routes/routes/wp-plugins.php      2016-03-31 20:25:15 UTC (rev 2864)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -1,6 +1,6 @@
</span><span class="cx" style="display: block; padding: 0 10px"> <?php
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-class WPorg_GP_Route_WP_Plugins extends GP_Route {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+class WPorg_GP_Route_WP_Plugins extends WPorg_GP_Route_WP_Directory {
</ins><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">        /**
</span><span class="cx" style="display: block; padding: 0 10px">         * Prints stats about sub-project of a specific project.
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -93,11 +93,7 @@
</span><span class="cx" style="display: block; padding: 0 10px">                        }
</span><span class="cx" style="display: block; padding: 0 10px">                } );
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                if ( function_exists( 'wporg_get_plugin_icon' ) ) {
-                       $project->icon = wporg_get_plugin_icon( $project->slug, 64 );
-               } else {
-                       $project->icon = '<div class="default-icon"><span class="dashicons dashicons-admin-plugins"></span></div>';
-               }
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+         $project->icon = $this->get_plugin_icon( $project, 64 );
</ins><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">                $this->tmpl( 'projects-wp-plugins', get_defined_vars() );
</span><span class="cx" style="display: block; padding: 0 10px">        }
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -116,175 +112,28 @@
</span><span class="cx" style="display: block; padding: 0 10px">                        return $this->die_with_404();
</span><span class="cx" style="display: block; padding: 0 10px">                }
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                if ( function_exists( 'wporg_get_plugin_icon' ) ) {
-                       $project->icon = wporg_get_plugin_icon( $project->slug, 64 );
-               } else {
-                       $project->icon = '<div class="default-icon"><span class="dashicons dashicons-admin-plugins"></span></div>';
-               }
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+         $project->icon = $this->get_plugin_icon( $project, 64 );
</ins><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                $contributors_by_locale = array();
-               $default_value = array(
-                       'count' => 0,
-                       'editors' => array(),
-                       'contributors' => array(),
-               );
-
-               $translation_editors = $wpdb->get_results( $wpdb->prepare( "
-                       SELECT
-                               `user_id`, `locale`
-                       FROM {$wpdb->wporg_translation_editors}
-                       WHERE `project_id` = %d
-               ", $project->id ), OBJECT );
-
-               foreach ( $translation_editors as $translation_editor ) {
-                       if ( ! isset( $contributors_by_locale[ $translation_editor->locale ] ) ) {
-                               $contributors_by_locale[ $translation_editor->locale ] = $default_value;
-                       }
-
-                       $user = get_user_by( 'id', $translation_editor->user_id );
-                       if ( ! $user ) {
-                               continue;
-                       }
-
-                       $contributors_by_locale[ $translation_editor->locale ]['editors'][ $translation_editor->user_id ] = (object) array(
-                               'nicename'     => $user->user_nicename,
-                               'display_name' => $this->_encode( $user->display_name ),
-                       );
-
-                       $contributors_by_locale[ $translation_editor->locale ]['count']++;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+         $contributors_by_locale = gp_get_meta( 'wp-plugins', $project->id, 'contributors-by-locale' );
+               if ( ! $contributors_by_locale || $contributors_by_locale['last_updated'] + HOUR_IN_SECONDS < time() ) {
+                       $contributors_by_locale = $this->get_contributors( $project );
+                       $contributors_by_locale['last_updated'] = time();
+                       gp_update_meta( $project->id, 'contributors-by-locale', $contributors_by_locale, 'wp-plugins' );
</ins><span class="cx" style="display: block; padding: 0 10px">                 }
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                unset( $translation_editors );
-
-               $sub_projects = $wpdb->get_col( $wpdb->prepare( "
-                       SELECT id
-                       FROM {$wpdb->gp_projects}
-                       WHERE parent_project_id = %d
-               ", $project->id ) );
-
-               foreach ( $sub_projects as $sub_project ) {
-                       foreach( $this->get_translation_contributors_by_locale( $sub_project ) as $row ) {
-                               if ( ! isset( $contributors_by_locale[ $row->locale ] ) ) {
-                                       $contributors_by_locale[ $row->locale ] = $default_value;
-                               }
-
-                               if ( isset( $contributors_by_locale[ $row->locale ]['editors'][ $row->user_id ] ) ) {
-                                       continue;
-                               }
-
-                               if ( isset( $contributors_by_locale[ $row->locale ]['contributors'][ $row->user_id ] ) ) {
-                                       continue;
-                               }
-
-                               $user = get_user_by( 'id', $row->user_id );
-                               if ( ! $user ) {
-                                       continue;
-                               }
-
-                               $contributors_by_locale[ $row->locale ]['contributors'][ $row->user_id ] = (object) array(
-                                       'nicename'     => $user->user_nicename,
-                                       'display_name' => $this->_encode( $user->display_name ),
-                               );
-
-                               $contributors_by_locale[ $row->locale ]['count']++;
-                       }
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+         $chart_data = gp_get_meta( 'wp-plugins', $project->id, 'contributors-chart-data' );
+               if ( ! $chart_data || $chart_data['last_updated'] + DAY_IN_SECONDS < time() ) {
+                       $chart_data = $this->get_contributors_chart_data( $project );
+                       $chart_data['last_updated'] = time();
+                       gp_update_meta( $project->id, 'contributors-chart-data', $chart_data, 'wp-plugins' );
</ins><span class="cx" style="display: block; padding: 0 10px">                 }
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                $chart_data = $this->get_plugin_contributors_chart_data( $project->id, $sub_projects );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+         unset( $contributors_by_locale['last_updated'], $chart_data['last_updated'] );
</ins><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">                $this->tmpl( 'projects-wp-plugins-contributors', get_defined_vars() );
</span><span class="cx" style="display: block; padding: 0 10px">        }
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">        /**
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-         * Generates the chart data for contributors activity.
-        *
-        * @param  int    $project_id   The ID of a project. Used to store data as meta.
-        * @param  array $sub_projects Optional. IDs of sub-projects.
-        * @return array The data to build a chart via Chartist.js.
-        */
-       private function get_plugin_contributors_chart_data( $project_id, $sub_projects = null ) {
-               $chart_data = gp_get_meta( 'wp-plugins', $project_id, 'contributors-chart-data' );
-               if ( $chart_data ) {
-                       if ( $chart_data['last_updated'] + DAY_IN_SECONDS > time() ) {
-                               return $chart_data;
-                       }
-               }
-
-               global $wpdb;
-
-               if ( ! $sub_projects ) {
-                       $sub_projects = $wpdb->get_col( $wpdb->prepare( "
-                               SELECT id
-                               FROM {$wpdb->gp_projects}
-                               WHERE parent_project_id = %d
-                       ", $$project_id ) );
-               }
-
-               $translation_set_ids = $wpdb->get_col( "
-                       SELECT `id` FROM {$wpdb->gp_translation_sets} WHERE `project_id` IN (" . implode( ',', $sub_projects ) . ")
-               " );
-
-               if ( ! $translation_set_ids ) {
-                       return array();
-               }
-
-               $date_begin = new DateTime( '-6 day' );
-               $date_end = new DateTime( 'NOW' );
-               $date_interval = new DateInterval( 'P1D' );
-               $date_range = new DatePeriod( $date_begin, $date_interval, $date_end );
-
-               $days = array();
-               foreach( $date_range as $date ) {
-                       $days[] = $date->format( 'Y-m-d' );
-               }
-               $days[] = $date_end->format( 'Y-m-d' );
-
-               $counts = $wpdb->get_results( "
-                       SELECT
-                               DATE(date_modified) AS `day`, COUNT(*) AS `count`, `status`
-                       FROM {$wpdb->gp_translations}
-                       WHERE
-                               `translation_set_id` IN (" . implode( ',', $translation_set_ids ) . ")
-                               AND date_modified >= ( CURDATE() - INTERVAL 7 DAY )
-                       GROUP BY `status`, `day`
-                       ORDER BY `day` DESC
-               " );
-
-               $status = array( 'current', 'waiting', 'rejected' );
-               $data = [];
-               foreach ( $days as $day ) {
-                       $data[ $day ] = array_fill_keys( $status, 0 );
-                       foreach ( $counts as $count ) {
-                               if ( $count->day !== $day || ! in_array( $count->status, $status ) ) {
-                                       continue;
-                               }
-
-                               $data[ $day ][ $count->status ] = (int) $count->count;
-                       }
-               }
-
-               $labels = array_keys( $data );
-               array_pop( $labels );
-               $labels[] = ''; // Don't show a label for today
-
-               $series = array();
-               $series_data = array_values( $data );
-               foreach ( $status as $stati ) {
-                       $series[] = (object) array(
-                               'name' => $stati,
-                               'data' => wp_list_pluck( $series_data, $stati ),
-                       );
-               }
-
-               $last_updated = time();
-               $chart_data = compact( 'labels', 'series', 'last_updated' );
-
-               gp_update_meta( $project_id, 'contributors-chart-data', $chart_data, 'wp-plugins' );
-
-               return $chart_data;
-       }
-
-       /**
</del><span class="cx" style="display: block; padding: 0 10px">          * Prints stats about language packs of a specific project.
</span><span class="cx" style="display: block; padding: 0 10px">         *
</span><span class="cx" style="display: block; padding: 0 10px">         * @param string $project_slug Slug of a project.
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -296,11 +145,7 @@
</span><span class="cx" style="display: block; padding: 0 10px">                        return $this->die_with_404();
</span><span class="cx" style="display: block; padding: 0 10px">                }
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                if ( function_exists( 'wporg_get_plugin_icon' ) ) {
-                       $project->icon = wporg_get_plugin_icon( $project->slug, 64 );
-               } else {
-                       $project->icon = '<div class="default-icon"><span class="dashicons dashicons-admin-plugins"></span></div>';
-               }
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+         $project->icon = $this->get_plugin_icon( $project, 64 );
</ins><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">                $http_context = stream_context_create( array(
</span><span class="cx" style="display: block; padding: 0 10px">                        'http' => array(
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -314,30 +159,23 @@
</span><span class="cx" style="display: block; padding: 0 10px">        }
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">        /**
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-         * Retrieves translators of a specific project.
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+  * Retrieves the icon of a plugin.
</ins><span class="cx" style="display: block; padding: 0 10px">          *
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-         * @param int $project_id Project ID.
-        * @return object Translators of the project.
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+  * @param GP_Project $project The plugin project.
+        * @param int        $size    Optional. The size of the icon. Default 64.
+        * @return string HTML markup for the icon.
</ins><span class="cx" style="display: block; padding: 0 10px">          */
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-        private function get_translation_contributors_by_locale( $project_id ) {
-               global $wpdb;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ private function get_plugin_icon( $project, $size = 64 ) {
+               $default = '<div class="default-icon"><span class="dashicons dashicons-admin-plugins"></span></div>';
</ins><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                $sql = $wpdb->prepare( "
-                       SELECT ts.`locale`, ts.`slug` AS `locale_slug`, t.`user_id`
-                       FROM `{$wpdb->gp_translations}` t, `{$wpdb->gp_translation_sets}` ts
-                       WHERE t.`translation_set_id` = ts.`id`
-                           AND t.`user_id` IS NOT NULL AND t.`user_id` != 0
-                           AND t.`date_modified` > %s
-                           AND ts.`project_id` = %d
-                           AND t.`status` <> 'rejected'
-                       GROUP BY ts.`locale`, ts.`slug`, t.`user_id`
-               ", date( 'Y-m-d', time() - YEAR_IN_SECONDS ), $project_id );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+         if ( function_exists( 'wporg_get_plugin_icon' ) ) {
+                       $icon = wporg_get_plugin_icon( $project->slug, $size );
+               }
</ins><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                return $wpdb->get_results( $sql );
-       }
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+         if ( $icon ) {
+                       return $icon;
+               }
</ins><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-        private function _encode( $raw ) {
-               $raw = mb_convert_encoding( $raw, 'UTF-8', 'ASCII, JIS, UTF-8, Windows-1252, ISO-8859-1' );
-               return ent2ncr( htmlspecialchars_decode( htmlentities( $raw, ENT_NOQUOTES, 'UTF-8' ), ENT_NOQUOTES ) );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+         return $default;
</ins><span class="cx" style="display: block; padding: 0 10px">         }
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span></span></pre></div>
<a id="sitestrunkwordpressorgpublic_htmlwpcontentpluginswporggproutesrouteswpthemesphpfromrev2858sitestrunkwordpressorgpublic_htmlwpcontentpluginswporggproutesrouteswppluginsphp"></a>
<div class="copfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Copied: sites/trunk/wordpress.org/public_html/wp-content/plugins/wporg-gp-routes/routes/wp-themes.php (from rev 2858, sites/trunk/wordpress.org/public_html/wp-content/plugins/wporg-gp-routes/routes/wp-plugins.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/routes/wp-themes.php                             (rev 0)
+++ sites/trunk/wordpress.org/public_html/wp-content/plugins/wporg-gp-routes/routes/wp-themes.php       2016-03-31 20:25:15 UTC (rev 2864)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -0,0 +1,170 @@
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+<?php
+
+class WPorg_GP_Route_WP_Themes extends WPorg_GP_Route_WP_Directory {
+
+       /**
+        * Prints stats about sub-project of a specific project.
+        *
+        * @param string $project_slug Slug of a project.
+        */
+       public function get_theme_projects( $project_slug ) {
+               global $wpdb;
+
+               $project_path = 'wp-themes/' . $project_slug;
+               $project = GP::$project->by_path( $project_path );
+               if ( ! $project ) {
+                       return $this->die_with_404();
+               }
+
+               $rows = $wpdb->get_results( "
+                       SELECT
+                               path, locale, locale_slug,
+                               (100 * stats.current/stats.all) as percent_complete,
+                               stats.waiting+stats.fuzzy as waiting_strings,
+                               stats.untranslated as untranslated
+                       FROM {$wpdb->project_translation_status} stats
+                               LEFT JOIN {$wpdb->gp_projects} p ON stats.project_id = p.id
+                       WHERE
+                               p.id = '{$project->id}'
+               " );
+
+               // Split out into $[Locale][Project] = %
+               $translation_locale_statuses = array();
+               $sub_projects = array();
+               foreach ( $rows as $set ) {
+
+                       // Find unique locale key.
+                       $locale_key = $set->locale;
+                       if ( 'default' != $set->locale_slug ) {
+                               $locale_key = $set->locale . '/' . $set->locale_slug;
+                       }
+
+                       /*
+                        * > 50% round down, so that a project with all strings except 1 translated shows 99%, instead of 100%.
+                        * < 50% round up, so that a project with just a few strings shows 1%, instead of 0%.
+                        */
+                       $percent_complete = (float) $set->percent_complete;
+                       $translation_locale_statuses[ $locale_key ]['stable'] = ( $percent_complete > 50 ) ? floor( $percent_complete ) : ceil( $percent_complete );
+
+                       // Increment the amount of waiting and untranslated strings.
+                       if ( ! isset( $translation_locale_statuses[ $locale_key ]['waiting'] ) ) {
+                               $translation_locale_statuses[ $locale_key ]['waiting'] = 0;
+                       }
+                       if ( ! isset( $translation_locale_statuses[ $locale_key ]['untranslated'] ) ) {
+                               $translation_locale_statuses[ $locale_key ]['untranslated'] = 0;
+                       }
+                       $translation_locale_statuses[ $locale_key ]['waiting'] += (int) $set->waiting_strings;
+                       $translation_locale_statuses[ $locale_key ]['untranslated'] += (int) $set->untranslated;
+
+
+                       ksort( $translation_locale_statuses[ $locale_key ], SORT_NATURAL );
+               }
+
+               unset( $project_path, $locale_key, $rows, $set, $sub_project, $sub_projects );
+
+               // Calculate a list of [Locale] = % subtotals
+               $translation_locale_complete = array();
+               foreach ( $translation_locale_statuses as $locale => $sets ) {
+                       unset( $sets['waiting'], $sets['untranslated'] );
+                       $translation_locale_complete[ $locale ] = round( array_sum( $sets ) / count( $sets ), 3 );
+               }
+               unset( $locale, $sets );
+
+
+               // Sort by translation completeness, least number of waiting strings, and locale slug.
+               uksort( $translation_locale_complete, function ( $a, $b ) use ( $translation_locale_complete, $translation_locale_statuses ) {
+                       if ( $translation_locale_complete[ $a ] < $translation_locale_complete[ $b ] ) {
+                               return 1;
+                       } elseif ( $translation_locale_complete[ $a ] == $translation_locale_complete[ $b ] ) {
+                               if ( $translation_locale_statuses[ $a ]['waiting'] != $translation_locale_statuses[ $b ]['waiting'] ) {
+                                       return strnatcmp( $translation_locale_statuses[ $a ]['waiting'], $translation_locale_statuses[ $b ]['waiting'] );
+                               } else {
+                                       return strnatcmp( $a, $b );
+                               }
+                       } else {
+                               return -1;
+                       }
+               } );
+
+               $project->icon = $this->get_theme_icon( $project, 64 );
+
+               $this->tmpl( 'projects-wp-themes', get_defined_vars() );
+       }
+
+       /**
+        * Prints stats about contributors of a specific project.
+        *
+        * @param string $project_slug Slug of a project.
+        */
+       public function get_theme_contributors( $project_slug ) {
+               global $wpdb;
+
+               $project_path = 'wp-themes/' . $project_slug;
+               $project = GP::$project->by_path( $project_path );
+               if ( ! $project ) {
+                       return $this->die_with_404();
+               }
+
+               $project->icon = $this->get_theme_icon( $project, 64 );
+
+               $contributors_by_locale = gp_get_meta( 'wp-themes', $project->id, 'contributors-by-locale' );
+               if ( ! $contributors_by_locale || $contributors_by_locale['last_updated'] + HOUR_IN_SECONDS < time() ) {
+                       $contributors_by_locale = $this->get_contributors( $project );
+                       $contributors_by_locale['last_updated'] = time();
+                       gp_update_meta( $project->id, 'contributors-by-locale', $contributors_by_locale, 'wp-themes' );
+               }
+
+               $chart_data = gp_get_meta( 'wp-themes', $project->id, 'contributors-chart-data' );
+               if ( ! $chart_data || $chart_data['last_updated'] + DAY_IN_SECONDS < time() ) {
+                       $chart_data = $this->get_contributors_chart_data( $project );
+                       $chart_data['last_updated'] = time();
+                       gp_update_meta( $project->id, 'contributors-chart-data', $chart_data, 'wp-themes' );
+               }
+
+               unset( $contributors_by_locale['last_updated'], $chart_data['last_updated'] );
+
+               $this->tmpl( 'projects-wp-plugins-contributors', get_defined_vars() );
+       }
+
+       /**
+        * Prints stats about language packs of a specific project.
+        *
+        * @param string $project_slug Slug of a project.
+        */
+       public function get_theme_language_packs( $project_slug ) {
+               $project_path = 'wp-themes/' . $project_slug;
+               $project = GP::$project->by_path( $project_path );
+               if ( ! $project ) {
+                       return $this->die_with_404();
+               }
+
+               $project->icon = $this->get_theme_icon( $project, 64 );
+
+               $language_packs = $this->get_language_packs( 'theme', $project_slug );
+
+               $this->tmpl( 'projects-wp-plugins-language-packs', get_defined_vars() );
+       }
+
+       /**
+        * Retrieves the icon of a theme.
+        *
+        * @param GP_Project $project The theme project.
+        * @param int        $size    Optional. The size of the icon. Default 64.
+        * @return string HTML markup for the icon.
+        */
+       private function get_theme_icon( $project, $size = 64 ) {
+               $default = '<div class="default-icon"><span class="dashicons dashicons-admin-themes"></span></div>';
+
+               $screenshot = gp_get_meta( 'wp-themes', $project->id, 'screenshot' );
+               if ( $screenshot ) {
+                       return sprintf(
+                               '<div class="icon"><img src="%s" alt="" width="%d" height="%d"></div>',
+                               esc_url( 'https://i0.wp.com/' . $screenshot . '?w=' . $size * 2 . '&strip=all' ),
+                               $size,
+                               $size
+                       );
+               }
+
+               return $default;
+       }
+}
</ins></span></pre></div>
<a id="sitestrunkwordpressorgpublic_htmlwpcontentpluginswporggprouteswporggproutesphp"></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/wporg-gp-routes.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/wporg-gp-routes.php      2016-03-31 20:14:20 UTC (rev 2863)
+++ sites/trunk/wordpress.org/public_html/wp-content/plugins/wporg-gp-routes/wporg-gp-routes.php        2016-03-31 20:25:15 UTC (rev 2864)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -12,7 +12,9 @@
</span><span class="cx" style="display: block; padding: 0 10px"> require_once __DIR__ . '/routes/index.php';
</span><span class="cx" style="display: block; padding: 0 10px"> require_once __DIR__ . '/routes/locale.php';
</span><span class="cx" style="display: block; padding: 0 10px"> require_once __DIR__ . '/routes/stats-overview.php';
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+require_once __DIR__ . '/routes/wp-directory.php';
</ins><span class="cx" style="display: block; padding: 0 10px"> require_once __DIR__ . '/routes/wp-plugins.php';
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+require_once __DIR__ . '/routes/wp-themes.php';
</ins><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px"> class WPorg_GP_Routes {
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -33,6 +35,8 @@
</span><span class="cx" style="display: block; padding: 0 10px">         *  - /languages/$locale
</span><span class="cx" style="display: block; padding: 0 10px">         *  - /languages/$locale/$path
</span><span class="cx" style="display: block; padding: 0 10px">         *  - /profile/$path
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+         *  - /projects/wp-plugins/?
+        *  - /projects/wp-themes/?
</ins><span class="cx" style="display: block; padding: 0 10px">          *
</span><span class="cx" style="display: block; padding: 0 10px">         * Adds:
</span><span class="cx" style="display: block; padding: 0 10px">         *  - /
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -44,6 +48,9 @@
</span><span class="cx" style="display: block; padding: 0 10px">         *  - /projects/wp-plugins/$project
</span><span class="cx" style="display: block; padding: 0 10px">         *  - /projects/wp-plugins/$project/contributors
</span><span class="cx" style="display: block; padding: 0 10px">         *  - /projects/wp-plugins/$project/language-packs
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+         *  - /projects/wp-themes/$project
+        *  - /projects/wp-themes/$project/contributors
+        *  - /projects/wp-themes/$project/language-packs
</ins><span class="cx" style="display: block; padding: 0 10px">          */
</span><span class="cx" style="display: block; padding: 0 10px">        public function register_routes() {
</span><span class="cx" style="display: block; padding: 0 10px">                $request_uri = GP::$router->request_uri();
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -76,6 +83,9 @@
</span><span class="cx" style="display: block; padding: 0 10px">                        GP::$router->prepend( "/projects/wp-plugins/$project", array( 'WPorg_GP_Route_WP_Plugins', 'get_plugin_projects' ) );
</span><span class="cx" style="display: block; padding: 0 10px">                        GP::$router->prepend( "/projects/wp-plugins/$project/contributors", array( 'WPorg_GP_Route_WP_Plugins', 'get_plugin_contributors' ) );
</span><span class="cx" style="display: block; padding: 0 10px">                        GP::$router->prepend( "/projects/wp-plugins/$project/language-packs", array( 'WPorg_GP_Route_WP_Plugins', 'get_plugin_language_packs' ) );
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                        GP::$router->prepend( "/projects/wp-themes/$project", array( 'WPorg_GP_Route_WP_Themes', 'get_theme_projects' ) );
+                       GP::$router->prepend( "/projects/wp-themes/$project/contributors", array( 'WPorg_GP_Route_WP_Themes', 'get_theme_contributors' ) );
+                       GP::$router->prepend( "/projects/wp-themes/$project/language-packs", array( 'WPorg_GP_Route_WP_Themes', 'get_theme_language_packs' ) );
</ins><span class="cx" style="display: block; padding: 0 10px">                 }
</span><span class="cx" style="display: block; padding: 0 10px">        }
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span></span></pre>
</div>
</div>

</body>
</html>