Making WordPress.org


Ignore:
Timestamp:
04/30/2017 07:39:09 PM (8 years ago)
Author:
ocean90
Message:

Plugin Directory: Make section descriptions translatable.

Fixes #2727.

File:
1 edited

Legend:

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

    r4764 r5450  
    1010
    1111    /**
    12      * Translate a Term Name.
     12     * Translates term names and descriptions.
    1313     *
    1414     * @param \WP_Term $term The Term object to translate.
    15      * @return \WP_Term The term object with a translated `name` field.
     15     * @return \WP_Term The term object with a translated `name` and/or `description` field.
    1616     */
    17     static function translate_term( $term ) {
     17    public static function translate_term( $term ) {
    1818        if ( 'en_US' == get_locale() ) {
    1919            return $term;
     
    2424        } elseif ( 'plugin_section' == $term->taxonomy ) {
    2525            $term->name = esc_html( translate_with_gettext_context( html_entity_decode( $term->name ), 'Plugin Section Name', 'wporg-plugins' ) );
     26            if ( $term->description ) {
     27                $term->description = esc_html( translate_with_gettext_context( html_entity_decode( $term->description ), 'Plugin Section Description', 'wporg-plugins' ) );
     28            }
    2629        } elseif ( 'plugin_business_model' == $term->taxonomy ) {
    2730            $term->name = esc_html( translate_with_gettext_context( html_entity_decode( $term->name ), 'Plugin Business Model', 'wporg-plugins' ) );
     
    3942    private function static_strings() {
    4043
    41         // Category Terms.
     44        // Category terms.
    4245        _x( 'Accessibility',              'Plugin Category Name', 'wporg-plugins' );
    4346        _x( 'Advertising',                'Plugin Category Name', 'wporg-plugins' );
     
    6770        _x( 'Utilities & Tools',          'Plugin Category Name', 'wporg-plugins' );
    6871
    69         // Section Terms.
     72        // Section terms.
    7073        _x( 'Adopt Me',     'Plugin Section Name', 'wporg-plugins' );
    7174        _x( 'Beta',         'Plugin Section Name', 'wporg-plugins' );
     
    7376        _x( 'Featured',     'Plugin Section Name', 'wporg-plugins' );
    7477        _x( 'Popular',      'Plugin Section Name', 'wporg-plugins' );
     78
     79        // Section descriptions.
     80        _x( 'Plugins that have been offered for adoption by others.', 'Plugin Section Description', 'wporg-plugins' );
     81        _x( 'Beta plugins are in development for possible inclusion in a future version of WordPress.', 'Plugin Section Description', 'wporg-plugins' );
     82        _x( 'Plugins contained within this category get displayed on the Featured tab.', 'Plugin Section Description', 'wporg-plugins' );
     83        _x( 'The below plugins have been marked as favorites.', 'Plugin Section Description', 'wporg-plugins' );
    7584    }
    7685}
Note: See TracChangeset for help on using the changeset viewer.