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/index.php

    r1586 r1721  
    77class GP_WPorg_Route_Index extends GP_Route {
    88
    9     public function get_index() {
    10         $this->redirect( gp_url( '/languages' ) );
     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( 'index-locales', get_defined_vars() );
     32    }
     33
     34    private function _sort_english_name_callback( $a, $b ) {
     35        return $a->english_name > $b->english_name;
    1136    }
    1237}
Note: See TracChangeset for help on using the changeset viewer.