<!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>[1586] sites/trunk/translate.wordpress.org: Translate: "Locales & Languages" page:</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/1586">1586</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/1586","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>2015-05-15 19:19:57 +0000 (Fri, 15 May 2015)</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: "Locales & Languages" page:

* Copy GlotPress' locale template to our theme.
* Move index and locale routes do its own files.
* Register routes for `/language/$locale/$set/$project`.

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

<h3>Modified Paths</h3>
<ul>
<li><a href="#sitestrunktranslatewordpressorgincludesgppluginswporgrouteswporgroutesphp">sites/trunk/translate.wordpress.org/includes/gp-plugins/wporg-routes/wporg-routes.php</a></li>
</ul>

<h3>Added Paths</h3>
<ul>
<li>sites/trunk/translate.wordpress.org/includes/gp-plugins/wporg-routes/routes/</li>
<li><a href="#sitestrunktranslatewordpressorgincludesgppluginswporgroutesroutesindexphp">sites/trunk/translate.wordpress.org/includes/gp-plugins/wporg-routes/routes/index.php</a></li>
<li><a href="#sitestrunktranslatewordpressorgincludesgppluginswporgroutesrouteslocalephp">sites/trunk/translate.wordpress.org/includes/gp-plugins/wporg-routes/routes/locale.php</a></li>
<li><a href="#sitestrunktranslatewordpressorgpublic_htmlgptemplateslocalephp">sites/trunk/translate.wordpress.org/public_html/gp-templates/locale.php</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="sitestrunktranslatewordpressorgincludesgppluginswporgroutesroutesindexphpfromrev1580sitestrunktranslatewordpressorgincludesgppluginswporgrouteswporgroutesphp"></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/includes/gp-plugins/wporg-routes/routes/index.php (from rev 1580, sites/trunk/translate.wordpress.org/includes/gp-plugins/wporg-routes/wporg-routes.php)</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- sites/trunk/translate.wordpress.org/includes/gp-plugins/wporg-routes/routes/index.php                             (rev 0)
+++ sites/trunk/translate.wordpress.org/includes/gp-plugins/wporg-routes/routes/index.php       2015-05-15 19:19:57 UTC (rev 1586)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -0,0 +1,12 @@
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+<?php
+/**
+ * Index Route Class.
+ *
+ * Provides the route for translate.wordpress.org/.
+ */
+class GP_WPorg_Route_Index extends GP_Route {
+
+       public function get_index() {
+               $this->redirect( gp_url( '/languages' ) );
+       }
+}
</ins></span></pre></div>
<a id="sitestrunktranslatewordpressorgincludesgppluginswporgroutesrouteslocalephpfromrev1580sitestrunktranslatewordpressorgincludesgppluginswporgrouteswporgroutesphp"></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/includes/gp-plugins/wporg-routes/routes/locale.php (from rev 1580, sites/trunk/translate.wordpress.org/includes/gp-plugins/wporg-routes/wporg-routes.php)</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- sites/trunk/translate.wordpress.org/includes/gp-plugins/wporg-routes/routes/locale.php                            (rev 0)
+++ sites/trunk/translate.wordpress.org/includes/gp-plugins/wporg-routes/routes/locale.php      2015-05-15 19:19:57 UTC (rev 1586)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -0,0 +1,185 @@
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+<?php
+/**
+ * Locale Route Class.
+ *
+ * Provides the route for translate.wordpress.org/languages.
+ */
+class GP_WPorg_Route_Locale extends GP_Route {
+
+       /**
+        * Prints all exisiting locales as cards.
+        *
+        */
+       public function get_locales() {
+               $locales = array();
+               $existing_locales = GP::$translation_set->existing_locales();
+               foreach ( $existing_locales as $locale ) {
+                       $locales[] = GP_Locales::by_slug( $locale );
+               }
+               usort( $locales, array( $this, 'sort_locales') );
+               unset( $existing_locales );
+
+               $contributors_count = wp_cache_get( 'contributors-count', 'wporg-translate' );
+               if ( false === $contributors_count ) {
+                       $contributors_count = array();
+               }
+
+               $translation_status = wp_cache_get( 'translation-status', 'wporg-translate' );
+               if ( false === $translation_status ) {
+                       $translation_status = array();
+               }
+
+               $this->tmpl( 'locales', get_defined_vars() );
+       }
+
+       /**
+        * Prints translation sets of a top level project.
+        *
+        * @param string $locale_slug      Slug of the locale.
+        * @param string $current_set_slug Slug of the translation set.
+        * @param string $project_path     Path of a project
+        */
+       public function get_locale_projects( $locale_slug, $current_set_slug = 'default', $project_path = 'wp' ) {
+               $locale = GP_Locales::by_slug( $locale_slug );
+               $sets = GP::$translation_set->by_locale( $locale_slug );
+               usort( $sets, array( $this, 'sort_sets_by_project_id' ) );
+
+               /*if ( $project_path ) {
+                       $project = GP::$project->by_path( $project_path );
+
+                       if ( ! $project ) {
+                               return $this->die_with_404();
+                       }
+               }*/
+
+               $locale_projects = $projects_data = $projects = $parents = $set_slugs = $set_list = array();
+
+               //TODO: switch to wp_list_pluck
+               foreach ( $sets as $key => $value ) {
+                       $locale_projects[ $key ] = $value->project_id;
+               }
+
+               foreach ( $sets as $set ) {
+                       $set_slugs[ $set->slug ] = $set;
+
+                       if ( $current_set_slug != $set->slug ) {
+                               continue;
+                       }
+
+                       // Store project data for later use
+                       if ( isset( $projects[ $set->project_id ] ) ) {
+                               $set_project = $projects[$set->project_id];
+                       } else {
+                               $set_project = GP::$project->get( $set->project_id );
+                               $projects[$set->project_id] = $set_project;
+                       }
+
+                       // We only want to list active projects
+                       if ( ! isset( $set_project->active ) || $set_project->active == false ) {
+                               continue;
+                       }
+
+                       $parent_id = is_null( $set_project->parent_project_id ) ? $set_project->id : $set_project->parent_project_id;
+
+                       // Store parent project data for later use
+                       if ( isset( $projects[$parent_id] ) ) {
+                               $parent_project = $projects[$parent_id];
+                       } else {
+                               $parent_project = GP::$project->get( $parent_id );
+                               $projects[$parent_id] = $parent_project;
+                       }
+
+                       // Store parent id for
+                       $parents[$set_project->id] = $parent_id;
+
+                       if ( ! in_array( $set_project->parent_project_id, $locale_projects ) ) {
+                               $projects_data[$parent_id][$set_project->id]['project'] = $set_project;
+                               $projects_data[$parent_id][$set_project->id]['sets'][$set->id] = $this->set_data( $set, $set_project );
+                               $projects_data[$parent_id][$set_project->id]['totals'] = $this->set_data( $set, $set_project );
+
+                               if ( ! isset( $projects_data[$parent_id][$set_project->id]['project'] ) ) {
+                                       $projects_data[$parent_id][$set_project->id]['project'] = $set_project;
+                               }
+                       } else {
+                               while ( ! in_array( $parent_id, array_keys( $projects_data ) ) && isset( $parents[$parent_id] ) ) {
+                                       $previous_parent = $parent_id;
+                                       $parent_id = $parents[$parent_id];
+                               }
+
+                               //Orphan project - a sub project is set to active, while it's parent isn't
+                               if ( ! isset( $projects_data[$parent_id] ) ) {
+                                       continue;
+                               }
+
+                               //For when root project has sets, and sub projects.
+                               if ( ! isset( $previous_parent ) || ! isset( $projects_data[$parent_id][$previous_parent] ) ) {
+                                       $previous_parent = $parent_id;
+                               }
+
+                               $set_data = $projects_data[$parent_id][$previous_parent]['totals'];
+                               $projects_data[$parent_id][$previous_parent]['sets'][$set->id] = $this->set_data( $set, $set_project  );
+                               $projects_data[$parent_id][$previous_parent]['totals'] = $this->set_data( $set, $set_project, $set_data );
+                       }
+               }
+
+               if ( $set_slugs ) {
+                       // Make default the first item.
+                       if ( ! empty( $set_slugs[ 'default' ] ) ) {
+                               $default = $set_slugs[ 'default' ];
+                               unset( $set_slugs[ 'default' ] );
+                               array_unshift( $set_slugs, $default );
+                       }
+
+                       foreach ( $set_slugs as $set ) {
+                               if ( 'default' == $set->slug ) {
+                                       if ( 'default' != $current_set_slug ) {
+                                               $set_list[ $set->slug ] = gp_link_get( gp_url_join( '/languages', $locale->slug ), __( 'Default' ) );
+                                       } else {
+                                               $set_list[ $set->slug ] = __( 'Default' );
+                                       }
+                               } else {
+                                       if ( $set->slug != $current_set_slug ) {
+                                               $set_list[ $set->slug ] = gp_link_get( gp_url_join('/languages', $locale->slug, $set->slug ), esc_html( $set->name ) );
+                                       } else {
+                                               $set_list[ $set->slug ] = esc_html( $set->name );
+                                       }
+                               }
+                       }
+               }
+
+               $this->tmpl( 'locale', get_defined_vars() );
+       }
+
+       private function set_data( $set, $project, $set_data = null ) {
+               if ( ! $set_data ) {
+                       $set_data = new stdClass;
+
+                       $set_data->slug = $set->slug;
+                       $set_data->project_path = $project->path;
+                       $set_data->waiting_count = $set->waiting_count();
+                       $set_data->current_count = $set->current_count();
+                       $set_data->fuzzy_count   = $set->fuzzy_count();
+                       $set_data->all_count     = $set->all_count();
+               }
+               else {
+                       $set_data->waiting_count += $set->waiting_count();
+                       $set_data->current_count += $set->current_count();
+                       $set_data->fuzzy_count   += $set->fuzzy_count();
+                       $set_data->all_count     += $set->all_count();
+               }
+
+               if ( ! isset( $set_data->name ) ) {
+                       $set_data->name = $project->name;
+               }
+
+               return $set_data;
+       }
+
+       private function sort_locales( $a, $b ) {
+               return $a->english_name > $b->english_name;
+       }
+
+       private function sort_sets_by_project_id( $a, $b ) {
+               return $a->project_id > $b->project_id;
+       }
+}
</ins></span></pre></div>
<a id="sitestrunktranslatewordpressorgincludesgppluginswporgrouteswporgroutesphp"></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/includes/gp-plugins/wporg-routes/wporg-routes.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- sites/trunk/translate.wordpress.org/includes/gp-plugins/wporg-routes/wporg-routes.php     2015-05-15 19:06:54 UTC (rev 1585)
+++ sites/trunk/translate.wordpress.org/includes/gp-plugins/wporg-routes/wporg-routes.php       2015-05-15 19:19:57 UTC (rev 1586)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -4,6 +4,10 @@
</span><span class="cx" style="display: block; padding: 0 10px">  *
</span><span class="cx" style="display: block; padding: 0 10px">  * @author ocean90
</span><span class="cx" style="display: block; padding: 0 10px">  */
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+
+require_once __DIR__ . '/routes/index.php';
+require_once __DIR__ . '/routes/locale.php';
+
</ins><span class="cx" style="display: block; padding: 0 10px"> class GP_WPorg_Routes extends GP_Plugin {
</span><span class="cx" style="display: block; padding: 0 10px">        public $id = 'wporg-routes';
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -13,52 +17,24 @@
</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">        public function init() {
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                $locale = '(' . implode( '|', array_map( function( $locale ) { return $locale->slug; }, GP_Locales::locales() ) ) . ')';
+               $set_slug = '(' . implode( '|', GP::$translation_set->existing_slugs() ) . ')';
+
</ins><span class="cx" style="display: block; padding: 0 10px">                 /*
</span><span class="cx" style="display: block; padding: 0 10px">                 * Unset default routes.
</span><span class="cx" style="display: block; padding: 0 10px">                 * The `routes` filter can't be used, see https://glotpress.trac.wordpress.org/ticket/249.
</span><span class="cx" style="display: block; padding: 0 10px">                 */
</span><span class="cx" style="display: block; padding: 0 10px">                unset( GP::$router->urls['/'] );
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                unset( GP::$router->urls["get:/languages/$locale/$set_slug"] );
+               unset( GP::$router->urls["get:/languages/$locale"] );
</ins><span class="cx" style="display: block; padding: 0 10px">                 unset( GP::$router->urls['get:/languages'] );
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                GP::$router->add( '/', array( 'GP_WPorg_Route_Index', 'index' ) );
-               GP::$router->add( '/languages', array( 'GP_WPorg_Route_Locale', 'locales_get' ) );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+         GP::$router->add( '/', array( 'GP_WPorg_Route_Index', 'get_index' ) );
+               GP::$router->add( '/languages', array( 'GP_WPorg_Route_Locale', 'get_locales' ) );
+               GP::$router->add( "/languages/$locale/$set_slug/(.+?)", array( 'GP_WPorg_Route_Locale', 'get_locale_projects' ) );
+               GP::$router->add( "/languages/$locale/$set_slug", array( 'GP_WPorg_Route_Locale', 'get_locale_projects' ) );
+               GP::$router->add( "/languages/$locale", array( 'GP_WPorg_Route_Locale', 'get_locale_projects' ) );
</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><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-class GP_WPorg_Route_Locale extends GP_Route {
-
-       public function locales_get() {
-               $locales = array();
-               $existing_locales = GP::$translation_set->existing_locales();
-               foreach ( $existing_locales as $locale ) {
-                       $locales[] = GP_Locales::by_slug( $locale );
-               }
-               usort( $locales, array( $this, 'sort_locales') );
-               unset( $existing_locales );
-
-               $contributors_count = wp_cache_get( 'contributors-count', 'wporg-translate' );
-               if ( false === $contributors_count ) {
-                       $contributors_count = array();
-               }
-
-               $translation_status = wp_cache_get( 'translation-status', 'wporg-translate' );
-               if ( false === $translation_status ) {
-                       $translation_status = array();
-               }
-
-               $this->tmpl( 'locales', get_defined_vars() );
-       }
-
-       private function sort_locales( $a, $b ) {
-               return $a->english_name > $b->english_name;
-       }
-}
-
-class GP_WPorg_Route_Index extends GP_Route {
-
-       public function index() {
-               $this->redirect( gp_url( '/languages' ) );
-       }
-}
-
</del><span class="cx" style="display: block; padding: 0 10px"> GP::$plugins->wporg_routes = new GP_WPorg_Routes;
</span></span></pre></div>
<a id="sitestrunktranslatewordpressorgpublic_htmlgptemplateslocalephp"></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/locale.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/locale.php                           (rev 0)
+++ sites/trunk/translate.wordpress.org/public_html/gp-templates/locale.php     2015-05-15 19:19:57 UTC (rev 1586)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -0,0 +1,81 @@
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+<?php
+gp_title( sprintf( __( 'Projects translated to %s &lt; GlotPress' ),  esc_html( $locale->english_name ) ) );
+
+$breadcrumb = array();
+$breadcrumb[] = gp_link_get( '/languages', __( 'Locales' ) );
+if ( 'default' == $current_set_slug ) {
+       $breadcrumb[] = esc_html( $locale->english_name );
+} else {
+       $breadcrumb[] = gp_link_get( gp_url_join( '/languages', $locale->slug ), esc_html( $locale->english_name ) );
+       $breadcrumb[] = $set_list[ $current_set_slug ];
+}
+gp_breadcrumb( $breadcrumb );
+gp_tmpl_header();
+?>
+
+       <h2><?php printf( __( 'Active Projects translated to %s' ), esc_html( $locale->english_name ) ); ?></h2>
+
+<?php if ( count( $set_list ) > 1 ) : ?>
+       <p class="actionlist secondary">
+               <?php echo implode( ' &bull;&nbsp;', $set_list ); ?>
+       </p>
+<?php endif; ?>
+
+<?php
+if ( empty( $projects_data ) ) {
+       _e( 'No active projects found.' );
+}
+?>
+
+<?php foreach ( $projects_data as $project_id => $sub_projects ) : ?>
+       <div class="locale-project">
+               <h3><?php echo ( $projects[$project_id]->name );?></h3>
+               <table class="locale-sub-projects">
+                       <thead>
+                       <tr>
+                               <th class="header" <?php if (count($sub_projects)>1 ) echo 'rowspan="'. count($sub_projects) . '"';?>><?php if (count($sub_projects)>1 ) _e( 'Project' ); ?></th>
+                               <th class="header"><?php _e( 'Set / Sub Project' ); ?></th>
+                               <th><?php _e( 'Translated' ); ?></th>
+                               <th><?php _e( 'Fuzzy' ); ?></th>
+                               <th><?php _e( 'Untranslated' ); ?></th>
+                               <th><?php _e( 'Waiting' ); ?></th>
+                       </tr>
+                       </thead>
+                       <tbody>
+                       <?php foreach ( $sub_projects as $sub_project_id => $data ) : ?>
+                               <tr>
+                               <th class="sub-project" rowspan="<?php echo count( $data['sets'] );  ?>">
+                                       <?php if (count($sub_projects)>1  ) echo esc_html( $projects[$sub_project_id]->name ); ?>
+                                       <div class="stats">
+                                               <div class="total-strings"><?php printf( __( '%d strings' ), $data['totals']->all_count ); ?></div>
+                                               <div class="percent-completed"><?php printf( __( '%d%% translated' ), $data['totals']->current_count ? floor( absint($data['totals']->current_count ) / absint( $data['totals']->all_count ) * 100 ) : 0 ); ?></div>
+                                       </div>
+                               </th>
+                               <?php foreach ( $data['sets'] as $set_id => $set_data ) : ?>
+                                       <?php  reset( $data['sets'] );       if ( $set_id !== key($data['sets']) ) echo '<tr>'; ?>
+                                       <td class="set-name">
+                                               <strong><?php gp_link( gp_url_project( $set_data->project_path, gp_url_join( $locale->slug, $set_data->slug ) ), $set_data->name ); ?></strong>
+                                               <?php if ( $set_data->current_count && $set_data->current_count >= $set_data->all_count * 0.9 ):
+                                                       $percent = floor( $set_data->current_count / $set_data->all_count * 100 );
+                                                       ?>
+                                                       <span class="bubble morethan90"><?php echo $percent; ?>%</span>
+                                               <?php endif;?>
+                                       </td>
+                                       <td class="stats translated"><?php gp_link( gp_url_project( $set_data->project_path, gp_url_join( $locale->slug, $set_data->slug ), array('filters[translated]' => 'yes', 'filters[status]' => 'current') ), absint( $set_data->current_count ) ); ?></td>
+                                       <td class="stats fuzzy"><?php gp_link( gp_url_project( $set_data->project_path, gp_url_join( $locale->slug, $set_data->slug ), array('filters[status]' => 'fuzzy' ) ), absint( $set_data->fuzzy_count ) ); ?></td>
+                                       <td class="stats untranslated"><?php gp_link( gp_url_project( $set_data->project_path, gp_url_join( $locale->slug, $set_data->slug ), array('filters[status]' => 'untranslated' ) ), absint( $set_data->all_count ) -  absint( $set_data->current_count ) ); ?></td>
+                                       <td class="stats waiting"><?php gp_link( gp_url_project( $set_data->project_path, gp_url_join( $locale->slug, $set_data->slug ), array('filters[translated]' => 'yes', 'filters[status]' => 'waiting') ), absint( $set_data->waiting_count ) ); ?></td>
+                                       </tr>
+                               <?php endforeach; //sub project slugs ?>
+                               </tr>
+                       <?php endforeach;  //sub projects ?>
+                       </tbody>
+               </table>
+       </div>
+<?php endforeach; //top projects ?>
+
+       <p class="actionlist secondary">
+               <?php gp_link( '/projects', __('All projects') ); ?>
+       </p>
+
+<?php gp_tmpl_footer();
</ins></span></pre>
</div>
</div>

</body>
</html>