<!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>[1721] sites/trunk/translate.wordpress.org: Translate: Improve custom routes.</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/1721">1721</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/1721","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-07-10 17:29:36 +0000 (Fri, 10 Jul 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: Improve custom routes.
* Don't register custom routes for API request.
* Move locale overview to translate.wordpress.org, no redirect anymore.
* Replace `/languages` prefix with `/locale`.
* Redirect old `/languages` URLs to the new route.
* Rename custom templates.
see <a href="http://meta.trac.wordpress.org/ticket/994">#994</a>, <a href="http://meta.trac.wordpress.org/ticket/1091">#1091</a>.</pre>
<h3>Modified Paths</h3>
<ul>
<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="#sitestrunktranslatewordpressorgincludesgppluginswporgrouteswporgroutesphp">sites/trunk/translate.wordpress.org/includes/gp-plugins/wporg-routes/wporg-routes.php</a></li>
<li><a href="#sitestrunktranslatewordpressorgpublic_htmlgptemplateslocaleprojectphp">sites/trunk/translate.wordpress.org/public_html/gp-templates/locale-project.php</a></li>
</ul>
<h3>Added Paths</h3>
<ul>
<li><a href="#sitestrunktranslatewordpressorgincludesgppluginswporgroutesroutesredirectorphp">sites/trunk/translate.wordpress.org/includes/gp-plugins/wporg-routes/routes/redirector.php</a></li>
<li><a href="#sitestrunktranslatewordpressorgpublic_htmlgptemplatesindexlocalesphp">sites/trunk/translate.wordpress.org/public_html/gp-templates/index-locales.php</a></li>
<li><a href="#sitestrunktranslatewordpressorgpublic_htmlgptemplateslocaleprojectsphp">sites/trunk/translate.wordpress.org/public_html/gp-templates/locale-projects.php</a></li>
</ul>
<h3>Removed Paths</h3>
<ul>
<li><a href="#sitestrunktranslatewordpressorgpublic_htmlgptemplateslocalephp">sites/trunk/translate.wordpress.org/public_html/gp-templates/locale.php</a></li>
<li><a href="#sitestrunktranslatewordpressorgpublic_htmlgptemplateslocalesphp">sites/trunk/translate.wordpress.org/public_html/gp-templates/locales.php</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="sitestrunktranslatewordpressorgincludesgppluginswporgroutesroutesindexphp"></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/routes/index.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 2015-07-09 23:47:53 UTC (rev 1720)
+++ sites/trunk/translate.wordpress.org/includes/gp-plugins/wporg-routes/routes/index.php 2015-07-10 17:29:36 UTC (rev 1721)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -6,7 +6,32 @@
</span><span class="cx" style="display: block; padding: 0 10px"> */
</span><span class="cx" style="display: block; padding: 0 10px"> class GP_WPorg_Route_Index extends GP_Route {
</span><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- public function get_index() {
- $this->redirect( gp_url( '/languages' ) );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ /**
+ * 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_english_name_callback') );
+ 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( 'index-locales', get_defined_vars() );
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+
+ private function _sort_english_name_callback( $a, $b ) {
+ return $a->english_name > $b->english_name;
+ }
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span></span></pre></div>
<a id="sitestrunktranslatewordpressorgincludesgppluginswporgroutesrouteslocalephp"></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/routes/locale.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 2015-07-09 23:47:53 UTC (rev 1720)
+++ sites/trunk/translate.wordpress.org/includes/gp-plugins/wporg-routes/routes/locale.php 2015-07-10 17:29:36 UTC (rev 1721)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -2,36 +2,11 @@
</span><span class="cx" style="display: block; padding: 0 10px"> /**
</span><span class="cx" style="display: block; padding: 0 10px"> * Locale Route Class.
</span><span class="cx" style="display: block; padding: 0 10px"> *
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * Provides the route for translate.wordpress.org/languages.
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * Provides the route for translate.wordpress.org/locale/$locale.
</ins><span class="cx" style="display: block; padding: 0 10px"> */
</span><span class="cx" style="display: block; padding: 0 10px"> class GP_WPorg_Route_Locale extends GP_Route {
</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">- * 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_english_name_callback') );
- 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() );
- }
-
- /**
</del><span class="cx" style="display: block; padding: 0 10px"> * Prints projects/translation sets of a top level project.
</span><span class="cx" style="display: block; padding: 0 10px"> *
</span><span class="cx" style="display: block; padding: 0 10px"> * @param string $locale_slug Slug of the locale.
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -77,7 +52,7 @@
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> $variants = $this->get_locale_variants( $locale_slug, array_keys( $project_status ) );
</span><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- $this->tmpl( 'locale', get_defined_vars() );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $this->tmpl( 'locale-projects', get_defined_vars() );
</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="lines" style="display: block; padding: 0 10px; color: #888">@@ -284,8 +259,4 @@
</span><span class="cx" style="display: block; padding: 0 10px"> private function _sort_name_callback( $a, $b ) {
</span><span class="cx" style="display: block; padding: 0 10px"> return strcasecmp( $a->name, $b->name );
</span><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 _sort_english_name_callback( $a, $b ) {
- return $a->english_name > $b->english_name;
- }
</del><span class="cx" style="display: block; padding: 0 10px"> }
</span></span></pre></div>
<a id="sitestrunktranslatewordpressorgincludesgppluginswporgroutesroutesredirectorphp"></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/includes/gp-plugins/wporg-routes/routes/redirector.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/redirector.php (rev 0)
+++ sites/trunk/translate.wordpress.org/includes/gp-plugins/wporg-routes/routes/redirector.php 2015-07-10 17:29:36 UTC (rev 1721)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -0,0 +1,16 @@
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+<?php
+/**
+ * Redirector Route Class.
+ *
+ * Provides redirection routes.
+ */
+class GP_WPorg_Route_Redirector extends GP_Route {
+
+ function redirect_languages( $path = '' ) {
+ if ( empty( $path ) ) {
+ $this->redirect( '/' );
+ } else {
+ $this->redirect( "/locale/$path" );
+ }
+ }
+}
</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-07-09 23:47:53 UTC (rev 1720)
+++ sites/trunk/translate.wordpress.org/includes/gp-plugins/wporg-routes/wporg-routes.php 2015-07-10 17:29:36 UTC (rev 1721)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -1,10 +1,11 @@
</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">- * This plugins overrides some of the default routes of GlotPress.
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * Register custom routes for translate.wordpress.org.
</ins><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><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/redirector.php';
</ins><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">
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -17,24 +18,31 @@
</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">+ // Bail for API requests.
+ $request_uri = GP::$router->request_uri();
+ if ( gp_startswith( $request_uri, '/' . GP::$router->api_prefix . '/' ) ) {
+ return;
+ }
+
</ins><span class="cx" style="display: block; padding: 0 10px"> $path = '(.+?)';
</span><span class="cx" style="display: block; padding: 0 10px"> $locale = '(' . implode( '|', array_map( function( $locale ) { return $locale->slug; }, GP_Locales::locales() ) ) . ')';
</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 default routes.
- * The `routes` filter can't be used, see https://glotpress.trac.wordpress.org/ticket/249.
- */
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ // Unset default routes.
</ins><span class="cx" style="display: block; padding: 0 10px"> unset( GP::$router->urls['/'] );
</span><span class="cx" style="display: block; padding: 0 10px"> unset( GP::$router->urls["get:/languages/$locale/$path"] );
</span><span class="cx" style="display: block; padding: 0 10px"> unset( GP::$router->urls["get:/languages/$locale"] );
</span><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', 'get_index' ) );
- GP::$router->add( "/languages/$locale/$path/$path/$path", array( 'GP_WPorg_Route_Locale', 'get_locale_project' ) );
- GP::$router->add( "/languages/$locale/$path/$path", array( 'GP_WPorg_Route_Locale', 'get_locale_projects' ) );
- GP::$router->add( "/languages/$locale/$path", array( 'GP_WPorg_Route_Locale', 'get_locale_projects' ) );
- GP::$router->add( "/languages/$locale", array( 'GP_WPorg_Route_Locale', 'get_locale_projects' ) );
- GP::$router->add( '/languages', array( 'GP_WPorg_Route_Locale', 'get_locales' ) );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ // Redirect routes.
+ GP::$router->add( "/languages/$path", array( 'GP_WPorg_Route_Redirector', 'redirect_languages' ) );
+ GP::$router->add( '/languages', array( 'GP_WPorg_Route_Redirector', 'redirect_languages' ) );
+
+ // Register custom routes.
+ GP::$router->add( '/', array( 'GP_WPorg_Route_Index', 'get_locales' ) );
+ GP::$router->add( "/locale/$locale/$path/$path/$path", array( 'GP_WPorg_Route_Locale', 'get_locale_project' ) );
+ GP::$router->add( "/locale/$locale/$path/$path", array( 'GP_WPorg_Route_Locale', 'get_locale_projects' ) );
+ GP::$router->add( "/locale/$locale/$path", array( 'GP_WPorg_Route_Locale', 'get_locale_projects' ) );
+ GP::$router->add( "/locale/$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></span></pre></div>
<a id="sitestrunktranslatewordpressorgpublic_htmlgptemplatesindexlocalesphpfromrev1706sitestrunktranslatewordpressorgpublic_htmlgptemplateslocalesphp"></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/index-locales.php (from rev 1706, sites/trunk/translate.wordpress.org/public_html/gp-templates/locales.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/index-locales.php (rev 0)
+++ sites/trunk/translate.wordpress.org/public_html/gp-templates/index-locales.php 2015-07-10 17:29:36 UTC (rev 1721)
</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( __('Locales < GlotPress') );
+wp_enqueue_script('common');
+gp_tmpl_header();
+?>
+
+ <p class="intro"><?php _e('Contribute to WordPress core, themes, and plugins by translating them into your language. Select your locale below to get started.'); ?></p>
+ <p class="intro">If your locale isn’t below, follow the steps in the <a href="https://make.wordpress.org/polyglots/handbook/translating/requesting-a-new-locale/">Translator Handbook</a> to contribute a new locale.</p>
+
+ <div class="filter-header">
+ <ul class="filter-header-links">
+ <li><span class="current"><?php _e( 'Find your locale' ); ?></span></li>
+ </ul>
+ <div class="search-form">
+ <label class="screen-reader-text" for="locales-filter"><?php esc_attr_e( 'Search locales...' ); ?></label>
+ <input placeholder="<?php esc_attr_e( 'Search locales...' ); ?>" type="search" id="locales-filter" class="filter-search">
+ </div>
+ </div>
+
+ <div id="locales" class="locales">
+ <?php foreach ( $locales as $locale ) :
+ $percent_complete = 0;
+ if ( isset( $translation_status[ $locale->slug ] ) ) {
+ $status = $translation_status[ $locale->slug ];
+ $percent_complete = floor( $status->current_count / $status->all_count * 100 );
+ }
+
+ $wp_locale = ( isset( $locale->wp_locale ) ) ? $locale->wp_locale : $locale->slug;
+ ?>
+ <div class="locale <?php echo 'percent-' . $percent_complete; ?>">
+ <ul class="name">
+ <li class="english"><?php echo gp_link_get( gp_url_join( '/locale', $locale->slug ), $locale->english_name ) ?></li>
+ <li class="native"><?php echo gp_link_get( gp_url_join( '/locale', $locale->slug ), $locale->native_name ) ?></li>
+ <li class="code"><?php echo gp_link_get( gp_url_join( '/locale', $locale->slug ), $wp_locale ) ?></li>
+ </ul>
+ <div class="contributors">
+ <?php
+ $contributors = sprintf(
+ '<span class="dashicons dashicons-admin-users"></span><br />%s',
+ isset( $contributors_count[ $locale->slug ] ) ? $contributors_count[ $locale->slug ] : 0
+ );
+ echo gp_link_get( 'https://make.wordpress.org/polyglots/teams/?locale=' . $locale->wp_locale, $contributors );
+ ?>
+ </div>
+ <div class="percent">
+ <div class="percent-complete" style="width:<?php echo $percent_complete; ?>%;"></div>
+ </div>
+ <div class="locale-button">
+ <div class="button contribute-button">
+ <?php echo gp_link_get( gp_url_join( '/locale', $locale->slug ), 'Contribute Translation' ) ?>
+ </div>
+ </div>
+ </div>
+ <?php endforeach; ?>
+ </div>
+
+ <script>
+ jQuery( document ).ready( function( $ ) {
+ $rows = $( '#locales' ).find( '.locale' );
+ $( '#locales-filter' ).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( '.name' );
+ for ( var d = 0; d < words.length; ++d ) {
+ if ( $t.text().toLowerCase().indexOf( words[d] ) != -1 ) {
+ return true;
+ }
+ }
+ return false;
+ }).show();
+ }
+ });
+ });
+ </script>
+
+<?php gp_tmpl_footer();
</ins></span></pre></div>
<a id="sitestrunktranslatewordpressorgpublic_htmlgptemplateslocaleprojectphp"></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/locale-project.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-project.php 2015-07-09 23:47:53 UTC (rev 1720)
+++ sites/trunk/translate.wordpress.org/public_html/gp-templates/locale-project.php 2015-07-10 17:29:36 UTC (rev 1721)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -2,8 +2,8 @@
</span><span class="cx" style="display: block; padding: 0 10px"> gp_title( sprintf( __( 'Projects translated to %s < GlotPress' ), esc_html( $locale->english_name ) ) );
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> $breadcrumb = array();
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-$breadcrumb[] = gp_link_get( '/languages', __( 'Locales' ) );
-$breadcrumb[] = gp_link_get( gp_url_join( '/languages', $locale_slug, $set_slug), esc_html( $locale->english_name ) );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+$breadcrumb[] = gp_link_get( '/', __( 'Locales' ) );
+$breadcrumb[] = gp_link_get( gp_url_join( '/locale', $locale_slug, $set_slug), esc_html( $locale->english_name ) );
</ins><span class="cx" style="display: block; padding: 0 10px"> $breadcrumb[] = $sub_project->name;
</span><span class="cx" style="display: block; padding: 0 10px"> gp_breadcrumb( $breadcrumb );
</span><span class="cx" style="display: block; padding: 0 10px"> gp_tmpl_header();
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -35,7 +35,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> printf(
</span><span class="cx" style="display: block; padding: 0 10px"> '<option name="%s" data-project-url="%s"%s>%s</option>',
</span><span class="cx" style="display: block; padding: 0 10px"> $variant,
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- esc_url( gp_url_join( '/languages', $locale_slug, $variant, $sub_project->path ) ),
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ esc_url( gp_url_join( '/locale', $locale_slug, $variant, $sub_project->path ) ),
</ins><span class="cx" style="display: block; padding: 0 10px"> ( $set_slug == $variant ) ? ' selected="selected"' : '',
</span><span class="cx" style="display: block; padding: 0 10px"> ucfirst( $variant )
</span><span class="cx" style="display: block; padding: 0 10px"> );
</span></span></pre></div>
<a id="sitestrunktranslatewordpressorgpublic_htmlgptemplateslocaleprojectsphpfromrev1706sitestrunktranslatewordpressorgpublic_htmlgptemplateslocalephp"></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/locale-projects.php (from rev 1706, 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-projects.php (rev 0)
+++ sites/trunk/translate.wordpress.org/public_html/gp-templates/locale-projects.php 2015-07-10 17:29:36 UTC (rev 1721)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -0,0 +1,177 @@
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+<?php
+gp_title( sprintf( __( 'Projects translated to %s < GlotPress' ), esc_html( $locale->english_name ) ) );
+
+$breadcrumb = array();
+$breadcrumb[] = gp_link_get( '/', __( 'Locales' ) );
+$breadcrumb[] = esc_html( $locale->english_name );
+gp_breadcrumb( $breadcrumb );
+gp_tmpl_header();
+?>
+
+<div class="locale-header">
+ <p class="locale-intro">Translate WordPress, core projects, plugins, and themes into your language. Select your project below to get started.</p>
+
+ <div class="locale-box">
+ <ul class="name">
+ <li class="english"><?php echo $locale->english_name; ?></li>
+ <li class="native"><?php echo $locale->native_name; ?></li>
+ <li class="code">
+ <?php
+ echo $locale->wp_locale;
+
+ if ( count( $variants ) > 1 ) {
+ ?>
+ <select id="variant-selector" name="variant">
+ <?php
+ foreach ( $variants as $variant ) {
+ $selected =
+ printf(
+ '<option name="%s" data-project-url="%s"%s>%s</option>',
+ $variant,
+ esc_url( gp_url_join( '/locale', $locale_slug, $variant, $project->slug ) ),
+ ( $set_slug == $variant ) ? ' selected="selected"' : '',
+ ucfirst( $variant )
+ );
+ }
+ ?>
+ </select>
+ <?php
+ }
+ ?>
+ </li>
+ </ul>
+ <div class="contributors">
+ <?php
+ $contributors = sprintf(
+ '<span class="dashicons dashicons-admin-users"></span><br />%s',
+ isset( $contributors_count[ $locale->slug ] ) ? $contributors_count[ $locale->slug ] : 0
+ );
+ echo gp_link_get( 'https://make.wordpress.org/polyglots/teams/?locale=' . $locale->wp_locale, $contributors );
+ ?>
+ </div>
+ </div>
+</div>
+
+<div class="filter-header">
+ <ul class="filter-header-links">
+ <?php
+ foreach ( $top_level_projects as $top_level_project ) {
+ printf(
+ '<li><a href="%s"%s>%s</a></li>',
+ gp_url_join( '/locale', $locale_slug, $set_slug, $top_level_project->slug ),
+ ( $top_level_project->path == $project_path ) ? ' class="current"' : '',
+ $top_level_project->name
+ );
+ }
+ ?>
+ </ul>
+ <div class="search-form">
+ <label class="screen-reader-text" for="projects-filter"><?php esc_attr_e( 'Search projects...' ); ?></label>
+ <input placeholder="<?php esc_attr_e( 'Search projects...' ); ?>" type="search" id="projects-filter" class="filter-search">
+ </div>
+</div>
+
+<div id="projects" class="projects">
+ <?php
+ foreach ( $sub_projects as $sub_project ) {
+ $percent_complete = $waiting = $sub_projects_count = 0;
+ if ( isset( $project_status[ $sub_project->id ] ) ) {
+ $status = $project_status[ $sub_project->id ];
+ $percent_complete = floor( $status->current_count / $status->all_count * 100 );
+ $waiting = $status->waiting_count;
+ $sub_projects_count = $status->sub_projects_count;
+ }
+
+ $project_url = gp_url_join( '/locale', $locale_slug, $set_slug, $sub_project->path );
+
+ $project_icon = '';
+ if ( isset( $project_icons[ $sub_project->id ] ) ) {
+ $project_icon = $project_icons[ $sub_project->id ];
+ }
+
+ $classes = 'project-' . sanitize_title_with_dashes( str_replace( '/', '-', $project->path ) );
+ $classes .= ' project-' . sanitize_title_with_dashes( str_replace( '/', '-', $sub_project->path ) );
+ $classes .= ' percent-' . $percent_complete;
+ ?>
+ <div class="project <?php echo $classes; ?>">
+ <div class="project-top">
+ <div class="project-icon">
+ <?php echo gp_link_get( $project_url, $project_icon ) ?>
+ </div>
+
+ <div class="project-name">
+ <h4>
+ <?php echo gp_link_get( $project_url, $sub_project->name ) ?>
+ </h4>
+ </div>
+ <div class="project-description">
+ <p><?php echo $sub_project->description; ?></p>
+ </div>
+ </div>
+
+ <div class="project-status">
+ <div class="project-status-sub-projects">
+ <span class="project-status-title">Sub-Projects</span>
+ <span class="project-status-value"><?php echo $sub_projects_count; ?></span>
+ </div>
+ <div class="project-status-waiting">
+ <span class="project-status-title">Waiting</span>
+ <span class="project-status-value"><?php echo $waiting; ?></span>
+ </div>
+ <div class="project-status-progress">
+ <span class="project-status-title">Progress</span>
+ <span class="project-status-value"><?php echo $percent_complete; ?>%</span>
+ </div>
+ </div>
+
+ <div class="percent">
+ <div class="percent-complete" style="width:<?php echo $percent_complete; ?>%;"></div>
+ </div>
+
+ <div class="project-bottom">
+ <div class="button contribute-button">
+ <?php echo gp_link_get( $project_url, 'Translate Project' ) ?>
+ </div>
+ </div>
+ </div>
+ <?php
+ }
+ ?>
+</div>
+
+<script>
+ jQuery( document ).ready( function( $ ) {
+ $rows = $( '#projects' ).find( '.project' );
+ $( '#projects-filter' ).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( '.project-top' );
+ for ( var d = 0; d < words.length; ++d ) {
+ if ( $t.text().toLowerCase().indexOf( words[d] ) != -1 ) {
+ return true;
+ }
+ }
+ return false;
+ }).show();
+ }
+ });
+
+ $( '#variant-selector' ).on( 'change', function( event ) {
+ event.preventDefault();
+
+ var $optionSelected = $( 'option:selected', this ),
+ projectUrl = $optionSelected.data( 'projectUrl' );
+
+ if ( projectUrl.length ) {
+ window.location = projectUrl;
+ }
+ });
+ });
+</script>
+
+<?php gp_tmpl_footer();
</ins></span></pre></div>
<a id="sitestrunktranslatewordpressorgpublic_htmlgptemplateslocalephp"></a>
<div class="delfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Deleted: 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 2015-07-09 23:47:53 UTC (rev 1720)
+++ sites/trunk/translate.wordpress.org/public_html/gp-templates/locale.php 2015-07-10 17:29:36 UTC (rev 1721)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -1,177 +0,0 @@
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-<?php
-gp_title( sprintf( __( 'Projects translated to %s < GlotPress' ), esc_html( $locale->english_name ) ) );
-
-$breadcrumb = array();
-$breadcrumb[] = gp_link_get( '/languages', __( 'Locales' ) );
-$breadcrumb[] = esc_html( $locale->english_name );
-gp_breadcrumb( $breadcrumb );
-gp_tmpl_header();
-?>
-
-<div class="locale-header">
- <p class="locale-intro">Translate WordPress, core projects, plugins, and themes into your language. Select your project below to get started.</p>
-
- <div class="locale-box">
- <ul class="name">
- <li class="english"><?php echo $locale->english_name; ?></li>
- <li class="native"><?php echo $locale->native_name; ?></li>
- <li class="code">
- <?php
- echo $locale->wp_locale;
-
- if ( count( $variants ) > 1 ) {
- ?>
- <select id="variant-selector" name="variant">
- <?php
- foreach ( $variants as $variant ) {
- $selected =
- printf(
- '<option name="%s" data-project-url="%s"%s>%s</option>',
- $variant,
- esc_url( gp_url_join( '/languages', $locale_slug, $variant, $project->slug ) ),
- ( $set_slug == $variant ) ? ' selected="selected"' : '',
- ucfirst( $variant )
- );
- }
- ?>
- </select>
- <?php
- }
- ?>
- </li>
- </ul>
- <div class="contributors">
- <?php
- $contributors = sprintf(
- '<span class="dashicons dashicons-admin-users"></span><br />%s',
- isset( $contributors_count[ $locale->slug ] ) ? $contributors_count[ $locale->slug ] : 0
- );
- echo gp_link_get( 'https://make.wordpress.org/polyglots/teams/?locale=' . $locale->wp_locale, $contributors );
- ?>
- </div>
- </div>
-</div>
-
-<div class="filter-header">
- <ul class="filter-header-links">
- <?php
- foreach ( $top_level_projects as $top_level_project ) {
- printf(
- '<li><a href="%s"%s>%s</a></li>',
- gp_url_join( '/languages', $locale_slug, $set_slug, $top_level_project->slug ),
- ( $top_level_project->path == $project_path ) ? ' class="current"' : '',
- $top_level_project->name
- );
- }
- ?>
- </ul>
- <div class="search-form">
- <label class="screen-reader-text" for="projects-filter"><?php esc_attr_e( 'Search projects...' ); ?></label>
- <input placeholder="<?php esc_attr_e( 'Search projects...' ); ?>" type="search" id="projects-filter" class="filter-search">
- </div>
-</div>
-
-<div id="projects" class="projects">
- <?php
- foreach ( $sub_projects as $sub_project ) {
- $percent_complete = $waiting = $sub_projects_count = 0;
- if ( isset( $project_status[ $sub_project->id ] ) ) {
- $status = $project_status[ $sub_project->id ];
- $percent_complete = floor( $status->current_count / $status->all_count * 100 );
- $waiting = $status->waiting_count;
- $sub_projects_count = $status->sub_projects_count;
- }
-
- $project_url = gp_url_join( '/languages', $locale_slug, $set_slug, $sub_project->path );
-
- $project_icon = '';
- if ( isset( $project_icons[ $sub_project->id ] ) ) {
- $project_icon = $project_icons[ $sub_project->id ];
- }
-
- $classes = 'project-' . sanitize_title_with_dashes( str_replace( '/', '-', $project->path ) );
- $classes .= ' project-' . sanitize_title_with_dashes( str_replace( '/', '-', $sub_project->path ) );
- $classes .= ' percent-' . $percent_complete;
- ?>
- <div class="project <?php echo $classes; ?>">
- <div class="project-top">
- <div class="project-icon">
- <?php echo gp_link_get( $project_url, $project_icon ) ?>
- </div>
-
- <div class="project-name">
- <h4>
- <?php echo gp_link_get( $project_url, $sub_project->name ) ?>
- </h4>
- </div>
- <div class="project-description">
- <p><?php echo $sub_project->description; ?></p>
- </div>
- </div>
-
- <div class="project-status">
- <div class="project-status-sub-projects">
- <span class="project-status-title">Sub-Projects</span>
- <span class="project-status-value"><?php echo $sub_projects_count; ?></span>
- </div>
- <div class="project-status-waiting">
- <span class="project-status-title">Waiting</span>
- <span class="project-status-value"><?php echo $waiting; ?></span>
- </div>
- <div class="project-status-progress">
- <span class="project-status-title">Progress</span>
- <span class="project-status-value"><?php echo $percent_complete; ?>%</span>
- </div>
- </div>
-
- <div class="percent">
- <div class="percent-complete" style="width:<?php echo $percent_complete; ?>%;"></div>
- </div>
-
- <div class="project-bottom">
- <div class="button contribute-button">
- <?php echo gp_link_get( $project_url, 'Translate Project' ) ?>
- </div>
- </div>
- </div>
- <?php
- }
- ?>
-</div>
-
-<script>
- jQuery( document ).ready( function( $ ) {
- $rows = $( '#projects' ).find( '.project' );
- $( '#projects-filter' ).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( '.project-top' );
- for ( var d = 0; d < words.length; ++d ) {
- if ( $t.text().toLowerCase().indexOf( words[d] ) != -1 ) {
- return true;
- }
- }
- return false;
- }).show();
- }
- });
-
- $( '#variant-selector' ).on( 'change', function( event ) {
- event.preventDefault();
-
- var $optionSelected = $( 'option:selected', this ),
- projectUrl = $optionSelected.data( 'projectUrl' );
-
- if ( projectUrl.length ) {
- window.location = projectUrl;
- }
- });
- });
-</script>
-
-<?php gp_tmpl_footer();
</del></span></pre></div>
<a id="sitestrunktranslatewordpressorgpublic_htmlgptemplateslocalesphp"></a>
<div class="delfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Deleted: sites/trunk/translate.wordpress.org/public_html/gp-templates/locales.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/locales.php 2015-07-09 23:47:53 UTC (rev 1720)
+++ sites/trunk/translate.wordpress.org/public_html/gp-templates/locales.php 2015-07-10 17:29:36 UTC (rev 1721)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -1,81 +0,0 @@
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-<?php
-gp_title( __('Locales < GlotPress') );
-wp_enqueue_script('common');
-gp_tmpl_header();
-?>
-
- <p class="intro"><?php _e('Contribute to WordPress core, themes, and plugins by translating them into your language. Select your locale below to get started.'); ?></p>
- <p class="intro">If your locale isn’t below, follow the steps in the <a href="https://make.wordpress.org/polyglots/handbook/translating/requesting-a-new-locale/">Translator Handbook</a> to contribute a new locale.</p>
-
- <div class="filter-header">
- <ul class="filter-header-links">
- <li><span class="current"><?php _e( 'Find your locale' ); ?></span></li>
- </ul>
- <div class="search-form">
- <label class="screen-reader-text" for="locales-filter"><?php esc_attr_e( 'Search locales...' ); ?></label>
- <input placeholder="<?php esc_attr_e( 'Search locales...' ); ?>" type="search" id="locales-filter" class="filter-search">
- </div>
- </div>
-
- <div id="locales" class="locales">
- <?php foreach ( $locales as $locale ) :
- $percent_complete = 0;
- if ( isset( $translation_status[ $locale->slug ] ) ) {
- $status = $translation_status[ $locale->slug ];
- $percent_complete = floor( $status->current_count / $status->all_count * 100 );
- }
-
- $wp_locale = ( isset( $locale->wp_locale ) ) ? $locale->wp_locale : $locale->slug;
- ?>
- <div class="locale <?php echo 'percent-' . $percent_complete; ?>">
- <ul class="name">
- <li class="english"><?php echo gp_link_get( gp_url_join( gp_url_current(), $locale->slug ), $locale->english_name ) ?></li>
- <li class="native"><?php echo gp_link_get( gp_url_join( gp_url_current(), $locale->slug ), $locale->native_name ) ?></li>
- <li class="code"><?php echo gp_link_get( gp_url_join( gp_url_current(), $locale->slug ), $wp_locale ) ?></li>
- </ul>
- <div class="contributors">
- <?php
- $contributors = sprintf(
- '<span class="dashicons dashicons-admin-users"></span><br />%s',
- isset( $contributors_count[ $locale->slug ] ) ? $contributors_count[ $locale->slug ] : 0
- );
- echo gp_link_get( 'https://make.wordpress.org/polyglots/teams/?locale=' . $locale->wp_locale, $contributors );
- ?>
- </div>
- <div class="percent">
- <div class="percent-complete" style="width:<?php echo $percent_complete; ?>%;"></div>
- </div>
- <div class="locale-button">
- <div class="button contribute-button">
- <?php echo gp_link_get( gp_url_join( gp_url_current(), $locale->slug ), 'Contribute Translation' ) ?>
- </div>
- </div>
- </div>
- <?php endforeach; ?>
- </div>
-
- <script>
- jQuery( document ).ready( function( $ ) {
- $rows = $( '#locales' ).find( '.locale' );
- $( '#locales-filter' ).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( '.name' );
- for ( var d = 0; d < words.length; ++d ) {
- if ( $t.text().toLowerCase().indexOf( words[d] ) != -1 ) {
- return true;
- }
- }
- return false;
- }).show();
- }
- });
- });
- </script>
-
-<?php gp_tmpl_footer();
</del></span></pre>
</div>
</div>
</body>
</html>