<!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>[1163] sites/trunk/wordpress.org/public_html/wp-content/plugins/wp-i18n-teams: i18n Teams: Add filters for translation status.</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/1163">1163</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/1163","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-01-22 19:18:11 +0000 (Thu, 22 Jan 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'>i18n Teams: Add filters for translation status.
see <a href="http://meta.trac.wordpress.org/ticket/340">#340</a>.</pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#sitestrunkwordpressorgpublic_htmlwpcontentpluginswpi18nteamscssi18nteamscss">sites/trunk/wordpress.org/public_html/wp-content/plugins/wp-i18n-teams/css/i18n-teams.css</a></li>
<li><a href="#sitestrunkwordpressorgpublic_htmlwpcontentpluginswpi18nteamsjsi18nteamsjs">sites/trunk/wordpress.org/public_html/wp-content/plugins/wp-i18n-teams/js/i18n-teams.js</a></li>
<li><a href="#sitestrunkwordpressorgpublic_htmlwpcontentpluginswpi18nteamsviewsalllocalesphp">sites/trunk/wordpress.org/public_html/wp-content/plugins/wp-i18n-teams/views/all-locales.php</a></li>
<li><a href="#sitestrunkwordpressorgpublic_htmlwpcontentpluginswpi18nteamsviewslocaledetailsphp">sites/trunk/wordpress.org/public_html/wp-content/plugins/wp-i18n-teams/views/locale-details.php</a></li>
<li><a href="#sitestrunkwordpressorgpublic_htmlwpcontentpluginswpi18nteamswpi18nteamsphp">sites/trunk/wordpress.org/public_html/wp-content/plugins/wp-i18n-teams/wp-i18n-teams.php</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="sitestrunkwordpressorgpublic_htmlwpcontentpluginswpi18nteamscssi18nteamscss"></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/wp-i18n-teams/css/i18n-teams.css</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/wp-i18n-teams/css/i18n-teams.css 2015-01-22 04:03:34 UTC (rev 1162)
+++ sites/trunk/wordpress.org/public_html/wp-content/plugins/wp-i18n-teams/css/i18n-teams.css 2015-01-22 19:18:11 UTC (rev 1163)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -15,16 +15,27 @@
</span><span class="cx" style="display: block; padding: 0 10px"> color: #e38587;
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+.i18n-filter.current-filter {
+ color: #555;
+ border-bottom: 1px solid #555;
+}
+
</ins><span class="cx" style="display: block; padding: 0 10px"> .translators-info tbody tr {
</span><span class="cx" style="display: block; padding: 0 10px"> display: none;
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+
</ins><span class="cx" style="display: block; padding: 0 10px"> .show-all tbody tr,
</span><span class="cx" style="display: block; padding: 0 10px"> .translators-info.show-latest tbody tr.latest,
</span><span class="cx" style="display: block; padding: 0 10px"> .translators-info.show-minor-behind tbody tr.minor-behind,
</span><span class="cx" style="display: block; padding: 0 10px"> .translators-info.show-major-behind-one tbody tr.major-behind-one,
</span><span class="cx" style="display: block; padding: 0 10px"> .translators-info.show-major-behind-many tbody tr.major-behind-many,
</span><span class="cx" style="display: block; padding: 0 10px"> .translators-info.show-no-releases tbody tr.no-releases,
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-.translators-info.show-no-site tbody tr.no-site {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+.translators-info.show-no-site tbody tr.no-site,
+.translators-info.show-translated-100 tbody tr.translated-100,
+.translators-info.show-translated-95 tbody tr.translated-95,
+.translators-info.show-translated-90 tbody tr.translated-90,
+.translators-info.show-translated-50-less tbody tr.translated-50-less,
+.translators-info.show-translated-50 tbody tr.translated-50 {
</ins><span class="cx" style="display: block; padding: 0 10px"> display: table-row;
</span><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_htmlwpcontentpluginswpi18nteamsjsi18nteamsjs"></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/wp-i18n-teams/js/i18n-teams.js</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/wp-i18n-teams/js/i18n-teams.js 2015-01-22 04:03:34 UTC (rev 1162)
+++ sites/trunk/wordpress.org/public_html/wp-content/plugins/wp-i18n-teams/js/i18n-teams.js 2015-01-22 19:18:11 UTC (rev 1163)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -1,7 +1,9 @@
</span><span class="cx" style="display: block; padding: 0 10px"> jQuery( function( $ ) {
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> $('.locale-filters').on( 'click', '.i18n-filter', function() {
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $( '.current-filter' ).removeClass( 'current-filter' );
</ins><span class="cx" style="display: block; padding: 0 10px"> $( '.translators-info' )[0].className = 'translators-info show-' + $( this ).data( 'filter' );
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $( this ).addClass( 'current-filter' );
</ins><span class="cx" style="display: block; padding: 0 10px"> return false;
</span><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_htmlwpcontentpluginswpi18nteamsviewsalllocalesphp"></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/wp-i18n-teams/views/all-locales.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/wp-i18n-teams/views/all-locales.php 2015-01-22 04:03:34 UTC (rev 1162)
+++ sites/trunk/wordpress.org/public_html/wp-content/plugins/wp-i18n-teams/views/all-locales.php 2015-01-22 19:18:11 UTC (rev 1163)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -1,8 +1,10 @@
</span><span class="cx" style="display: block; padding: 0 10px"> <div class="translators-info show-all">
</span><span class="cx" style="display: block; padding: 0 10px"> <p class="locale-filters">
</span><span class="cx" style="display: block; padding: 0 10px"> <?php
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- $statuses = array(
- 'all' => _n_noop( '%s locale.', '%s locales.' ),
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ _e( 'Releases:', 'worg' );
+
+ $release_statuses = array(
+ 'all' => _n_noop( '%s locale.', '%s locales.', 'wporg' ),
</ins><span class="cx" style="display: block; padding: 0 10px"> 'latest' => _n_noop( '%s locale up to date.', '%s locales up to date.', 'wporg' ),
</span><span class="cx" style="display: block; padding: 0 10px"> 'minor-behind' => _n_noop( '%s locale behind by minor versions.', '%s locales behind by minor versions.', 'wprog' ),
</span><span class="cx" style="display: block; padding: 0 10px"> 'major-behind-one' => _n_noop( '%s locale behind one major version.', '%s locales behind by one major version.', 'wporg' ),
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -11,20 +13,41 @@
</span><span class="cx" style="display: block; padding: 0 10px"> 'no-site' => _n_noop( '%s locale doesn’t have a site.', '%s locales don᾿t have a site.', 'wporg' ),
</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">- foreach ( $statuses as $status => $nooped_plural ) {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ foreach ( $release_statuses as $status => $nooped_plural ) {
</ins><span class="cx" style="display: block; padding: 0 10px"> $string = translate_nooped_plural( $nooped_plural, $locale_data['status_counts'][ $status ] );
</span><span class="cx" style="display: block; padding: 0 10px"> $string = sprintf( $string, sprintf( '<strong class="i18n-label %s">%s</strong>', $status, $locale_data['status_counts'][ $status ] ) );
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- printf( '<a href="#" class="i18n-filter" data-filter="%s">%s</a> ', $status, $string );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ printf( ' <a href="#" class="i18n-filter" data-filter="%s">%s</a>', $status, $string );
</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"> </p>
</span><span class="cx" style="display: block; padding: 0 10px">
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ <p class="locale-filters">
+ <?php
+ _e( 'Translations:', 'worg' );
+
+ $translation_statuses = array(
+ 'all' => _n_noop( '%s locale.', '%s locales.', 'wporg' ),
+ 'translated-100' => _n_noop( '%s locale at 100%%.', '%s locales at 100%%.', 'wporg' ),
+ 'translated-95' => _n_noop( '%s locale has more than 95%%.', '%s locales have more than 95%%.', 'wporg' ),
+ 'translated-90' => _n_noop( '%s locale has more than 90%%.', '%s locales have more than 90%%.', 'wporg' ),
+ 'translated-50' => _n_noop( '%s locale has more than 50%%.', '%s locales have more than 50%%.', 'wporg' ),
+ 'translated-50-less' => _n_noop( '%s locale has less than 50%%.', '%s locales have less than 50%%.', 'wporg' ),
+ );
+
+ foreach ( $translation_statuses as $status => $nooped_plural ) {
+ $string = translate_nooped_plural( $nooped_plural, $locale_data['status_counts'][ $status ] );
+ $string = sprintf( $string, sprintf( '<strong class="i18n-label %s">%s</strong>', $status, $locale_data['status_counts'][ $status ] ) );
+ printf( ' <a href="#" class="i18n-filter" data-filter="%s">%s</a>', $status, $string );
+ }
+ ?>
+ </p>
+
</ins><span class="cx" style="display: block; padding: 0 10px"> <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 colspan="2"><?php _e( 'Locale', 'wporg' ); ?></th>
- <th><?php _e( 'WP Locale', 'wporg' ); ?></th>
- <th><?php _e( 'Version', 'wporg' ); ?></th>
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ <th colspan="2"><?php _e( 'Locale', 'wporg' ); ?></th>
+ <th><?php _e( 'WP Locale', 'wporg' ); ?></th>
+ <th><?php _e( 'Version', 'wporg' ); ?></th>
</ins><span class="cx" style="display: block; padding: 0 10px"> <th colspan="2">GlotPress</th>
</span><span class="cx" style="display: block; padding: 0 10px"> <th><!-- intentionally blank --></th>
</span><span class="cx" style="display: block; padding: 0 10px"> </tr>
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -32,7 +55,11 @@
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> <tbody>
</span><span class="cx" style="display: block; padding: 0 10px"> <?php foreach ( $locales as $locale ) : ?>
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- <tr class="locale-version <?php echo esc_attr( $locale_data[ $locale->wp_locale ]['status'] ); ?>">
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ <?php
+ $classes = 'locale-version ';
+ $classes .= $locale_data[ $locale->wp_locale ]['release_status'] . ' ' . $locale_data[ $locale->wp_locale ]['translation_status'];
+ ?>
+ <tr class="<?php echo trim( $classes ); ?>">
</ins><span class="cx" style="display: block; padding: 0 10px"> <td class="no-right-border">
</span><span class="cx" style="display: block; padding: 0 10px"> <?php if ( $locale_data[ $locale->wp_locale ]['rosetta_site_url'] ) : ?>
</span><span class="cx" style="display: block; padding: 0 10px"> <a href="<?php echo esc_url( $locale_data[ $locale->wp_locale ]['rosetta_site_url'] ); ?>">
</span></span></pre></div>
<a id="sitestrunkwordpressorgpublic_htmlwpcontentpluginswpi18nteamsviewslocaledetailsphp"></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/wp-i18n-teams/views/locale-details.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/wp-i18n-teams/views/locale-details.php 2015-01-22 04:03:34 UTC (rev 1162)
+++ sites/trunk/wordpress.org/public_html/wp-content/plugins/wp-i18n-teams/views/locale-details.php 2015-01-22 19:18:11 UTC (rev 1163)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -1,3 +1,4 @@
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+<p><a href="<?php echo esc_url( get_permalink() ); ?>"><?php _e( '← All locales', 'wporg' ); ?></a></p>
</ins><span class="cx" style="display: block; padding: 0 10px"> <div id="locale-header">
</span><span class="cx" style="display: block; padding: 0 10px"> <h1>
</span><span class="cx" style="display: block; padding: 0 10px"> <?php echo esc_html( $locale->native_name ); ?>
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -51,7 +52,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> </div>
</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">-<h2>Validators</h2>
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+<h2><?php _e( 'Validators', 'wporg' ); ?></h2>
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> <?php if ( empty( $locale_data['validators'] ) ) : ?>
</span><span class="cx" style="display: block; padding: 0 10px"> <p><?php printf( __( '%s does not have any validators yet.', 'wporg' ), $locale->english_name ); ?></p>
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -69,7 +70,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> <?php endif; ?>
</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">-<h2>Translators</h2>
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+<h2><?php _e( 'Translators', 'wporg' ); ?></h2>
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> <?php if ( empty( $locale_data['translators'] ) ) : ?>
</span><span class="cx" style="display: block; padding: 0 10px"> <p><?php printf( __( '%s does not have any translators yet.', 'wporg' ), $locale->english_name ); ?></p>
</span></span></pre></div>
<a id="sitestrunkwordpressorgpublic_htmlwpcontentpluginswpi18nteamswpi18nteamsphp"></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/wp-i18n-teams/wp-i18n-teams.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/wp-i18n-teams/wp-i18n-teams.php 2015-01-22 04:03:34 UTC (rev 1162)
+++ sites/trunk/wordpress.org/public_html/wp-content/plugins/wp-i18n-teams/wp-i18n-teams.php 2015-01-22 19:18:11 UTC (rev 1163)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -103,28 +103,55 @@
</span><span class="cx" style="display: block; padding: 0 10px"> */
</span><span class="cx" style="display: block; padding: 0 10px"> public function get_locales_data() {
</span><span class="cx" style="display: block; padding: 0 10px"> global $wpdb;
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+
+ $cache = get_transient( 'wp_i18n_teams_locales_data' );
+ if ( false !== $cache ) {
+ return $cache;
+ }
+
</ins><span class="cx" style="display: block; padding: 0 10px"> $gp_locales = self::get_locales();
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $translation_data = $this->get_core_translation_data();
</ins><span class="cx" style="display: block; padding: 0 10px"> $locale_data = array();
</span><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- $statuses = array( 'no-site' => 0, 'no-releases' => 0, 'latest' => 0, 'minor-behind' => 0, 'major-behind-one' => 0, 'major-behind-many' => 0 );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $statuses = array(
+ 'no-site' => 0,
+ 'no-releases' => 0,
+ 'latest' => 0,
+ 'minor-behind' => 0,
+ 'major-behind-one' => 0,
+ 'major-behind-many' => 0,
+ 'translated-100' => 0,
+ 'translated-95' => 0,
+ 'translated-90' => 0,
+ 'translated-50' => 0,
+ 'translated-50-less' => 0,
+ );
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> $wporg_data = $wpdb->get_results( "SELECT locale, subdomain, latest_release FROM locales ORDER BY locale", OBJECT_K );
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> foreach ( $gp_locales as $locale ) {
</span><span class="cx" style="display: block; padding: 0 10px"> $subdomain = $wporg_data[ $locale->wp_locale ]->subdomain;
</span><span class="cx" style="display: block; padding: 0 10px"> $latest_release = $wporg_data[ $locale->wp_locale ]->latest_release;
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- $status = self::get_locale_status( $subdomain, $latest_release );
- $statuses[ $status ]++;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $release_status = self::get_locale_release_status( $subdomain, $latest_release );
+ $statuses[ $release_status ]++;
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $translation_status = '';
+ if ( isset ( $translation_data[ $locale->wp_locale ] ) ) {
+ $translation_status = self::get_locale_translation_status( $translation_data[ $locale->wp_locale ] );
+ $statuses[ $translation_status ]++;
+ }
+
</ins><span class="cx" style="display: block; padding: 0 10px"> $locale_data[ $locale->wp_locale ] = array(
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- 'status' => $status,
- 'rosetta_site_url' => $subdomain ? 'https://' . $subdomain . '.wordpress.org' : false,
- 'latest_release' => $latest_release ? $latest_release : false,
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ 'release_status' => $release_status,
+ 'translation_status' => $translation_status,
+ 'rosetta_site_url' => $subdomain ? 'https://' . $subdomain . '.wordpress.org' : false,
+ 'latest_release' => $latest_release ? $latest_release : false,
</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 class="cx" style="display: block; padding: 0 10px"> $locale_data['status_counts'] = $statuses;
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- $locale_data['status_counts']['all'] = array_sum( $statuses );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $locale_data['status_counts']['all'] = count( $gp_locales );
+ set_transient( 'wp_i18n_teams_locales_data', $locale_data, 900 );
</ins><span class="cx" style="display: block; padding: 0 10px"> return $locale_data;
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -200,14 +227,14 @@
</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">- * Determine the status of the given locale
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * Determine the release status of the given locale,
</ins><span class="cx" style="display: block; padding: 0 10px"> *
</span><span class="cx" style="display: block; padding: 0 10px"> * @param string $rosetta_site_url
</span><span class="cx" style="display: block; padding: 0 10px"> * @param string $latest_release
</span><span class="cx" style="display: block; padding: 0 10px"> *
</span><span class="cx" style="display: block; padding: 0 10px"> * @return string
</span><span class="cx" style="display: block; padding: 0 10px"> */
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- protected static function get_locale_status( $rosetta_site_url, $latest_release ) {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ protected static function get_locale_release_status( $rosetta_site_url, $latest_release ) {
</ins><span class="cx" style="display: block; padding: 0 10px"> if ( ! $rosetta_site_url ) {
</span><span class="cx" style="display: block; padding: 0 10px"> return 'no-site';
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -228,6 +255,27 @@
</span><span class="cx" style="display: block; padding: 0 10px"> return 'major-behind-many';
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+
+ /**
+ * Determine the translation status of the given locale.
+ *
+ * @param int $percent_translated
+ *
+ * @return string
+ */
+ protected static function get_locale_translation_status( $percent_translated ) {
+ if ( $percent_translated == 100 ) {
+ return 'translated-100';
+ } elseif ( $percent_translated >= 95 ) {
+ return 'translated-95';
+ } elseif ( $percent_translated >= 90 ) {
+ return 'translated-90';
+ } elseif ( $percent_translated >= 50 ) {
+ return 'translated-50';
+ } else {
+ return 'translated-50-less';
+ }
+ }
</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"> $GLOBALS['wp_i18n_teams'] = new WP_I18n_Teams();
</span></span></pre>
</div>
</div>
</body>
</html>