WordPress.org

Making WordPress.org

Changeset 3226


Ignore:
Timestamp:
05/24/2016 05:43:23 AM (4 years ago)
Author:
dd32
Message:

Plugin Directory: Add term translation.

See #1573

Location:
sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory
Files:
1 added
2 edited

Legend:

Unmodified
Added
Removed
  • sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory/class-plugin-directory.php

    r3225 r3226  
    2424        add_action( 'widgets_init', array( $this, 'register_widgets' ) );
    2525        add_filter( 'post_type_link', array( $this, 'package_link' ), 10, 2 );
    26         add_filter( 'term_link', array( $this, 'term_link' ), 10, 3 );
     26        add_filter( 'term_link', array( $this, 'term_link' ), 10, 2 );
    2727        add_filter( 'pre_insert_term', array( $this, 'pre_insert_term_prevent' ) );
    2828        add_action( 'pre_get_posts', array( $this, 'use_plugins_in_query' ) );
     
    224224        }
    225225
     226        if ( 'en_US' != get_locale() ) {
     227            add_filter( 'get_term', array( __NAMESPACE__ . '\i18n', 'translate_term' ) );
     228        }
     229
    226230        // Instantiate our copy of the Jetpack_Search class.
    227231        if ( class_exists( 'Jetpack' ) && ! class_exists( 'Jetpack_Search' ) ) {
     
    363367     * @param string   $termlink The generated term link.
    364368     * @param \WP_Term $term     The term the link is for.
    365      * @param string   $taxonomy The taxonomy the term is in.
    366      */
    367     public function term_link( $termlink, $term, $taxonomy ) {
    368         if ( 'plugin_business_model' == $taxonomy ) {
     369     */
     370    public function term_link( $termlink, $term ) {
     371        if ( 'plugin_business_model' == $term->taxonomy ) {
    369372            return false;
    370373        }
    371         if ( 'plugin_built_for' == $taxonomy ) {
     374        if ( 'plugin_built_for' == $term->taxonomy ) {
    372375            return $this->package_link( false, $this->get_plugin_post( $term->slug ) );
    373376        }
  • sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory/widgets/class-meta.php

    r3225 r3226  
    4343            <li><?php printf( __( 'Active installs: %s', 'wporg-plugins' ), Template::active_installs( false ) ); ?></li>
    4444            <li><?php printf( __( 'Category: %s', 'wporg-plugins' ), get_the_term_list( get_post()->ID, 'plugin_category', '', ', ' ) ); ?></li>
    45             <?php if ( $works_with = get_the_term_list( get_post()->ID, 'plugin_built_for', '', ', ' ) ) : ?>
    46                 <li><?php printf( __( 'Designed to work with: %s', 'wporg-plugins' ), $works_with ); ?></li>
     45            <?php if ( $built_for = get_the_term_list( get_post()->ID, 'plugin_built_for', '', ', ' ) ) : ?>
     46                <li><?php printf( __( 'Designed to work with: %s', 'wporg-plugins' ), $built_for ); ?></li>
    4747            <?php endif; ?>
    4848            <?php if ( $business_model = get_the_term_list( get_post()->ID, 'plugin_business_model', '', ', ' ) ) : ?>
Note: See TracChangeset for help on using the changeset viewer.