Making WordPress.org


Ignore:
Timestamp:
07/10/2015 05:29:36 PM (10 years ago)
Author:
ocean90
Message:

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 #994, #1091.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sites/trunk/translate.wordpress.org/includes/gp-plugins/wporg-routes/routes/locale.php

    r1686 r1721  
    33 * Locale Route Class.
    44 *
    5  * Provides the route for translate.wordpress.org/languages.
     5 * Provides the route for translate.wordpress.org/locale/$locale.
    66 */
    77class GP_WPorg_Route_Locale extends GP_Route {
    8 
    9     /**
    10      * Prints all exisiting locales as cards.
    11      */
    12     public function get_locales() {
    13         $locales = array();
    14         $existing_locales = GP::$translation_set->existing_locales();
    15         foreach ( $existing_locales as $locale ) {
    16             $locales[] = GP_Locales::by_slug( $locale );
    17         }
    18         usort( $locales, array( $this, '_sort_english_name_callback') );
    19         unset( $existing_locales );
    20 
    21         $contributors_count = wp_cache_get( 'contributors-count', 'wporg-translate' );
    22         if ( false === $contributors_count ) {
    23             $contributors_count = array();
    24         }
    25 
    26         $translation_status = wp_cache_get( 'translation-status', 'wporg-translate' );
    27         if ( false === $translation_status ) {
    28             $translation_status = array();
    29         }
    30 
    31         $this->tmpl( 'locales', get_defined_vars() );
    32     }
    338
    349    /**
     
    7853        $variants = $this->get_locale_variants( $locale_slug, array_keys( $project_status ) );
    7954
    80         $this->tmpl( 'locale', get_defined_vars() );
     55        $this->tmpl( 'locale-projects', get_defined_vars() );
    8156    }
    8257
     
    285260        return strcasecmp( $a->name, $b->name );
    286261    }
    287 
    288     private function _sort_english_name_callback( $a, $b ) {
    289         return $a->english_name > $b->english_name;
    290     }
    291262}
Note: See TracChangeset for help on using the changeset viewer.