WordPress.org

Making WordPress.org


Ignore:
Timestamp:
06/19/2016 11:03:43 AM (6 years ago)
Author:
ocean90
Message:

Plugin Directory: First pass for a locale banner on plugin detail page.

Adds a new REST API endpoint and suggests languages based on the HTTP_ACCEPT_LANGUAGE header.

See #1728.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-plugins/functions.php

    r3389 r3460  
    7575    if ( is_singular( 'plugin' ) ) {
    7676        wp_enqueue_script( 'wporg-plugins-accordion', get_template_directory_uri() . '/js/section-accordion.js', array(), '20160525', true );
     77
     78        $slug = get_queried_object()->post_name;
     79        wp_enqueue_script( 'wporg-plugins-locale-banner', get_template_directory_uri() . '/js/locale-banner.js', array(), '20160525', true );
     80        wp_localize_script( 'wporg-plugins-locale-banner', 'wporgLocaleBanner', array(
     81            'apiURL' => rest_url( "/plugins/v1/plugin/$slug/translations" ),
     82        ) );
    7783    }
    7884}
Note: See TracChangeset for help on using the changeset viewer.